Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ruby versions #208

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
rvm:
- 2.1.9
- 2.2.4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may make sense to remove these EOL versions too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it does. I just wasn't sure if we wanted to leave those in for now, and was planning to make another PR to take them out once we'd established that the newer versions of ruby worked.

I need to make an update to the README as well, once we know these are working.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readme is updated.

Do you think we should remove the old versions of ruby now, or leave them in place for a bit in case there are any bugs we're not aware of?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

No idea about removing the EOL versions. Maybe a project maintainer will give good advice in respect to this 😉

- 2.3.1
- 2.3.7
- 2.4.4
- 2.5.1
- jruby-9.1.2.0

cache: bundler
Expand Down
8 changes: 4 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Conceived as an alternative to Cucumber, here are some of its design goals:
* Step reusability: In case you want to reuse steps across features, you can
always wrap those in plain ol' Ruby modules.

Spinach is tested against **2.0, 2.1, 2.2 and 2.3** as well as **JRuby 9000**.
Spinach is tested against **2.1, 2.2, 2.3, 2.4 and 2.5** as well as **JRuby 9000**.

## Getting started

Expand Down Expand Up @@ -184,7 +184,7 @@ end
## Audit

Over time, the definitions of your features will change. When you add, remove
or change steps in the feature files, you can easily audit your existing step
or change steps in the feature files, you can easily audit your existing step
files with:

