Created
November 17, 2014 15:39
-
-
Save darrencauthon/0c11c7fd24f82733bd12 to your computer and use it in GitHub Desktop.
Contact Us Form
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
describe ContactUsController do | |
let(:params) { {} } | |
let(:controller) do | |
c = ContactUsController | |
c.stubs(:params).returns params | |
c | |
end | |
before { ContactUsLog.delete_all } | |
describe "receiving the contact us information" do | |
let(:name) { "Darren" } | |
let(:email) { "[email protected]" } | |
let(:body) { "This is the message body." } | |
it "should send the email through service X" do | |
EmailServiceX.expects(:send_email).with(name, email, body) | |
controller.receive | |
end | |
describe "creating a record of the submission" do | |
it "should create a log record" do | |
controller.receive | |
ContactUsLog.count.must_equal 1 | |
end | |
it "should stamp the name" do | |
controller.receive | |
ContactUsLog.first.name.must_equal name | |
end | |
it "should stamp the email" do | |
controller.receive | |
ContactUsLog.first.email.must_equal email | |
end | |
it "should stamp the body" do | |
controller.receive | |
ContactUsLog.first.body.must_equal body | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment