Skip to content

Commit

Permalink
Added some basic rules and an example for mailer spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsvetomila Mihaylova committed Oct 21, 2011
1 parent a7c23c4 commit 0710d2d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Expand Up @@ -839,6 +839,31 @@ There also can be one steps file for all features for a particular object (`arti

### Mailers

* The model in the mailer spec should be mocked. The mailer should not depend on the model creation.
* The mailer spec should verify that:
* the subject is correct
* the receiver e-mail is correct
* the e-mail is sent to the right e-mail address
* the e-mail contains the required information

```Ruby
describe SubscriberMailer
let(:subscriber) { mock_model(Subscription, email: 'johndoe@test.com', name: 'John Doe') }

describe 'successful registration email'
subject { SubscriptionMailer.successful_registration_email(subscriber) }

its(:subject) { should == 'Successful Registration!' }
its(:from) { should == ['info@your_site.com'] }
its(:to) { should == [subscriber.email] }

it 'contains the subscriber name' do
subject.body.encoded.should match(subscriber.name)
end
end
end
```

### Uploaders

* What we can test about an uploader is whether the images are resized correctly.
Expand Down

0 comments on commit 0710d2d

Please sign in to comment.