Readme.md in mailstro-0.0.6 vs Readme.md in mailstro-0.0.7

- old
+ new

@@ -28,24 +28,59 @@ end ``` ## Usage -To send a 'welcome' email use the following: +Sending a basic email. ```ruby -Mailstro.deliver(:welcome, "shanon@mailstroapp.com", :greeting => "Hi") +Mailstro.deliver( + :to => 'shanon@mailstroapp.com', + :template_name => :welcome, + :template_data => { + :coupon_code => 'THANKS01' + } +) ``` -To send a 'thank_you' email to a list of 'customers' use the following: +Sending an email to a list of users, with subscription management. ```ruby -Mailstro.list_subscribe(:customers, 'jack@mailstroapp.com') -Mailstro.list_subscribe(:customers, 'fred@mailstroapp.com') -Mailstro.list_unsubscribe(:customers, 'jack@mailstroapp.com') +Mailstro.subscribe('jack@mailstroapp.com', :build_watchers, project_id) -Mailstro.list_deliver(:customers, :welcome, :greeting => "Hi") +Mailstro.deliver( + :to => [:build_watchers, project_id] + :template_name => :build_failure, + :template_data => { + :commit => '575ca555c23eca098202' + } +) + +Mailstro.unsubscribe('jack@mailstroapp.com', :build_watchers, project_id) ``` + +## RSpec Test Mode + +Require the mailstro spec helper to automatically enable test mode. + +```ruby +require 'mailsto/rspec' +``` + +Verify emails are being sent with simple matchers. + +```ruby +Mailstro.deliver( + :to => 'shanon@mailstroapp.com', + :template_name => :welcome, +) + +Mailstro.should have_delivered(:welcome) + +Mailstro.should have_subscribed('a@a.com', :watchers, 2) +Mailstro.should have_unsubscribed('a@a.com', :watchers, 2) +``` + ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)