Sha256: 2bff6620ed89754e9a61062d4c321463f2a6fcd13deb2ef9623728a2bfb95b20

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 Bytes

Contents

require 'spec_helper'

module Rspec
  module Mocks
    describe "Example with stubbed and then called message" do
      it "fails if the message is expected and then subsequently not called again" do
        double = double("mock", :msg => nil)
        double.msg
        double.should_receive(:msg)
        lambda { double.rspec_verify }.should raise_error(Rspec::Mocks::MockExpectationError)
      end

      it "outputs arguments of all similar calls" do
        double = double('double', :foo => true)
        double.should_receive(:foo).with('first')
        double.foo('second')
        double.foo('third')
        lambda do
          double.rspec_verify
        end.should raise_error(%Q|Double "double" received :foo with unexpected arguments\n  expected: ("first")\n       got: ("second"), ("third")|)
        double.rspec_reset
      end
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-mocks-2.0.0.beta.8 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.7 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.6 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.5 spec/rspec/mocks/stubbed_message_expectations_spec.rb