Sha256: a2e85840fd7d3b71578cf99dadfd3f305f19eaef2a320c7dd6ce6dea9aa8c722

Contents?: true

Size: 967 Bytes

Versions: 4

Compression:

Stored size: 967 Bytes

Contents

require 'spec_helper'

describe MailyHerald do
  describe "setup" do
    before(:each) do
      @user = FactoryGirl.create :user
    end

    it "should extend context entity models" do
      MailyHerald.context(:all_users).model.name.should eq(User.name)
      User.included_modules.should include(MailyHerald::ModelExtensions)

      expect(@user).to respond_to(:maily_herald_subscriptions)
      expect(@user.maily_herald_subscriptions.length).to eq(0)
    end

    it "should create mailings from initializer" do
      mailing = MailyHerald.one_time_mailing(:test_mailing)
      expect(mailing).to be_kind_of(MailyHerald::Mailing)
      expect(mailing).not_to be_a_new_record
    end

    it "should create sequences from initializer" do
      sequence = MailyHerald.sequence(:newsletters)
      expect(sequence).to be_kind_of(MailyHerald::Sequence)
      expect(sequence).not_to be_a_new_record

      expect(sequence.mailings.length).to eq(3)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
maily_herald-0.9.4 spec/lib/maily_herald_spec.rb
maily_herald-0.9.3 spec/lib/maily_herald_spec.rb
maily_herald-0.9.2 spec/lib/maily_herald_spec.rb
maily_herald-0.9.1 spec/lib/maily_herald_spec.rb