~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/failing_examples/mocking_with_mocha.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_MOCHA_EXAMPLE=true ruby ../bin/spec mocking_with_mocha.rb
 
8
 
 
9
if ENV['RUN_MOCHA_EXAMPLE']
 
10
  Spec::Runner.configure do |config|
 
11
    config.mock_with :mocha
 
12
  end
 
13
  describe "Mocha framework" do
 
14
    it "should should be made available by saying config.mock_with :mocha" do
 
15
      m = mock()
 
16
      m.expects(:msg).with("arg")
 
17
      m.msg
 
18
    end
 
19
    it "should should be made available by saying config.mock_with :mocha" do
 
20
      o = Object.new
 
21
      o.expects(:msg).with("arg")
 
22
      o.msg
 
23
    end
 
24
  end
 
25
end