Sha256: 3e7b16f1d04f49f77103c02d645aa9b0357c7d278bd39997703832960ba02cfc

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

require 'spec_helper'

describe Maily::Email do
  let(:mailer) { Maily::Mailer.find('notifier') }

  context "with no arguments" do
    it "should not require hook" do
      email  = mailer.find_email('welcome')

      email.required_arguments.should be_blank
      email.require_hook?.should be_false
    end
  end

  context "with arguments" do
    let (:email) { mailer.find_email('invitation') }

    it "should require hook" do
      email.required_arguments.should be_present
      email.require_hook?.should be_true
    end

    it "should handle arguments successfully" do
      email.arguments.size.should == 1
      expect { email.call }.to_not raise_error
    end
  end

  it "should handle template_path via hook" do
    email = mailer.find_email('recommendation')
    email.template_path.should == 'notifications'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maily-0.3.1 spec/email_spec.rb