Sha256: 777a0ec7662a7974129ad7856305edcbee8888818cc64074160c5b04b6cd0f15

Contents?: true

Size: 691 Bytes

Versions: 4

Compression:

Stored size: 691 Bytes

Contents

# encoding: utf-8
require File.expand_path("test/test_helper.rb")

THEME = 'pink'

class Notifier < ActionMailer::Base
  default :theme => THEME

  def welcome(user)
    mail(:theme => user.theme)
  end

  def thanks(user)
    mail
  end
end

module ThemesForRails
  class ActionMailerTest < ::ActionController::TestCase

    should "set theme using mail headers" do
      Notifier.any_instance.expects(:theme).with("purple")

      user = mock("User", :theme => "purple")
      Notifier.welcome(user)
    end

    should "set theme using mail default opts" do
      Notifier.any_instance.expects(:theme).with("pink")

      user = mock("User")
      Notifier.thanks(user)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
themes_for_rails4-1.5.1 test/lib/action_mailer_test.rb
themes_for_rails-0.5.1 test/lib/action_mailer_test.rb
themes_for_rails-0.5.0 test/lib/action_mailer_test.rb
themes_for_rails-0.5.0.pre test/lib/action_mailer_test.rb