Skip to content

Commit

Permalink
Add line info to Then
Browse files Browse the repository at this point in the history
This fixes the single test runner issue.
  • Loading branch information
jimweirich committed Sep 6, 2012
1 parent 8b63f3a commit 46dd2f1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/rspec/given/extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def _rg_check_invariants # :nodoc:
end
end
end

# Implement the run-time semantics of the Then clause.
def _rg_then(&block) # :nodoc:
_rg_establish_givens
_rg_check_invariants
instance_eval(&block)
end
end

module ClassExtensions
Expand Down Expand Up @@ -134,11 +141,10 @@ def When(*args, &block)
# Given and When blocks have been run. All invariants in scope
# will be checked before the Then block is run.
def Then(&block)
specify do
_rg_establish_givens
_rg_check_invariants
instance_eval(&block)
end
b = block.binding
file = eval "__FILE__", b
line = eval "__LINE__", b
eval %{specify do _rg_then(&block) end}, binding, file, line
end

# Establish an invariant that must be true for all Then blocks
Expand Down

0 comments on commit 46dd2f1

Please sign in to comment.