changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/failing_examples/partial_mock_example.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
1require File.dirname(__FILE__) + '/spec_helper'
2
3class MockableClass
4 def self.find id
5 return :original_return
6 end
7end
8
9describe "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
20end