Sha256: 9ed9d85b1cf38f85d0603f475869d6d882ced8091469d112a4d0aaa038e71067

Contents?: true

Size: 814 Bytes

Versions: 12

Compression:

Stored size: 814 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
        mock_obj = mock("mock", :msg => nil)
        mock_obj.msg
        mock_obj.should_receive(:msg)
        lambda { mock_obj.rspec_verify }.should raise_error(Rspec::Mocks::MockExpectationError)
      end

      it "outputs arguments of all similar calls" do
        m = mock('mock', :foo => true)
        m.should_receive(:foo).with('first')
        m.foo('second')
        m.foo('third')
        lambda do
          m.rspec_verify
        end.should raise_error(%q|Mock 'mock' expected :foo with ("first") but received it with (["second"], ["third"])|)
        m.rspec_reset
      end
    end
    
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rspec-mocks-2.0.0.beta.4 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.3 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.2 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.1 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a10 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a9 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a8 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a7 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a6 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a5 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a4 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.a3 spec/rspec/mocks/stubbed_message_expectations_spec.rb