1require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3class LiarLiarPantsOnFire
4 def respond_to?(sym)
5 true
6 end
7
8 def self.respond_to?(sym)
9 true
10 end
11end
12
13describe 'should_receive' do
14 before(:each) do
15 @liar = LiarLiarPantsOnFire.new
16 end
17
18 it "should work when object lies about responding to a method" do
19 @liar.should_receive(:something)
20 @liar.something
21 end
22
23 it 'should work when class lies about responding to a method' do
24 LiarLiarPantsOnFire.should_receive(:something)
25 LiarLiarPantsOnFire.something
26 end
27
28 it 'should cleanup after itself' do
29 LiarLiarPantsOnFire.metaclass.instance_methods.should_not include("something")
30 end
31end