README.md in stuffed_bunny-1.0.1 vs README.md in stuffed_bunny-1.0.2
- old
+ new
@@ -1,69 +1,57 @@
# StuffedBunny
-Provides stubbing of the Bunny gem.
+Provides stubbing of the Bunny gem to faciliate testing.
-To faciliate testing, exchanges are represented as a class-level hash. This
-allows all bunny instances access to the same exchanges.
+A `routed_messages` array captures any publised messages on a topic exchange.
-## Installation
+## Example Usage
-Add this line to your application's Gemfile:
-
- gem 'stuffed_bunny'
-
-And then execute:
-
- $ bundle
-
-Or install it yourself as:
-
- $ gem install stuffed_bunny
-
-## Usage
-
-### RSpec Example
-
```ruby
-# spec/spec_helper.rb
-require 'stuffed_bunny'
+require 'stuffed_bunny' # Bunny is overriden once this is required
-RSpec.configure do |config|
+class SomeTest < TestUnit::TestCase
- config.after(:each) do
- StuffedBunny.reset!
+ def setup
+ @bunny = Bunny::Client.new
end
-end
-```
+ def teardown
+ StuffedBunny.reset! # resets the routed_messages
+ end
-### Minitest Example
+ def test_that_a_message_is_published_to_an_exchange
+ exchange_options = { } # set it to be a topic exchange, etc.
+ Bunny.run do |b|
+ topic_exchange = b.exchange( "a_topic_exchange", exchange_options)
+ publish_options = { :key => "a.routing.key" }
+ topic_exchange.publish("a message", publish_options)
+ end
-```ruby
-require 'stuffed_bunny'
-
-class MiniTest::Spec
-
- after :each do
- StuffedBunny.reset!
+ routed_message = @bunny.exchanges["a_topic_exchange"].routed_messages[0]
+ assert_equal "a.routing.key", routed_message.key
+ assert_equal "a message", routed_message.message
end
end
```
-### TestUnit Example
+## Installation
-```ruby
-require 'stuffed_bunny'
+Add this line to your application's Gemfile:
-class SomeTest < TestUnit::TestCase
+ group :test do
+ # Note that as soon as the gem is required, Bunny is overridden.
+ gem 'stuffed_bunny', :require => false
+ end
- def teardown
- StuffedBunny.reset!
- end
+And then execute:
-end
-```
+ $ bundle
+
+Or install it yourself as:
+
+ $ gem install stuffed_bunny
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)