Permalink
Browse files

Fixing shared_steps

  • Loading branch information...
nyarly committed Feb 24, 2014
1 parent c591dba commit 52a5c99f95642b0a49d74f3fb13a92ebac5c2bf7
Showing with 28 additions and 1 deletion.
  1. +1 −0 .ruby-version
  2. +6 −1 lib/rspec-steps/stepwise.rb
  3. +21 −0 spec/example_group_spec.rb
View
@@ -0,0 +1 @@
2.0
@@ -161,7 +161,12 @@ def run_after_step(example)
end
def perform_steps(name, *args, &customization_block)
shared_block = world.shared_example_groups[name]
shared_block = nil
if world.respond_to? :shared_example_groups
shared_block = world.shared_example_groups[name]
else
shared_block = shared_example_groups[name]
end
raise "Could not find shared example group named #{name.inspect}" unless shared_block
module_eval_with_args(*args, &shared_block)
View
@@ -29,6 +29,27 @@
end
end
it "should work with shared_steps/perform steps" do
group = nil
sandboxed do
group = steps "Test Steps" do
shared_steps "add one" do
it("adds one to @a"){ @a += 1 }
end
it("sets @a"){ @a = 1 }
perform_steps "add one"
perform_steps "add one"
perform_steps "add one"
it("reads @a"){ @a.should == 4 }
end
group.run
end
group.examples.each do |example|
example.metadata[:execution_result][:status].should == 'passed'
end
end
it "should run each_step hooks" do
group = nil
afters = []

0 comments on commit 52a5c99

Please sign in to comment.