diff --git a/.rubocop.yml b/.rubocop.yml
index 61f99f19a6..cc32da4b99 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,11 +1 @@
inherit_from: .rubocop_todo.yml
-
-# FIXME: These style issues are not part of the automatically generated
-# .rubocop_todo.yml config.
-Style/GuardClause:
- Enabled: false
-
-# FIXME: These style issues are not part of the automatically generated
-# .rubocop_todo.yml config.
-Style/ConditionalAssignment:
- Enabled: false
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 1af5bba659..8504169d07 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -26,21 +26,6 @@ Lint/AssignmentInCondition:
- 'lib/cucumber/runtime/support_code.rb'
- 'spec/cucumber/formatter/spec_helper.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: AlignWith, SupportedStyles.
-# SupportedStyles: either, start_of_block, start_of_line
-Lint/BlockAlignment:
- Exclude:
- - 'lib/cucumber/formatter/html.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
-# SupportedStyles: start_of_line, def
-Lint/DefEndAlignment:
- Enabled: false
-
# Offense count: 1
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
@@ -52,13 +37,6 @@ Lint/DuplicateMethods:
Exclude:
- 'lib/cucumber/multiline_argument.rb'
-# Offense count: 6
-# Cop supports --auto-correct.
-# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
-# SupportedStyles: keyword, variable, start_of_line
-Lint/EndAlignment:
- Enabled: false
-
# Offense count: 2
Lint/Eval:
Exclude:
@@ -87,11 +65,6 @@ Lint/NestedMethodDefinition:
Exclude:
- 'lib/cucumber/formatter/ansicolor.rb'
-# Offense count: 1
-Lint/NonLocalExitFromIterator:
- Exclude:
- - 'lib/autotest/cucumber_mixin.rb'
-
# Offense count: 7
Lint/RescueException:
Exclude:
@@ -133,15 +106,6 @@ Lint/UnusedBlockArgument:
Lint/UnusedMethodArgument:
Enabled: false
-# Offense count: 1
-Lint/UselessAccessModifier:
- Exclude:
- - 'lib/cucumber/multiline_argument/data_table.rb'
-
-# Offense count: 56
-Lint/UselessAssignment:
- Enabled: false
-
# Offense count: 60
Metrics/AbcSize:
Max: 99
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b1339fb92f..c6b3b0723b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,7 +17,7 @@ The rest of this document is a guide for those maintaining Cucumber, and others
## Talking with other devs
-You can chat with the core team on https://gitter.im/cucumber/cucumber. We try to have office hours on Fridays.
+You can chat with the core team on https://gitter.im/cucumber/contributors. We try to have office hours on Fridays.
## Installing your own gems
diff --git a/History.md b/History.md
index fa3e5c0e1a..db9c03e820 100644
--- a/History.md
+++ b/History.md
@@ -24,6 +24,12 @@
* Several tests failing with rbenv ([#1017](https://github.com/cucumber/cucumber-ruby/issues/1017) @nodo)
* Add rubocop to check the style of the codebase ([1014](https://github.com/cucumber/cucumber-ruby/issues/1014) @nodo)
* Fix the rubocop violation 'Lint/AmbiguousRegexpLiteral' ([1025](https://github.com/cucumber/cucumber-ruby/pull/1025) @pmatsinopoulos)
+* Fix rubocop violations ([#1024](https://github.com/cucumber/cucumber-ruby/pull/1024) @madundead)
+* Fix style violations ([#1023](https://github.com/cucumber/cucumber-ruby/pull/1023) @nodo)
+* fix Lint/UselessAssignment ([1029](https://github.com/cucumber/cucumber-ruby/pull/1029) @hotovson)
+* fix Lint/EndAlignment ([#1032](https://github.com/cucumber/cucumber-ruby/pull/1032) @hotovson)
+* fix Lint/NonLocalExitFromIterator ([#1037](https://github.com/cucumber/cucumber-ruby/pull/1037) @hotovson)
+* fix Lint/UselessAccessModifier ([#1036](https://github.com/cucumber/cucumber-ruby/pull/1036) @hotovson)
## [v2.4.0](https://github.com/cucumber/cucumber-ruby/compare/v2.3.3...v2.4.0)
diff --git a/examples/i18n/ar/lib/calculator.rb b/examples/i18n/ar/lib/calculator.rb
index 86b1a09b55..c985898c09 100644
--- a/examples/i18n/ar/lib/calculator.rb
+++ b/examples/i18n/ar/lib/calculator.rb
@@ -6,6 +6,6 @@ def push(n)
end
def جمع
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
\ No newline at end of file
diff --git a/examples/i18n/ca/lib/calculadora.rb b/examples/i18n/ca/lib/calculadora.rb
index 75b427f160..a790d37a73 100644
--- a/examples/i18n/ca/lib/calculadora.rb
+++ b/examples/i18n/ca/lib/calculadora.rb
@@ -6,11 +6,11 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
@args[0].to_f / @args[1].to_f
end
-end
\ No newline at end of file
+end
diff --git a/examples/i18n/cs/lib/calculator.rb b/examples/i18n/cs/lib/calculator.rb
index 0598d3e627..7a607963f1 100644
--- a/examples/i18n/cs/lib/calculator.rb
+++ b/examples/i18n/cs/lib/calculator.rb
@@ -3,12 +3,12 @@ def push(n)
@args ||= []
@args << n
end
-
+
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
@args[0].to_f / @args[1].to_f
end
-end
\ No newline at end of file
+end
diff --git a/examples/i18n/da/lib/lommeregner.rb b/examples/i18n/da/lib/lommeregner.rb
index 4876c25787..3d7f2e971d 100644
--- a/examples/i18n/da/lib/lommeregner.rb
+++ b/examples/i18n/da/lib/lommeregner.rb
@@ -6,6 +6,6 @@ def push(n)
def add
#@args[0] + @args[1]
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
diff --git a/examples/i18n/de/lib/calculator.rb b/examples/i18n/de/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/de/lib/calculator.rb
+++ b/examples/i18n/de/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/el/lib/calculator.rb b/examples/i18n/el/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/el/lib/calculator.rb
+++ b/examples/i18n/el/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/en/lib/calculator.rb b/examples/i18n/en/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/en/lib/calculator.rb
+++ b/examples/i18n/en/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/eo/lib/calculator.rb b/examples/i18n/eo/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/eo/lib/calculator.rb
+++ b/examples/i18n/eo/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/es/lib/calculador.rb b/examples/i18n/es/lib/calculador.rb
index b7db592a5e..d48539aa8b 100644
--- a/examples/i18n/es/lib/calculador.rb
+++ b/examples/i18n/es/lib/calculador.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/et/lib/kalkulaator.rb b/examples/i18n/et/lib/kalkulaator.rb
index 3e75a741e5..0deb096d68 100644
--- a/examples/i18n/et/lib/kalkulaator.rb
+++ b/examples/i18n/et/lib/kalkulaator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def liida
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def jaga
diff --git a/examples/i18n/fi/lib/laskin.rb b/examples/i18n/fi/lib/laskin.rb
index 5e1946c9d1..7eead133f8 100644
--- a/examples/i18n/fi/lib/laskin.rb
+++ b/examples/i18n/fi/lib/laskin.rb
@@ -5,7 +5,7 @@ def pinoa(n)
end
def summaa
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def jaa
diff --git a/examples/i18n/fr/lib/calculatrice.rb b/examples/i18n/fr/lib/calculatrice.rb
index f92cddb3e4..82c7220650 100644
--- a/examples/i18n/fr/lib/calculatrice.rb
+++ b/examples/i18n/fr/lib/calculatrice.rb
@@ -5,6 +5,6 @@ def push(n)
end
def additionner
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
diff --git a/examples/i18n/he/lib/calculator.rb b/examples/i18n/he/lib/calculator.rb
index ff623a1d35..e5b9d69f27 100644
--- a/examples/i18n/he/lib/calculator.rb
+++ b/examples/i18n/he/lib/calculator.rb
@@ -6,7 +6,7 @@ def push(n)
end
def חבר
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def חלק
diff --git a/examples/i18n/hi/lib/calculator.rb b/examples/i18n/hi/lib/calculator.rb
index 844f005f8c..f6a8a275c1 100644
--- a/examples/i18n/hi/lib/calculator.rb
+++ b/examples/i18n/hi/lib/calculator.rb
@@ -6,7 +6,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/ht/lib/kalkilatris.rb b/examples/i18n/ht/lib/kalkilatris.rb
index 53fde2f027..abc321cb30 100644
--- a/examples/i18n/ht/lib/kalkilatris.rb
+++ b/examples/i18n/ht/lib/kalkilatris.rb
@@ -5,7 +5,7 @@ def push(n)
end
def ajoute
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divize
diff --git a/examples/i18n/hu/lib/calculator.rb b/examples/i18n/hu/lib/calculator.rb
index 2949fd4d18..7a607963f1 100644
--- a/examples/i18n/hu/lib/calculator.rb
+++ b/examples/i18n/hu/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/id/lib/calculator.rb b/examples/i18n/id/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/id/lib/calculator.rb
+++ b/examples/i18n/id/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/it/lib/calcolatrice.rb b/examples/i18n/it/lib/calcolatrice.rb
index 82d91844b3..91d6f5df92 100644
--- a/examples/i18n/it/lib/calcolatrice.rb
+++ b/examples/i18n/it/lib/calcolatrice.rb
@@ -3,9 +3,9 @@ def push(n)
@args ||= []
@args << n
end
-
+
def add
#@args[0] + @args[1]
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
-end
\ No newline at end of file
+end
diff --git a/examples/i18n/ja/lib/calculator.rb b/examples/i18n/ja/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/ja/lib/calculator.rb
+++ b/examples/i18n/ja/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/ko/lib/calculator.rb b/examples/i18n/ko/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/ko/lib/calculator.rb
+++ b/examples/i18n/ko/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/lt/lib/calculator.rb b/examples/i18n/lt/lib/calculator.rb
index e70f6a3858..a0f00f9ec5 100644
--- a/examples/i18n/lt/lib/calculator.rb
+++ b/examples/i18n/lt/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/lv/lib/calculator.rb b/examples/i18n/lv/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/lv/lib/calculator.rb
+++ b/examples/i18n/lv/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/no/lib/kalkulator.rb b/examples/i18n/no/lib/kalkulator.rb
index 081bf1c580..5ef7bdb059 100644
--- a/examples/i18n/no/lib/kalkulator.rb
+++ b/examples/i18n/no/lib/kalkulator.rb
@@ -6,6 +6,6 @@ def push(n)
def add
#@args[0] + @args[1]
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
\ No newline at end of file
diff --git a/examples/i18n/pl/lib/calculator.rb b/examples/i18n/pl/lib/calculator.rb
index 2a3b2b5a24..b8ace2bb5d 100644
--- a/examples/i18n/pl/lib/calculator.rb
+++ b/examples/i18n/pl/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def dodaj
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def podziel
diff --git a/examples/i18n/pt/lib/calculadora.rb b/examples/i18n/pt/lib/calculadora.rb
index 037f7de941..fceddab50a 100644
--- a/examples/i18n/pt/lib/calculadora.rb
+++ b/examples/i18n/pt/lib/calculadora.rb
@@ -3,7 +3,7 @@ def push(n)
@args ||= []
@args << n
end
-
+
def soma
@args.inject(0) {|n,sum| sum+n}
end
diff --git a/examples/i18n/ro/lib/calculator.rb b/examples/i18n/ro/lib/calculator.rb
index cc6ce0e969..1c8d35d849 100644
--- a/examples/i18n/ro/lib/calculator.rb
+++ b/examples/i18n/ro/lib/calculator.rb
@@ -6,6 +6,6 @@ def push(n)
def add
#@args[0] + @args[1]
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
diff --git a/examples/i18n/sk/lib/calculator.rb b/examples/i18n/sk/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/sk/lib/calculator.rb
+++ b/examples/i18n/sk/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/examples/i18n/sr-Cyrl/lib/calculator.rb b/examples/i18n/sr-Cyrl/lib/calculator.rb
index 4a43d451e3..d232da7a2b 100644
--- a/examples/i18n/sr-Cyrl/lib/calculator.rb
+++ b/examples/i18n/sr-Cyrl/lib/calculator.rb
@@ -6,7 +6,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
\ No newline at end of file
diff --git a/examples/i18n/sr-Latn/lib/calculator.rb b/examples/i18n/sr-Latn/lib/calculator.rb
index 4a43d451e3..d232da7a2b 100644
--- a/examples/i18n/sr-Latn/lib/calculator.rb
+++ b/examples/i18n/sr-Latn/lib/calculator.rb
@@ -6,7 +6,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
\ No newline at end of file
diff --git a/examples/i18n/sv/lib/kalkulator.rb b/examples/i18n/sv/lib/kalkulator.rb
index 081bf1c580..5ef7bdb059 100644
--- a/examples/i18n/sv/lib/kalkulator.rb
+++ b/examples/i18n/sv/lib/kalkulator.rb
@@ -6,6 +6,6 @@ def push(n)
def add
#@args[0] + @args[1]
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
\ No newline at end of file
diff --git a/examples/i18n/tr/lib/hesap_makinesi.rb b/examples/i18n/tr/lib/hesap_makinesi.rb
index 5e1359cda0..ad595b9e80 100644
--- a/examples/i18n/tr/lib/hesap_makinesi.rb
+++ b/examples/i18n/tr/lib/hesap_makinesi.rb
@@ -6,7 +6,7 @@ def push(n)
end
def topla
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def böl
diff --git a/examples/i18n/zh-CN/lib/calculator.rb b/examples/i18n/zh-CN/lib/calculator.rb
index 4e1ded9ea1..909e20e036 100644
--- a/examples/i18n/zh-CN/lib/calculator.rb
+++ b/examples/i18n/zh-CN/lib/calculator.rb
@@ -5,6 +5,6 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
end
diff --git a/examples/i18n/zh-TW/lib/calculator.rb b/examples/i18n/zh-TW/lib/calculator.rb
index 0598d3e627..ef1947f179 100644
--- a/examples/i18n/zh-TW/lib/calculator.rb
+++ b/examples/i18n/zh-TW/lib/calculator.rb
@@ -5,7 +5,7 @@ def push(n)
end
def add
- @args.inject(0){|n,sum| sum+=n}
+ @args.inject(0){|n,sum| sum + n}
end
def divide
diff --git a/features/lib/support/normalise_output.rb b/features/lib/support/normalise_output.rb
index b1c338818d..9911db7639 100644
--- a/features/lib/support/normalise_output.rb
+++ b/features/lib/support/normalise_output.rb
@@ -6,11 +6,11 @@ def all_stdout
end
def normalise_output(out)
- out = out.gsub(/#{Dir.pwd}\/tmp\/aruba/, '.') # Remove absolute paths
- out = out.gsub(/tmp\/aruba\//, '') # Fix aruba path
- out = out.gsub(/^.*cucumber_process\.rb.*$\n/, '')
- out = out.gsub(/^\d+m\d+\.\d+s$/, '0m0.012s') # Make duration predictable
- out = out.gsub(/Coverage report generated .+$\n/, '') # Remove SimpleCov message
+ out.gsub(/#{Dir.pwd}\/tmp\/aruba/, '.') # Remove absolute paths
+ .gsub(/tmp\/aruba\//, '') # Fix aruba path
+ .gsub(/^.*cucumber_process\.rb.*$\n/, '')
+ .gsub(/^\d+m\d+\.\d+s$/, '0m0.012s') # Make duration predictable
+ .gsub(/Coverage report generated .+$\n/, '') # Remove SimpleCov message
end
def normalise_json(json)
@@ -38,12 +38,9 @@ def normalise_json(json)
end
def normalise_json_step_or_hook(step_or_hook)
- if step_or_hook['result']
- if step_or_hook['result']['duration']
- expect(step_or_hook['result']['duration']).to be >= 0
- step_or_hook['result']['duration'] = 1
- end
- end
+ return unless step_or_hook['result'] && step_or_hook['result']['duration']
+ expect(step_or_hook['result']['duration']).to be >= 0
+ step_or_hook['result']['duration'] = 1
end
end
diff --git a/gem_tasks/cucumber.rake b/gem_tasks/cucumber.rake
index 7be4670189..599b7373d4 100644
--- a/gem_tasks/cucumber.rake
+++ b/gem_tasks/cucumber.rake
@@ -5,16 +5,16 @@ require 'cucumber/platform'
class Cucumber::Rake::Task
def set_profile_for_current_ruby
self.profile = if Cucumber::JRUBY
- Cucumber::WINDOWS ? 'jruby_win' : 'jruby'
- elsif Cucumber::WINDOWS_MRI
- 'windows_mri'
- elsif Cucumber::RUBY_1_9
- 'ruby_1_9'
- elsif Cucumber::RUBY_2_0
- 'ruby_2_0'
- elsif Cucumber::RUBY_2_1
- 'ruby_2_1'
- end
+ Cucumber::WINDOWS ? 'jruby_win' : 'jruby'
+ elsif Cucumber::WINDOWS_MRI
+ 'windows_mri'
+ elsif Cucumber::RUBY_1_9
+ 'ruby_1_9'
+ elsif Cucumber::RUBY_2_0
+ 'ruby_2_0'
+ elsif Cucumber::RUBY_2_1
+ 'ruby_2_1'
+ end
end
end
diff --git a/gem_tasks/environment.rake b/gem_tasks/environment.rake
index f558fe6b53..334d543158 100644
--- a/gem_tasks/environment.rake
+++ b/gem_tasks/environment.rake
@@ -1,8 +1,4 @@
# frozen_string_literal: true
task :ruby_env do
- RUBY_APP = if RUBY_PLATFORM =~ /java/
- 'jruby'
- else
- 'ruby'
- end unless defined? RUBY_APP
+ RUBY_APP ||= RUBY_PLATFORM =~ /java/ ? 'jruby' : 'ruby'
end
diff --git a/lib/autotest/cucumber_mixin.rb b/lib/autotest/cucumber_mixin.rb
index a7dfe57efc..76d1397d5b 100644
--- a/lib/autotest/cucumber_mixin.rb
+++ b/lib/autotest/cucumber_mixin.rb
@@ -71,7 +71,7 @@ def run_features
hook :run_features
Tempfile.open('autotest-cucumber') do |dirty_features_file|
cmd = self.make_cucumber_cmd(self.features_to_run, dirty_features_file.path)
- return if cmd.empty?
+ break if cmd.empty?
puts cmd unless $q
old_sync = $stdout.sync
$stdout.sync = true
@@ -115,11 +115,11 @@ def make_cucumber_cmd(features_to_run, dirty_features_filename)
profile ||= 'autotest' if profile_loader.has_profile?('autotest')
profile ||= nil
- if profile
- args = ['--profile', profile]
- else
- args = %w{--format} << (features_to_run == :all ? 'progress' : 'pretty')
- end
+ args = if profile
+ ['--profile', profile]
+ else
+ %w{--format} << (features_to_run == :all ? 'progress' : 'pretty')
+ end
# No --color option as some IDEs (Netbeans) don't output them very well ([31m1 failed step[0m)
args += %w{--format rerun --out} << dirty_features_filename
args << (features_to_run == :all ? '' : features_to_run)
diff --git a/lib/cucumber/cli/main.rb b/lib/cucumber/cli/main.rb
index 576d8bd590..7fd54aae86 100644
--- a/lib/cucumber/cli/main.rb
+++ b/lib/cucumber/cli/main.rb
@@ -24,11 +24,11 @@ def execute!(existing_runtime = nil)
trap_interrupt
runtime = if existing_runtime
- existing_runtime.configure(configuration)
- existing_runtime
- else
- Runtime.new(configuration)
- end
+ existing_runtime.configure(configuration)
+ existing_runtime
+ else
+ Runtime.new(configuration)
+ end
runtime.run!
if Cucumber.wants_to_quit
diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb
index 93709c2b19..2566358997 100644
--- a/lib/cucumber/cli/options.rb
+++ b/lib/cucumber/cli/options.rb
@@ -161,9 +161,8 @@ def filters
def check_formatter_stream_conflicts()
streams = @options[:formats].uniq.map { |(_, stream)| stream }
- if streams != streams.uniq
- raise 'All but one formatter must use --out, only one can print to each stream (or STDOUT)'
- end
+ return if streams == streams.uniq
+ raise 'All but one formatter must use --out, only one can print to each stream (or STDOUT)'
end
def to_hash
@@ -311,10 +310,9 @@ def banner
def require_files(v)
@options[:require] << v
- if(Cucumber::JRUBY && File.directory?(v))
- require 'java'
- $CLASSPATH << v
- end
+ return unless Cucumber::JRUBY && File.directory?(v)
+ require 'java'
+ $CLASSPATH << v
end
def require_jars(jars)
diff --git a/lib/cucumber/cli/profile_loader.rb b/lib/cucumber/cli/profile_loader.rb
index 6c5c688771..df9b458d93 100644
--- a/lib/cucumber/cli/profile_loader.rb
+++ b/lib/cucumber/cli/profile_loader.rb
@@ -11,7 +11,7 @@ def initialize
end
def args_from(profile)
- unless cucumber_yml.has_key?(profile)
+ unless cucumber_yml.key?(profile)
raise(ProfileNotFound, <<-END_OF_ERROR)
Could not find profile: '#{profile}'
@@ -42,7 +42,7 @@ def args_from(profile)
end
def has_profile?(profile)
- cucumber_yml.has_key?(profile)
+ cucumber_yml.key?(profile)
end
def cucumber_yml_defined?
@@ -62,13 +62,13 @@ def cucumber_yml
require 'yaml'
begin
@cucumber_erb = ERB.new(IO.read(cucumber_file), nil, '%').result(binding)
- rescue Exception => e
+ rescue Exception
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$!.inspect}")
end
begin
@cucumber_yml = YAML::load(@cucumber_erb)
- rescue StandardError => e
+ rescue StandardError
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
end
@@ -89,4 +89,3 @@ def cucumber_file
end
end
end
-
diff --git a/lib/cucumber/formatter/ansicolor.rb b/lib/cucumber/formatter/ansicolor.rb
index 24b280125c..4b910dff93 100644
--- a/lib/cucumber/formatter/ansicolor.rb
+++ b/lib/cucumber/formatter/ansicolor.rb
@@ -9,7 +9,7 @@
end
end
-Cucumber::Term::ANSIColor.coloring = false if !STDOUT.tty? && !ENV.has_key?('AUTOTEST')
+Cucumber::Term::ANSIColor.coloring = false if !STDOUT.tty? && !ENV.key?('AUTOTEST')
module Cucumber
module Formatter
diff --git a/lib/cucumber/formatter/console.rb b/lib/cucumber/formatter/console.rb
index a18228d42a..401e1e9079 100644
--- a/lib/cucumber/formatter/console.rb
+++ b/lib/cucumber/formatter/console.rb
@@ -32,11 +32,11 @@ module Console
def format_step(keyword, step_match, status, source_indent)
comment = if source_indent
- c = ('# ' + step_match.location.to_s).indent(source_indent)
- format_string(c, :comment)
- else
- ''
- end
+ c = ('# ' + step_match.location.to_s).indent(source_indent)
+ format_string(c, :comment)
+ else
+ ''
+ end
format = format_for(status, :param)
line = keyword + step_match.format_args(format) + comment
@@ -105,7 +105,7 @@ def exception_message_string(e, indent)
message = "#{e.message} (#{e.class})".dup.force_encoding('UTF-8')
message = linebreaks(message, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
- string = "#{message}\n#{e.backtrace.join("\n")}".indent(indent)
+ "#{message}\n#{e.backtrace.join("\n")}".indent(indent)
end
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655
@@ -116,13 +116,11 @@ def linebreaks(s, max)
def collect_snippet_data(test_step, result)
# collect snippet data for undefined steps
- unless hook?(test_step)
- keyword = test_step.source.last.actual_keyword(@previous_step_keyword)
- @previous_step_keyword = keyword
- if result.undefined?
- @snippets_input << Console::SnippetData.new(keyword, test_step.source.last)
- end
- end
+ return if hook?(test_step)
+ keyword = test_step.source.last.actual_keyword(@previous_step_keyword)
+ @previous_step_keyword = keyword
+ return unless result.undefined?
+ @snippets_input << Console::SnippetData.new(keyword, test_step.source.last)
end
def print_snippets(options)
@@ -210,7 +208,6 @@ def print_profile_information
end
def do_print_profile_information(profiles)
- profiles_sentence = ''
profiles_sentence = profiles.size == 1 ? profiles.first :
"#{profiles[0...-1].join(', ')} and #{profiles.last}"
@@ -233,11 +230,11 @@ def hook?(test_step)
end
def element_messages(elements, status)
- element_messages = elements.map do |element|
+ elements.map do |element|
if status == :failed
- message = exception_message_string(element.exception, 0)
+ exception_message_string(element.exception, 0)
else
- message = linebreaks(element.backtrace_line, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
+ linebreaks(element.backtrace_line, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
end
end
end
diff --git a/lib/cucumber/formatter/fail_fast.rb b/lib/cucumber/formatter/fail_fast.rb
index 3d95b0ff9f..e00038af3e 100644
--- a/lib/cucumber/formatter/fail_fast.rb
+++ b/lib/cucumber/formatter/fail_fast.rb
@@ -9,7 +9,7 @@ class FailFast
def initialize(configuration)
configuration.on_event :test_case_finished do |event|
- test_case, result = *event.attributes
+ _test_case, result = *event.attributes
Cucumber.wants_to_quit = true unless result.ok?(configuration.strict?)
end
end
diff --git a/lib/cucumber/formatter/html.rb b/lib/cucumber/formatter/html.rb
index 05397144fc..c46b8a26b3 100644
--- a/lib/cucumber/formatter/html.rb
+++ b/lib/cucumber/formatter/html.rb
@@ -56,7 +56,7 @@ def embed_image(src, label)
if @io.respond_to?(:path) and File.file?(src)
out_dir = Pathname.new(File.dirname(File.absolute_path(@io.path)))
src = Pathname.new(File.absolute_path(src)).relative_path_from(out_dir)
- end
+ end
@builder.span(:class => 'embed') do |pre|
pre << %{#{label}
}
@@ -85,7 +85,7 @@ def before_features(features)
)
@builder << ''
- @builder.head do
+ @builder.head do
@builder.meta('http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8')
@builder.title 'Cucumber'
inline_css
@@ -297,7 +297,7 @@ def after_step_result(keyword, step_match, multiline_arg, status, exception, sou
end
if status == :undefined
@builder.pre do |pre|
- # TODO: snippet text should be an event sent to the formatter so we don't
+ # TODO: snippet text should be an event sent to the formatter so we don't
# have this couping to the runtime.
pre << @runtime.snippet_text(keyword,step_match.instance_variable_get('@name') || '', @step.multiline_arg)
end
@@ -590,7 +590,7 @@ def format_exception(exception)
(["#{exception.message}"] + exception.backtrace).join("\n")
end
- def backtrace_line(line)
+ def backtrace_line(line)
if ENV['TM_PROJECT_DIRECTORY']
line.gsub(/^([^:]*\.(?:rb|feature|haml)):(\d*).*$/) do
"#{$1}:#{$2} "
@@ -638,7 +638,13 @@ def outline_step?(step)
class SnippetExtractor #:nodoc:
class NullConverter; def convert(code, pre); code; end; end #:nodoc:
- begin; require 'syntax/convertors/html'; @@converter = Syntax::Convertors::HTML.for_syntax 'ruby'; rescue LoadError => e; @@converter = NullConverter.new; end
+
+ begin
+ require 'syntax/convertors/html'
+ @@converter = Syntax::Convertors::HTML.for_syntax 'ruby'
+ rescue LoadError
+ @@converter = NullConverter.new
+ end
def snippet(error)
raw_code, line = snippet_for(error[0])
diff --git a/lib/cucumber/formatter/json.rb b/lib/cucumber/formatter/json.rb
index 756d613044..01859bd64d 100644
--- a/lib/cucumber/formatter/json.rb
+++ b/lib/cucumber/formatter/json.rb
@@ -66,7 +66,7 @@ def on_test_step_finished(event)
end
def on_test_case_finished(event)
- test_case, result = *event.attributes
+ _test_case, result = *event.attributes
result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
add_failed_around_hook(result) if result.failed? && !@any_step_failed
end
@@ -245,11 +245,11 @@ def feature(feature)
}
unless feature.tags.empty?
@feature_hash[:tags] = create_tags_array(feature.tags)
- if @test_case_hash[:tags]
- @test_case_hash[:tags] = @feature_hash[:tags] + @test_case_hash[:tags]
- else
- @test_case_hash[:tags] = @feature_hash[:tags]
- end
+ @test_case_hash[:tags] = if @test_case_hash[:tags]
+ @feature_hash[:tags] + @test_case_hash[:tags]
+ else
+ @feature_hash[:tags]
+ end
end
@feature_hash[:comments] = Formatter.create_comments_array(feature.comments) unless feature.comments.empty?
@test_case_hash[:id].insert(0, @feature_hash[:id] + ';')
diff --git a/lib/cucumber/formatter/legacy_api/adapter.rb b/lib/cucumber/formatter/legacy_api/adapter.rb
index d0c3c2395f..7b0b62acae 100644
--- a/lib/cucumber/formatter/legacy_api/adapter.rb
+++ b/lib/cucumber/formatter/legacy_api/adapter.rb
@@ -359,7 +359,7 @@ def print_step
if @failed_hidden_background_step
indent = Indent.new(@child.node)
- step_invocation = @failed_hidden_background_step.build_step_invocation(indent, matches, config, messages = [], embeddings = [])
+ step_invocation = @failed_hidden_background_step.build_step_invocation(indent, matches, config, [], [])
@child.step_invocation(step_invocation, @failed_hidden_background_step)
@failed_hidden_background_step = nil
end
@@ -592,7 +592,7 @@ def before
end
def step_invocation(step_invocation, source)
- node, result = source.step, source.step_result
+ _node, result = source.step, source.step_result
@last_step_result = result
@child.step_invocation(step_invocation, source)
end
@@ -643,7 +643,7 @@ def scenario_outline(node, &descend)
def outline_step(step)
step_match = NoStepMatch.new(step, step.name)
step_invocation = LegacyResultBuilder.new(Core::Test::Result::Skipped.new).
- step_invocation(step_match, step, indent, background = nil, configuration, messages = [], embeddings = [])
+ step_invocation(step_match, step, indent, nil, configuration, [], [])
steps_printer.step_invocation step_invocation
end
@@ -699,11 +699,11 @@ def examples_table_row(examples_table_row, before_hook_results)
return if examples_table_row == @current
@child.after if @child
row = ExampleTableRow.new(examples_table_row)
- if !configuration.expand?
- @child = TableRowPrinter.new(formatter, row, before_hook_results).before
- else
- @child = ExpandTableRowPrinter.new(formatter, row, before_hook_results).before
- end
+ @child = if !configuration.expand?
+ TableRowPrinter.new(formatter, row, before_hook_results).before
+ else
+ ExpandTableRowPrinter.new(formatter, row, before_hook_results).before
+ end
@current = examples_table_row
end
diff --git a/lib/cucumber/formatter/legacy_api/ast.rb b/lib/cucumber/formatter/legacy_api/ast.rb
index 7921d4c24f..55c0ae1c5e 100644
--- a/lib/cucumber/formatter/legacy_api/ast.rb
+++ b/lib/cucumber/formatter/legacy_api/ast.rb
@@ -80,17 +80,15 @@ def accept(formatter)
end
def send_output_to(formatter)
- unless @already_accepted
- @messages.each { |message| formatter.puts(message) }
- @embeddings.each { |embedding| embedding.send_to_formatter(formatter) }
- end
+ return if @already_accepted
+ @messages.each { |message| formatter.puts(message) }
+ @embeddings.each { |embedding| embedding.send_to_formatter(formatter) }
end
def describe_exception_to(formatter)
- unless @already_accepted
- @result.describe_exception_to(formatter)
- @already_accepted = true
- end
+ return if @already_accepted
+ @result.describe_exception_to(formatter)
+ @already_accepted = true
end
end
@@ -122,10 +120,10 @@ def accept(formatter)
def step_result_attributes
legacy_multiline_arg = if multiline_arg.kind_of?(Core::Ast::EmptyMultilineArgument)
- nil
- else
- step.multiline_arg
- end
+ nil
+ else
+ step.multiline_arg
+ end
[keyword, step_match, legacy_multiline_arg, status, exception, source_indent, background, file_colon_line]
end
diff --git a/lib/cucumber/formatter/legacy_api/results.rb b/lib/cucumber/formatter/legacy_api/results.rb
index 59c546c683..50cd119b6f 100644
--- a/lib/cucumber/formatter/legacy_api/results.rb
+++ b/lib/cucumber/formatter/legacy_api/results.rb
@@ -13,19 +13,17 @@ def initialize
def step_visited(step) #:nodoc:
step_id = step.object_id
- unless @inserted_steps.has_key?(step_id)
- @inserted_steps[step_id] = step
- steps.push(step)
- end
+ return if @inserted_steps.key?(step_id)
+ @inserted_steps[step_id] = step
+ steps.push(step)
end
def scenario_visited(scenario) #:nodoc:
scenario_id = scenario.object_id
- unless @inserted_scenarios.has_key?(scenario_id)
- @inserted_scenarios[scenario_id] = scenario
- scenarios.push(scenario)
- end
+ return if @inserted_scenarios.key?(scenario_id)
+ @inserted_scenarios[scenario_id] = scenario
+ scenarios.push(scenario)
end
def steps(status = nil) #:nodoc:
diff --git a/lib/cucumber/formatter/progress.rb b/lib/cucumber/formatter/progress.rb
index eb0823579e..efbba72e13 100644
--- a/lib/cucumber/formatter/progress.rb
+++ b/lib/cucumber/formatter/progress.rb
@@ -53,11 +53,11 @@ def on_test_step_finished(event)
test_step = event.test_step
result = event.result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
progress(result.to_sym) if !HookQueryVisitor.new(test_step).hook? || result.failed?
- unless HookQueryVisitor.new(test_step).hook?
- collect_snippet_data(test_step, result)
- @pending_step_matches << @matches[test_step.source] if result.pending?
- @failed_results << result if result.failed?
- end
+
+ return if HookQueryVisitor.new(test_step).hook?
+ collect_snippet_data(test_step, result)
+ @pending_step_matches << @matches[test_step.source] if result.pending?
+ @failed_results << result if result.failed?
end
def on_test_case_finished(event)
@@ -84,12 +84,11 @@ def print_summary
snippet_text(step_keyword, step_name, multiline_arg)
}
do_print_snippets(snippet_text_proc) if config.snippets? && summary.test_steps.total(:undefined) > 0
- if config.wip?
- messages = @passed_test_cases.map do |test_case|
- message = linebreaks("#{test_case.location.on_line(test_case.location.line)}:in `#{test_case.name}'", ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
- end
- do_print_passing_wip(messages)
+ return unless config.wip?
+ messages = @passed_test_cases.map do |test_case|
+ linebreaks("#{test_case.location.on_line(test_case.location.line)}:in `#{test_case.name}'", ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
end
+ do_print_passing_wip(messages)
end
CHARS = {
diff --git a/lib/cucumber/formatter/usage.rb b/lib/cucumber/formatter/usage.rb
index 5d8b5033a6..5ffb9ec117 100644
--- a/lib/cucumber/formatter/usage.rb
+++ b/lib/cucumber/formatter/usage.rb
@@ -59,11 +59,11 @@ def on_test_step_finished(event)
def print_summary
aggregate_info
- if config.dry_run?
- keys = @stepdef_to_match.keys.sort {|a,b| a.regexp_source <=> b.regexp_source}
- else
- keys = @stepdef_to_match.keys.sort {|a,b| a.mean_duration <=> b.mean_duration}.reverse
- end
+ keys = if config.dry_run?
+ @stepdef_to_match.keys.sort {|a,b| a.regexp_source <=> b.regexp_source}
+ else
+ @stepdef_to_match.keys.sort {|a,b| a.mean_duration <=> b.mean_duration}.reverse
+ end
keys.each do |stepdef_key|
print_step_definition(stepdef_key)
diff --git a/lib/cucumber/multiline_argument/data_table.rb b/lib/cucumber/multiline_argument/data_table.rb
index bda3d6be6a..69ae65f1a2 100644
--- a/lib/cucumber/multiline_argument/data_table.rb
+++ b/lib/cucumber/multiline_argument/data_table.rb
@@ -494,11 +494,10 @@ def to_json(*args)
raw.to_json(*args)
end
- private
-
TO_S_PREFIXES = Hash.new(' ')
TO_S_PREFIXES[:comment] = '(+) '
TO_S_PREFIXES[:undefined] = '(-) '
+ private_constant :TO_S_PREFIXES
protected
@@ -556,7 +555,7 @@ def convert_headers! #:nodoc:
raise "No headers matched #{pre.inspect}" if mapped_cells.empty?
raise "#{mapped_cells.length} headers matched #{pre.inspect}: #{mapped_cells.map { |c| c.value }.inspect}" if mapped_cells.length > 1
mapped_cells[0].value = post
- if @conversion_procs.has_key?(pre)
+ if @conversion_procs.key?(pre)
@conversion_procs[post] = @conversion_procs.delete(pre)
end
end
diff --git a/lib/cucumber/rb_support/rb_transform.rb b/lib/cucumber/rb_support/rb_transform.rb
index ca02c245c0..b8329945df 100644
--- a/lib/cucumber/rb_support/rb_transform.rb
+++ b/lib/cucumber/rb_support/rb_transform.rb
@@ -28,10 +28,9 @@ def match(arg)
end
def invoke(arg)
- if matched = match(arg)
- args = matched.captures.empty? ? [arg] : matched.captures
- @rb_language.current_world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
- end
+ return unless matched = match(arg)
+ args = matched.captures.empty? ? [arg] : matched.captures
+ @rb_language.current_world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
end
def to_s
diff --git a/lib/cucumber/runtime/user_interface.rb b/lib/cucumber/runtime/user_interface.rb
index a478cef2bc..d9f63f5a17 100644
--- a/lib/cucumber/runtime/user_interface.rb
+++ b/lib/cucumber/runtime/user_interface.rb
@@ -43,12 +43,9 @@ def ask(question, timeout_seconds)
answer = mri_gets(timeout_seconds)
end
- if(answer)
- puts(answer)
- answer
- else
- raise("Waited for input for #{timeout_seconds} seconds, then timed out.")
- end
+ raise("Waited for input for #{timeout_seconds} seconds, then timed out.") unless answer
+ puts(answer)
+ answer
end
# Embed +src+ of MIME type +mime_type+ into the output. The +src+ argument may
diff --git a/lib/cucumber/step_match.rb b/lib/cucumber/step_match.rb
index 24c3b5974d..0cd7c26569 100644
--- a/lib/cucumber/step_match.rb
+++ b/lib/cucumber/step_match.rb
@@ -70,12 +70,12 @@ def replace_arguments(string, step_arguments, format, &proc)
next if step_argument.offset.nil? || step_argument.offset < past_offset
replacement = if block_given?
- proc.call(step_argument.val)
- elsif Proc === format
- format.call(step_argument.val)
- else
- format % step_argument.val
- end
+ proc.call(step_argument.val)
+ elsif Proc === format
+ format.call(step_argument.val)
+ else
+ format % step_argument.val
+ end
s[step_argument.offset + offset, step_argument.val.length] = replacement
offset += replacement.unpack('U*').length - step_argument.val.unpack('U*').length
diff --git a/spec/cucumber/formatter/json_spec.rb b/spec/cucumber/formatter/json_spec.rb
index f6f708bf25..e6aac72102 100644
--- a/spec/cucumber/formatter/json_spec.rb
+++ b/spec/cucumber/formatter/json_spec.rb
@@ -829,12 +829,10 @@ def normalise_json(json)
end
def normalise_json_step_or_hook(step_or_hook)
- if step_or_hook['result']
- if step_or_hook['result']['duration']
- expect(step_or_hook['result']['duration']).to be >= 0
- step_or_hook['result']['duration'] = 1
- end
- end
+ return unless step_or_hook['result'] && step_or_hook['result']['duration']
+
+ expect(step_or_hook['result']['duration']).to be >= 0
+ step_or_hook['result']['duration'] = 1
end
end
diff --git a/spec/cucumber/formatter/junit_spec.rb b/spec/cucumber/formatter/junit_spec.rb
index 46fea57d21..2309607504 100644
--- a/spec/cucumber/formatter/junit_spec.rb
+++ b/spec/cucumber/formatter/junit_spec.rb
@@ -43,20 +43,18 @@ def write_file(feature_filename, data)
"
class Junit
def before_step(step)
- if step.name.match('a passing ctrl scenario')
- Interceptor::Pipe.unwrap! :stdout
- @fake_io = $stdout = StringIO.new
- $stdout.sync = true
- @interceptedout = Interceptor::Pipe.wrap(:stdout)
- end
+ return unless step.name.match('a passing ctrl scenario')
+ Interceptor::Pipe.unwrap! :stdout
+ @fake_io = $stdout = StringIO.new
+ $stdout.sync = true
+ @interceptedout = Interceptor::Pipe.wrap(:stdout)
end
def after_step(step)
- if step.name.match('a passing ctrl scenario')
- @interceptedout.write("boo\b\cx\e\a\f boo ")
- $stdout = STDOUT
- @fake_io.close
- end
+ return unless step.name.match('a passing ctrl scenario')
+ @interceptedout.write("boo\b\cx\e\a\f boo ")
+ $stdout = STDOUT
+ @fake_io.close
end
end
@@ -196,7 +194,7 @@ def after_step(step)
end
end
end
-
+
context 'In --expand mode' do
let(:runtime) { Runtime.new({:expand => true}) }
before(:each) do
@@ -213,7 +211,7 @@ def after_step(step)
run_defined_feature
@doc = Nokogiri.XML(@formatter.written_files.values.first)
end
-
+
describe 'with a scenario outline table' do
define_steps do
Given(/.*/) { }
@@ -246,7 +244,7 @@ def after_step(step)
it { expect(@doc.to_s).not_to match(/type="skipped"/)}
end
end
-
+
end
end
end
diff --git a/spec/cucumber/formatter/spec_helper.rb b/spec/cucumber/formatter/spec_helper.rb
index 6c3b437e40..fb39fa148e 100644
--- a/spec/cucumber/formatter/spec_helper.rb
+++ b/spec/cucumber/formatter/spec_helper.rb
@@ -69,7 +69,7 @@ def event_bus
def define_steps
return unless step_defs = self.class.step_defs
- rb = runtime.support_code.ruby
+ runtime.support_code.ruby
dsl = Object.new
dsl.extend RbSupport::RbDsl
dsl.instance_exec &step_defs
diff --git a/spec/cucumber/rb_support/rb_step_definition_spec.rb b/spec/cucumber/rb_support/rb_step_definition_spec.rb
index 7e043ac5ac..883053c327 100644
--- a/spec/cucumber/rb_support/rb_step_definition_spec.rb
+++ b/spec/cucumber/rb_support/rb_step_definition_spec.rb
@@ -42,7 +42,6 @@ def step_match(text)
it 'allows calling of other steps with inline arg' do
dsl.Given(/Outside/) do
- location = Core::Ast::Location.new(__FILE__, __LINE__)
step 'Inside', table([['inside']])
end
dsl.Given(/Inside/) do |t|
diff --git a/spec/cucumber/step_match_search_spec.rb b/spec/cucumber/step_match_search_spec.rb
index 29ee10014f..31f87ceae5 100644
--- a/spec/cucumber/step_match_search_spec.rb
+++ b/spec/cucumber/step_match_search_spec.rb
@@ -89,22 +89,22 @@ module Cucumber
end
it 'picks right step definition when an equal number of capture groups' do
- right = dsl.Given(/Three (.*) mice/) {|disability|}
- wrong = dsl.Given(/Three (.*)/) {|animal|}
+ right = dsl.Given(/Three (.*) mice/) {|disability|}
+ _wrong = dsl.Given(/Three (.*)/) {|animal|}
expect(search.call('Three blind mice').first.step_definition).to eq right
end
it 'picks right step definition when an unequal number of capture groups' do
- right = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
- wrong = dsl.Given(/Three (.*)/) {|animal|}
+ right = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
+ _wrong = dsl.Given(/Three (.*)/) {|animal|}
expect(search.call('Three blind mice ran far').first.step_definition).to eq right
end
it 'picks most specific step definition when an unequal number of capture groups' do
- general = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
- specific = dsl.Given(/Three blind mice ran far/) do; end
+ _general = dsl.Given(/Three (.*) mice ran (.*)/) {|disability|}
+ _specific = dsl.Given(/Three blind mice ran far/) do; end
more_specific = dsl.Given(/^Three blind mice ran far$/) do; end
expect(search.call('Three blind mice ran far').first.step_definition).to eq more_specific
@@ -120,4 +120,3 @@ module Cucumber
end
end
end
-