Sha256: f7c3fac91ebd30b1936e187c054fe6390e5983fe3cbb4873cc72ae1c057f08e9

Contents?: true

Size: 871 Bytes

Versions: 63

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

63 entries across 61 versions & 7 rubygems

Version Path
rspec-mocks-2.0.0.beta.11 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.10 spec/rspec/mocks/stubbed_message_expectations_spec.rb
rspec-mocks-2.0.0.beta.9 spec/rspec/mocks/stubbed_message_expectations_spec.rb