Sha256: 44b810c0d30123f8706358a8fc6b67d30e2910be24beffb8d9dfe259e45faac1

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

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

  it "should load mailers" do
    expect(Maily::Mailer.all.keys).to eq(['application_mailer', 'notifier'])
  end

  it "should build emails" do
    expect(mailer.emails.size).to eq(7)
  end

  it "should find mailers by name" do
    expect(Maily::Mailer.find('notifier').name).to eq('notifier')
  end

  it "should find emails by name" do
    expect(mailer.find_email('welcome').name).to eq('welcome')
  end

  it "allow to add inherited emails via a hook" do
    expect(mailer.find_email('generic_welcome').name).to eq('generic_welcome')
  end

  it "allows to hide email" do
    expect(mailer.find_email('hidden')).to be nil
  end

  it ".list returns an array with all mailers" do
    list = Maily::Mailer.list

    expect(list).to be_an_instance_of(Array)
    expect(list.sample).to be_an_instance_of(Maily::Mailer)
  end

  it "#emails_list returns an array with all emails" do
    expect(mailer.emails_list).to be_an_instance_of(Array)
    expect(mailer.emails_list.sample).to be_an_instance_of(Maily::Email)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
maily-0.8.1 spec/mailer_spec.rb
maily-0.8.0 spec/mailer_spec.rb