Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / failing_examples / mocking_with_flexmock.rb
blob6e79ece0ee40f3b57744da3eab0c349fab8611be
1 # stub frameworks like to gum up Object, so this is deliberately
2 # set NOT to run so that you don't accidentally run it when you
3 # run this dir.
5 # To run it, stand in this directory and say:
7 #   RUN_FLEXMOCK_EXAMPLE=true ruby ../bin/spec mocking_with_flexmock.rb
9 if ENV['RUN_FLEXMOCK_EXAMPLE']
10   Spec::Runner.configure do |config|
11     config.mock_with :flexmock
12   end
14   describe "Flexmocks" do
15     it "should fail when the expected message is received with wrong arguments" do
16       m = flexmock("now flex!")
17       m.should_receive(:msg).with("arg").once
18       m.msg("other arg")
19     end
21     it "should fail when the expected message is not received at all" do
22       m = flexmock("now flex!")
23       m.should_receive(:msg).with("arg").once
24     end
25   end
26 end