-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix ability to send emails when filter_spam is set to false
- Loading branch information
Brice Sanchez
committed
Mar 29, 2016
1 parent
774c7cb
commit e93410d
Showing
4 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,22 +20,16 @@ module Inquiries | |
click_button "Send message" | ||
end | ||
|
||
it "sends confirmation email" do | ||
open_email("[email protected]") | ||
it_has_behaviour 'sends emails' | ||
|
||
expect(current_email.from).to eq(["#{Refinery::Inquiries.from_name}@example.com"]) | ||
expect(current_email.to).to eq(["[email protected]"]) | ||
expect(current_email.subject).to eq("Thank you for your inquiry") | ||
expect(current_email.body).to eq("Thank you for your inquiry Ugis Ozols,\n\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\n\nThanks.") | ||
end | ||
|
||
it "sends notification email" do | ||
open_email("[email protected]") | ||
describe "filter_spam" do | ||
context "when filter_spam setting is set to false" do | ||
before(:each) do | ||
allow(Refinery::Inquiries.config).to receive(:filter_spam).and_return(false) | ||
end | ||
|
||
expect(current_email.from).to eq(["#{Refinery::Inquiries.from_name}@example.com"]) | ||
expect(current_email.to).to eq(["[email protected]"]) | ||
expect(current_email.subject).to eq("New inquiry from your website") | ||
expect(current_email.body).to eq("Hi there,\n\nYou just received a new inquiry on your website.\n\n--- inquiry starts ---\n\nFrom: Ugis Ozols\nEmail: [email protected]\nPhone: \nMessage:\nHey, I'm testing!\n\n--- inquiry ends ---\n\nKind Regards,\nCompany Name\n\nP.S. All your inquiries are stored in the \"Inquiries\" section of Refinery should you ever want to view it later there.") | ||
it_has_behaviour 'sends emails' | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
shared_examples_for 'sends emails' do | ||
it "sends confirmation email" do | ||
open_email("[email protected]") | ||
|
||
expect(current_email.from).to eq(["#{Refinery::Inquiries.from_name}@example.com"]) | ||
expect(current_email.to).to eq(["[email protected]"]) | ||
expect(current_email.subject).to eq("Thank you for your inquiry") | ||
expect(current_email.body).to eq("Thank you for your inquiry Ugis Ozols,\n\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\n\nThanks.") | ||
end | ||
|
||
it "sends notification email" do | ||
open_email("[email protected]") | ||
|
||
expect(current_email.from).to eq(["#{Refinery::Inquiries.from_name}@example.com"]) | ||
expect(current_email.to).to eq(["[email protected]"]) | ||
expect(current_email.subject).to eq("New inquiry from your website") | ||
expect(current_email.body).to eq("Hi there,\n\nYou just received a new inquiry on your website.\n\n--- inquiry starts ---\n\nFrom: Ugis Ozols\nEmail: [email protected]\nPhone: \nMessage:\nHey, I'm testing!\n\n--- inquiry ends ---\n\nKind Regards,\nCompany Name\n\nP.S. All your inquiries are stored in the \"Inquiries\" section of Refinery should you ever want to view it later there.") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RSpec.configure do |c| | ||
c.alias_it_should_behave_like_to :it_has_behaviour, 'has behaviour:' | ||
end |