```shell
Expand All @@ -198,8 +198,8 @@ This does not modify the step files, so you will need to paste the boilerplate
into the appropriate places. If a new feature file is detected, you will be
asked to run `spinach --generate` beforehand.

**Important**: If auditing individual files, common steps (as above) may be
reported as unused when they are actually used in a feature file that is not
**Important**: If auditing individual files, common steps (as above) may be
reported as unused when they are actually used in a feature file that is not
currently being audited. To avoid this, run the audit with no arguments to
audit all step files simultaneously.

Expand Down
16 changes: 8 additions & 8 deletions lib/spinach/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Config
#
# @api public
def features_path
@features_path || 'features'
@features_path ||= 'features'
end

# The "reporter classes" holds an array of reporter class name
Expand All @@ -58,14 +58,14 @@ def features_path
#
# @api public
def reporter_classes
@reporter_classes || ["Spinach::Reporter::Stdout"]
@reporter_classes ||= ["Spinach::Reporter::Stdout"]
end

# The "reporter_options" holds the options passed to reporter_classes
#
# @api public
def reporter_options
@reporter_options || {}
@reporter_options ||= {}
end

# The "orderer class" holds the orderer class name
Expand All @@ -76,7 +76,7 @@ def reporter_options
#
# @api public
def orderer_class
@orderer_class || "Spinach::Orderers::Default"
@orderer_class ||= "Spinach::Orderers::Default"
end

# A randomization seed. This is what spinach uses for test run
Expand All @@ -99,7 +99,7 @@ def seed
#
# @api public
def step_definitions_path
@step_definitions_path || "#{self.features_path}/steps"
@step_definitions_path ||= "#{self.features_path}/steps"
end

# The "support path" helds the place where you can put your configuration
Expand All @@ -110,11 +110,11 @@ def step_definitions_path
#
# @api public
def support_path
@support_path || "#{self.features_path}/support"
@support_path ||= "#{self.features_path}/support"
end

def generate
@generate || false
@generate ||= false
end

# Allows you to read the config object using a hash-like syntax.
Expand Down Expand Up @@ -166,7 +166,7 @@ def failure_exceptions
#
# @api public
def fail_fast
@fail_fast
@fail_fast ||= false
end

# "audit" enables step auditing mode
Expand Down
14 changes: 6 additions & 8 deletions lib/spinach/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def step(step, &block)
alias_method :Then, :step
alias_method :And, :step
alias_method :But, :step

# Defines a before hook for each scenario. The scope is limited only to the current
# step class (thus the current feature).
# step class (thus the current feature).
#
# When a scenario is executed, the before each block will be run first before any steps
#
Expand Down Expand Up @@ -98,7 +98,7 @@ def before(&block)
end

# Defines a after hook for each scenario. The scope is limited only to the current
# step class (thus the current feature).
# step class (thus the current feature).
#
# When a scenario is executed, the after each block will be run after any steps
#
Expand Down Expand Up @@ -151,10 +151,8 @@ def steps
private

def before_or_after_private_method_name(location)
hash_value = hash
class_name = self.name || ""
class_name = class_name.gsub("::", "__").downcase
private_method_name = "_#{location}_each_block_#{hash.abs}_#{class_name}" #uniqueness
class_name = self.name.to_s.gsub("::", "__").downcase
return "_#{location}_each_block_#{hash.abs}_#{class_name}" #uniqueness
end

def define_before_or_after_method_with_block(location, &block)
Expand Down Expand Up @@ -193,7 +191,7 @@ def execute(step)
# The file and line where the step was defined.
def step_location_for(step)
underscored_step = Spinach::Support.underscore(step)
location = method(underscored_step).source_location if self.respond_to?(underscored_step)
method(underscored_step).source_location if self.respond_to?(underscored_step)
end

# @return [String]
Expand Down
4 changes: 2 additions & 2 deletions lib/spinach/hookable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def hook(hook)
end
end

# Adds a new around_hook to this class. Every hook defines two methods
# Adds a new around_hook to this class. Every hook defines two methods
# used to add new callbacks and to run them around a given block of code
# passing a bunch of parameters and invoking them in the order they were
# defined.
Expand Down Expand Up @@ -77,7 +77,7 @@ def run_around_hook(name, *args, &block)
if callbacks = hooks[name.to_sym]
callbacks.reverse.inject(block) do |blk, callback|
proc do
callback.call *args do
callback.call(*args) do
blk.call
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/spinach/support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def self.underscore(camel_cased_word)
word = camel_cased_word.to_s.dup
word.gsub!(/::/, '/')
word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
word.gsub!(/([a-z\\d])([A-Z])/,'\1_\2')
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
word.tr!("-", "_")
word.tr!(" ", "_")
word.downcase!
Expand Down
2 changes: 1 addition & 1 deletion test/spinach/generators/step_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Spinach::Generators

describe "#generate" do
it "generates a step" do
subject.generate.must_match /step.*I has a sad/
subject.generate.must_match(/step.*I has a sad/)
end

it "generates a pending step" do
Expand Down
2 changes: 1 addition & 1 deletion test/spinach/orderers/random_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
it 'appends the seed' do
orderer.attach_summary(io)

io.string.must_match /Randomized\ with\ seed\ #{orderer.seed}/
io.string.must_match(/Randomized\ with\ seed\ #{orderer.seed}/)
end
end

Expand Down
5 changes: 1 addition & 4 deletions test/spinach/runner/feature_runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@

describe 'when all the steps exist' do
before do
@scenarios = [
scenario = stub(tags: []),
another_scenario = stub(tags: [])
]
@scenarios = [stub(tags: []), stub(tags: []) ]
@feature = stub('feature',
name: "Feature",
tags: [],
Expand Down
4 changes: 2 additions & 2 deletions test/spinach/runner/scenario_runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Runner
e = proc do
subject.run
end.must_raise Spinach::HookNotYieldException
e.hook.must_match /around_scenario/
e.hook.must_match(/around_scenario/)
end

it 'raises if around_step hook does not yield' do
Expand All @@ -122,7 +122,7 @@ class Runner
e = proc do
subject.run
end.must_raise Spinach::HookNotYieldException
e.hook.must_match /around_step/
e.hook.must_match(/around_step/)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions test/spinach/support_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
it 'changes spaces to underscores' do
Spinach::Support.underscore('feature name').must_equal 'feature_name'
end

it 'knows how to handle digits' do
Spinach::Support.underscore('Feature1Name').must_equal 'feature1_name'
end
end

describe "#escape" do
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

require 'minitest/autorun'
require 'minitest/spec'
require 'mocha/mini_test'
require 'mocha/minitest'
require 'ostruct'
require 'stringio'
require 'pry'
Expand Down