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:
parent
9c672e65e4
commit
9aceebfe53
9
spec/factories/contacts.rb
Normal file
9
spec/factories/contacts.rb
Normal 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
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user