1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Add spec for email sending.

This commit is contained in:
Dan Barber 2013-06-05 22:18:50 +01:00
parent 9c672e65e4
commit 9aceebfe53
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :contact do
email "test@danbarberphoto.com"
name "Dan Barber"
message "This is a message."
end
end

View File

@ -7,4 +7,12 @@ describe Contact do
it { should allow_value("test@test.com").for(:email) }
it { should_not allow_value("test@test").for(:email) }
let(:contact) { build(:contact) }
it "should send an email" do
contact.save
expect(ActionMailer::Base.deliveries.last.from).to eql([contact.email])
expect(ActionMailer::Base.deliveries.last.to).to eql(['enquiries@danbarberphoto.com'])
end
end