Sha256: 2be04328ea45b6ed8e291f15e7da70dd2f5f0e913350224768d4b83cf290624a

Contents?: true

Size: 1.65 KB

Versions: 13

Compression:

Stored size: 1.65 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
 
describe "SendPasswordMailer" do
 
  before(:all) do
    Merb::Router.prepare { add_slice(:merb_auth_slice_password_reset)}
    User.auto_migrate!
  end
 
  after(:all) do
    Merb::Router.reset!
  end
 
  describe MerbAuthSliceMultisite::SendPasswordMailer do
 
    def deliver(action, mail_opts= {},opts = {})
      MerbAuthSliceMultisite::SendPasswordMailer.dispatch_and_deliver action, mail_opts, opts
      @last_delivered_mail = Merb::Mailer.deliveries.last
    end
 
    before(:each) do
      Merb::Mailer.deliveries.clear
      Site.all.destroy!
      User.all.destroy!
      @site = Site.create(valid_site_attributes)
      @user = @site.users.build(:email => "homer@simpsons.com", :login => "homer", :password => "donuts" )
      @mailer_params = { :from => "info@mysite.com", :to => @user.email, :subject => "Welcome to MySite.com" }
    end
    
    it "should send mail to homer@simpsons.com for the send password email" do
      deliver(:send_password, @mailer_params, :user => @user)
      @last_delivered_mail.assigns(:headers).should include("to: homer@simpsons.com")
    end
 
    it "should send the mail from 'info@mysite.com' for the the send password email" do
      deliver(:send_password, @mailer_params, :user => @user)
      @last_delivered_mail.assigns(:headers).should include("from: info@mysite.com")
    end
 
    it "should have the link to the subdomain site" do
      deliver(:send_password, @mailer_params, :user => @user)
      @last_delivered_mail.text.should include("http://#{@user.site.subdomain}.#{Merb::Slices::config[:merb_auth_slice_multisite][:domain] = "example.com"}")
    end
 
  end
 
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
scottmotte-merb_auth_slice_multisite-0.7.0 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.7.1 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.7.2 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.7.3 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.7.4 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.7.5 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.8.0 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.8.1 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.8.3 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.8.4 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.8.5 spec/mailers/send_password_mailer_spec.rb
scottmotte-merb_auth_slice_multisite-0.8.6 spec/mailers/send_password_mailer_spec.rb
merb_auth_slice_multisite-0.8.6 spec/mailers/send_password_mailer_spec.rb