CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Fri, 29 Aug 2025 20:25:37 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100727165915
location: https://web.archive.org/web/20100727165915/https://github.com/rspec/rspec-mocks
server-timing: captures_list;dur=1.069197, exclusion.robots;dur=0.040106, exclusion.robots.policy;dur=0.018345, esindex;dur=0.027219, cdx.remote;dur=16.502326, LoadShardBlock;dur=313.940516, PetaboxLoader3.resolve;dur=175.962264, PetaboxLoader3.datanode;dur=52.119037
x-app-server: wwwb-app217
x-ts: 302
x-tr: 376
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app217; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Fri, 29 Aug 2025 20:25:38 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Tue, 27 Jul 2010 16:59:15 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "4078d976f58e373109e8c675a7493f0e"
x-archive-orig-x-runtime: 79ms
x-archive-orig-content-length: 35143
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Tue, 27 Jul 2010 16:59:15 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Tue, 09 Mar 2010 03:43:57 GMT", ; rel="prev memento"; datetime="Mon, 26 Jul 2010 10:33:00 GMT", ; rel="memento"; datetime="Tue, 27 Jul 2010 16:59:15 GMT", ; rel="next memento"; datetime="Fri, 12 Aug 2011 21:25:28 GMT", ; rel="last memento"; datetime="Sat, 09 Aug 2025 23:44:57 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_17_20100727160954_crawl100-c/52_17_20100727165841_crawl101.arc.gz
server-timing: captures_list;dur=0.841569, exclusion.robots;dur=0.032457, exclusion.robots.policy;dur=0.013178, esindex;dur=0.020077, cdx.remote;dur=33.596620, LoadShardBlock;dur=79.003196, PetaboxLoader3.datanode;dur=199.185591, load_resource;dur=273.576543, PetaboxLoader3.resolve;dur=133.712173
x-app-server: wwwb-app217
x-ts: 200
x-tr: 578
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
rspec's rspec-mocks at master - GitHub
rspec / rspec-mocks
- Source
- Commits
- Network (9)
- Issues (1)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Switch Branches (2)
- master ✓
- refactor
-
Switch Tags (30)
- v2.0.0.beta.19
- v2.0.0.beta.18
- v2.0.0.beta.17
- v2.0.0.beta.16
- v2.0.0.beta.15
- v2.0.0.beta.14
- v2.0.0.beta.13
- v2.0.0.beta.12
- v2.0.0.beta.11
- v2.0.0.beta.10
- v2.0.0.beta.9
- v2.0.0.beta.8
- v2.0.0.beta.7
- v2.0.0.beta.6
- v2.0.0.beta.5
- v2.0.0.beta.4
- v2.0.0.beta.3
- v2.0.0.beta.2
- v2.0.0.beta.1
- v2.0.0.a10
- v2.0.0.a9
- v2.0.0.a8
- v2.0.0.a7
- v2.0.0.a6
- v2.0.0.a5
- v2.0.0.a4
- v2.0.0.a1
- v0.0.0
- 2.0.0.a3
- 2.0.0.a2
- Branch List
README.markdown
RSpec Mocks
rspec-mocks provides a test-double framework for rspec including support for method stubs, fakes, and message expectations.
Install
gem install rspec --prerelease
This will install rspec, rspec-core, rspec-expectations and rspec-mocks.
Method Stubs
describe "consumer" do
it "gets stuff from a service" do
service = double('service')
service.stub(:find) { 'value' }
consumer = Consumer.new(service)
consumer.consume
consumer.aquired_stuff.should eq(['value'])
end
end
Message Expectations
describe "some action" do
context "when bad stuff happens" do
it "logs the error" do
logger = double('logger')
doer = Doer.new(logger)
logger.should_receive(:log).with('oops')
doer.do_something_with(:bad_data)
end
end
end
Contribute
See https://github.com/rspec/rspec-dev