Skip to content

Commit

Permalink
Update to README, file structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
nyarly committed Sep 18, 2015
1 parent 43dea29 commit 31a46d3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
10 changes: 5 additions & 5 deletions doc/README
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ absolutely need to make sure you have transactional fixtures off. Otherwise,
you'll experience problems where the tests and the application appear to see
completely different databases.

While Steps 2.0 retains it's shift in lifecycle hooks (:each become :all,
there's a :step hook), this shift *no longer* applies to config.before _et al_
-- you'll need to use config.before :each to run around each step. This is the
primary change to the Steps interface that called for a major version bump.

## Advanced stuff: shared steps

If you have (for example) two user stories that share the same first N steps but then
Expand Down Expand Up @@ -113,11 +118,6 @@ diverge, you can DRY your code out with shared_steps blocks, like so:
The goal is to try to be compatible with as many versions
of RSpec 3.x as possible.

As of version 2.0, we've reverted to the expected behavior of before :all and
before :each. Older versions used a new lifecycle mode called :step, which is
now removed. If you used `rspec-steps` before and wrote `before :step`
anywhere, change it to `before :each` and all will be well.

We make good use of Travis to check compatibility, however. You can check what
versions of RSpec and Ruby RSpec-Steps works with here:
https://travis-ci.org/LRDesign/rspec-steps
20 changes: 1 addition & 19 deletions lib/rspec-steps/describer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,10 @@
require 'rspec-steps/step'
require 'rspec-steps/hook'
require 'rspec-steps/step-list'
require 'rspec-steps/lets'

module RSpec::Steps

class Let < Struct.new(:name, :block)
def define_on(step_list, group)
name = self.name
step_list.add_let(name, block)

group.let(name) do
step_list.let_memo(name, self)
end
end
end

class LetBang < Let
def define_on(step_list, group)
super

step_list.add_let_bang(name)
end
end

class Describer
def initialize(args, metadata, &block)
@group_args = args
Expand Down
20 changes: 20 additions & 0 deletions lib/rspec-steps/lets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module RSpec::Steps
class Let < Struct.new(:name, :block)
def define_on(step_list, group)
name = self.name
step_list.add_let(name, block)

group.let(name) do
step_list.let_memo(name, self)
end
end
end

class LetBang < Let
def define_on(step_list, group)
super

step_list.add_let_bang(name)
end
end
end

0 comments on commit 31a46d3

Please sign in to comment.