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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Pollock
  • Date: 2009-04-13 17:12:47 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (3.1.3 squeeze) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090413171247-61zlnwi5esw1lhtv
ImportĀ upstreamĀ versionĀ 0.24.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require File.dirname(__FILE__) + '/spec_helper'
2
 
 
3
 
class MockableClass
4
 
  def self.find id
5
 
    return :original_return
6
 
  end
7
 
end
8
 
 
9
 
describe "A partial mock" do
10
 
 
11
 
  it "should work at the class level (but fail here due to the type mismatch)" do
12
 
    MockableClass.should_receive(:find).with(1).and_return {:stub_return}
13
 
    MockableClass.find("1").should equal(:stub_return)
14
 
  end
15
 
 
16
 
  it "should revert to the original after each spec" do
17
 
    MockableClass.find(1).should equal(:original_return)
18
 
  end
19
 
 
20
 
end