Skip to content

Commit

Permalink
words
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jul 7, 2010
1 parent 5092fd3 commit f26af00
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions README.markdown
Expand Up @@ -3,22 +3,43 @@
rspec-mocks provides a test-double framework for rspec including support rspec-mocks provides a test-double framework for rspec including support
for method stubs, fakes, and message expectations. for method stubs, fakes, and message expectations.


rspec-mocks is currently in alpha release. While you are welcome to
track, fork, explore, etc, we're too early in the process to start fielding
pull requests and or issues from outside the core development team, so please
don't waste your time until this notice changes.

## Install ## Install


[sudo] gem install rspec --prerelease gem install rspec --prerelease


This will install rspec, rspec-core, rspec-expectations and rspec-mocks. 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


#### Also see ## Contribute

See [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)

## Also see


* [http://github.com/rspec/rspec](http://github.com/rspec/rspec) * [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
* [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core) * [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
* [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations) * [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)
* [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)

0 comments on commit f26af00

Please sign in to comment.