Sha256: c52dc633468c1af8f711d2fdb261ceb0500495d5e54a55113210e3268534049f

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

require 'spec_helper'

module Alchemy
  describe Message do
    let(:message) { Message.new }

    describe '.config' do
      it "should return the mailer config" do
        Config.should_receive(:get).with(:mailer)
        Message.config
      end
    end

    it "has attributes writers and getters for all fields defined in mailer config" do
      Config.get(:mailer)['fields'].each do |field|
        expect(message).to respond_to(field)
        expect(message).to respond_to("#{field}=")
      end
    end

    it "validates attributes defined in mailer config" do
      Config.get(:mailer)['validate_fields'].each do |field|
        expect(message).to have(1).error_on(field)
      end
    end

    it "validates email format" do
      message.email = 'wrong email format'
      expect(message.errors_on(:email)).to include("is invalid")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alchemy_cms-3.0.0.rc5 spec/models/message_spec.rb