Sha256: d984b7279f48f343df0ca0852e5f1a0ae7a8d9d33075b4de52a447c388742418

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

# FakeSmith

FakeSmith is here to help you unit test your Smith Agents.

Have you ever wanted to test your agents without having to worry about all the overhead of running the agency and sending messages and waiting asynchronously for the magic to happen? Well want no longer and do now!

FakeSmith is a gem that you can require and it will stub out all the stuff Smith does when you try to run agents, send messages and subscribe to queues.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'fake_smith'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install fake_smith

## Usage

In your spec_helper or in your spec simply:

```ruby
require 'fake_smith'
```

This will stub out all smith methods so you are free to test your agents without even enabling EventMachine (though you may need to if you agent depends on eventmachine stuff)

To start your agent:

```ruby
MySmithAgent.new.run
```

You may wish to send a message to your agent:

```ruby
my_receiver = double(:receiver, :ack => true)
expect(my_receiver).to receive(:ack)
FakeSmith.send_message("my_queue", MyAwesomeMessage.new(:id => "foo"), my_receiver)
```

Or see a message that your agent has put on a queue:

```ruby
messages = FakeSmith.get_messsages("my_other_queue")
expect(messages.count).to eq(1)
```

## Contributing

1. Fork it ( https://github.com/[my-github-username]/fake_smith/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_smith-0.0.2 README.md