Sha256: 7334e33117bf70120316f76735e2dc3b437cefa47cc2544d601330bc2e6b1d82

Contents?: true

Size: 1.16 KB

Versions: 26

Compression:

Stored size: 1.16 KB

Contents

require "spec_helper"

describe NotifyUser::NotificationMailer do
  describe "notification_email" do

    let(:user) { User.new({email: "user@example.com" })}
    let(:notification) { NewPostNotification.new({target: user}) }
    let(:mailer) { NotifyUser::NotificationMailer.send(:new, 'notification_email', notification, ActionMailerChannel.default_options) }
    let(:mail) { mailer.notification_email(notification, ActionMailerChannel.default_options) }

    before :each do
      NotifyUser::BaseNotification.stub(:find).and_return(notification)
    end

    it "renders the headers" do
      mail.subject.should eq(ActionMailerChannel.default_options[:subject])
      mail.to.should eq([user.email])
      mail.from.should eq([NotifyUser.mailer_sender])
    end

    it "renders a template to render the notification's template as a partial" do
      mailer_should_render_template(mailer, "notify_user/action_mailer/notification")
      mail
    end

    it "renders with a layout" do
      NotifyUser::NotificationMailer.any_instance.stub(:notification).and_return(notification)
      mail.body.raw_source.should include "This is the default generated layout"
    end

  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
notify_user-0.1.4 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.1.3 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.1.2 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.1.1 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.30 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.29 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.28 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.27 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.26 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.25 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.24 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.23 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.22 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.20 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.19 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.18 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.16 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.15 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.14 spec/mailers/notify_user/notification_mailer_spec.rb
notify_user-0.0.12 spec/mailers/notify_user/notification_mailer_spec.rb