summaryrefslogtreecommitdiffhomepage
path: root/test/stylesheet
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-03 18:56:24 +0200
committerGeremia Taglialatela <[email protected]>2023-05-03 18:56:24 +0200
commit76647606589f1f5d370a1b0add2b1b8e52dc82ea (patch)
treee7cc041098b4a4fbd6d9e4e20bbd90c21308e95b /test/stylesheet
parentaaf88bd98054b1823ba0ade4b883b84e41b5e947 (diff)
downloadcaxlsx-76647606589f1f5d370a1b0add2b1b8e52dc82ea.tar.gz
caxlsx-76647606589f1f5d370a1b0add2b1b8e52dc82ea.zip
Introduce RuboCop performance
Also fixes performance offences in non-production code
Diffstat (limited to 'test/stylesheet')
-rw-r--r--test/stylesheet/tc_styles.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb
index f64a1cba..31c8cfb1 100644
--- a/test/stylesheet/tc_styles.rb
+++ b/test/stylesheet/tc_styles.rb
@@ -105,10 +105,10 @@ class TestStyles < Test::Unit::TestCase
b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } }
@styles.parse_border_options b_opts
b = @styles.borders.last
- left = b.prs.select { |bpr| bpr.name == :left }[0]
- right = b.prs.select { |bpr| bpr.name == :right }[0]
- top = b.prs.select { |bpr| bpr.name == :top }[0]
- bottom = b.prs.select { |bpr| bpr.name == :bottom }[0]
+ left = b.prs.find { |bpr| bpr.name == :left }
+ right = b.prs.find { |bpr| bpr.name == :right }
+ top = b.prs.find { |bpr| bpr.name == :top }
+ bottom = b.prs.find { |bpr| bpr.name == :bottom }
assert_nil(top, "unspecified top edge should not be created")
assert_nil(bottom, "unspecified bottom edge should not be created")
@@ -150,7 +150,8 @@ class TestStyles < Test::Unit::TestCase
assert_equal(1, created.b)
assert_equal(99, created.sz)
- copied = original_attributes.reject { |key, _value| %w(b sz).include? key }
+ attributes_to_reject = %w(b sz)
+ copied = original_attributes.reject { |key, _value| attributes_to_reject.include? key }
instance_vals = Axlsx.instance_values_for(created)
copied.each do |key, value|