Sha256: 03a0875453a1a23061b7ba723a4e28a112b79b47890a4c1c8e44db34bf414d22

Contents?: true

Size: 838 Bytes

Versions: 32

Compression:

Stored size: 838 Bytes

Contents

require 'spec_helper'

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" received :foo with unexpected arguments\n  expected: ("first")\n       got: (["second"], ["third"])|)
        m.rspec_reset
      end
    end
    
  end
end

Version data entries

32 entries across 32 versions & 11 rubygems

Version Path
rspec-instructure-1.3.3 spec/spec/mocks/stubbed_message_expectations_spec.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.3.2 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.3.1 spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.3.1.rc spec/spec/mocks/stubbed_message_expectations_spec.rb
rspec-1.3.0 spec/spec/mocks/stubbed_message_expectations_spec.rb
hubbub-0.0.11 lib/vendor/plugins/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
hubbub-0.0.10 lib/vendor/plugins/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
hubbub-0.0.9 lib/vendor/plugins/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
hubbub-0.0.8 lib/vendor/plugins/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
hubbub-0.0.6 lib/vendor/plugins/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
simple-templater-0.0.1.4 gems/gems/rspec-1.2.9/spec/spec/mocks/stubbed_message_expectations_spec.rb
media-path-0.1.2 vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
simple-templater-0.0.1.3 vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
pupu-0.0.2.pre vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
media-path-0.1.1.pre vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
simple-templater-0.0.1.2 vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
media-path-0.1.1 vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
simple-templater-0.0.1.1 vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb
pupu-0.0.2 vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb