Sha256: 997a22e9e1f2b4e1f3b04cd8073334c1e38051383fe81058424e29ddfed974a6

Contents?: true

Size: 1.2 KB

Versions: 35

Compression:

Stored size: 1.2 KB

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")

# Move this to your spec_helper.rb.
module MailControllerTestHelper
  # Helper to clear mail deliveries.
  def clear_mail_deliveries
    Merb::Mailer.deliveries.clear
  end

  # Helper to access last delivered mail.
  # In test mode merb-mailer puts email to
  # collection accessible as Merb::Mailer.deliveries.
  def last_delivered_mail
    Merb::Mailer.deliveries.last
  end

  # Helper to deliver
  def deliver(action, mail_params = {}, send_params = {})
    <%= class_name %>Mailer.dispatch_and_deliver(action, { :from => "no-reply@webapp.com", :to => "recepient@person.com" }.merge(mail_params), send_params)
    @delivery = last_delivered_mail
  end
end

describe <%= class_name %>Mailer, "#notify_on_event email template" do
  include MailControllerTestHelper
  
  before :each do
    clear_mail_deliveries
    
    # instantiate some fixture objects
  end
    
  it "includes welcome phrase in email text" do
    violated "Mailer controller deserves to have specs, too."
    
    # <%= class_name %>Mailer.dispatch_and_deliver(:notify_on_event, {}, { :name => "merb-mailer user" })
    # last_delivered_mail.text.should =~ /Hello, merb-mailer user!/
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
merb-mailer-1.1.3 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.1.2 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.1.1 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.1.0 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.1.0.rc1 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.1.0.pre lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.0.15 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.0.14 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.0.13 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.0.12 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.10 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.12 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.9 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.11 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.5 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.4 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.7 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.8 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-1.0.1 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb
merb-mailer-0.9.13 lib/generators/templates/mailer/spec/mailers/%file_name%_mailer_spec.rb