Sha256: 45b35abe2418271a69232fb8870f213916ad769a285bfae5cd4651009254d40e

Contents?: true

Size: 847 Bytes

Versions: 10

Compression:

Stored size: 847 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

module Spec
  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(Spec::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

10 entries across 10 versions & 2 rubygems

Version Path
dchelimsky-rspec-1.1.99.13 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.7 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.8 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.0 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.1 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.2 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.6 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.5 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.4 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.2.3 spec/spec/mocks/stubbed_message_expectations_spec.rb