]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/mocks/bug_report_15719_spec.rb
Show whether a trace is public or private in the trace list, so that a user can easil...
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / mocks / bug_report_15719_spec.rb
1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3 module Spec
4   module Mocks
5     describe "mock failure" do
6       
7       it "should tell you when it receives the right message with the wrong args" do
8         m = mock("foo")
9         m.should_receive(:bar).with("message")
10         lambda {
11           m.bar("different message")
12         }.should raise_error(Spec::Mocks::MockExpectationError, %Q{Mock 'foo' expected :bar with ("message") but received it with ("different message")})
13         m.bar("message") # allows the spec to pass
14       end
15
16       it "should tell you when it receives the right message with the wrong args if you stub the method" do
17         pending("fix bug 15719")
18         # NOTE - for whatever reason, if you use a the block style of pending here,
19         # rcov gets unhappy. Don't know why yet.
20         m = mock("foo")
21         m.stub!(:bar)
22         m.should_receive(:bar).with("message")
23         lambda {
24           m.bar("different message")
25         }.should raise_error(Spec::Mocks::MockExpectationError, %Q{Mock 'foo' expected :bar with ("message") but received it with ("different message")})
26         m.bar("message") # allows the spec to pass
27       end
28     end
29   end
30 end