changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/failing_examples/mocking_with_flexmock.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
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.
4
5# To run it, stand in this directory and say:
6#
7# RUN_FLEXMOCK_EXAMPLE=true ruby ../bin/spec mocking_with_flexmock.rb
8
9if ENV['RUN_FLEXMOCK_EXAMPLE']
10 Spec::Runner.configure do |config|
11 config.mock_with :flexmock
12 end
13
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
20
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
26end