Skip to content

Commit

Permalink
fix regression with multiple calls to ordered expectations, fixes rsp…
Browse files Browse the repository at this point in the history
…ec/rspec-core
  • Loading branch information
JonRowe committed Oct 24, 2013
1 parent 87a7e24 commit 1c29ed5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/mocks/order_group.rb
Expand Up @@ -35,7 +35,7 @@ def consume

# @private
def handle_order_constraint(expectation)
return unless expectation.ordered? && @expectations.include?(expectation)
return unless expectation.ordered? && remaining_expectations.include?(expectation)
return consume if ready_for?(expectation)
expectation.raise_out_of_order_error
end
Expand Down
11 changes: 11 additions & 0 deletions spec/rspec/mocks/mock_ordering_spec.rb
Expand Up @@ -16,6 +16,17 @@ module Mocks
@double.three
end

it "passes when messages are received in order" do
@double.stub(:something)
@double.should_receive(:one).ordered
@double.should_receive(:two).ordered
@double.should_receive(:three).at_least(:once).ordered
@double.one
@double.two
@double.three
@double.three
end

it "passes when messages are received in order across objects" do
a = double("a")
b = double("b")
Expand Down

0 comments on commit 1c29ed5

Please sign in to comment.