diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-04-21 11:45:42 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-04-21 11:45:42 +0100 |
commit | c2f7fb7fba05bc315d15ed9615ea6be41a8a5477 (patch) | |
tree | c7f9877a1e06cac3c38144fbff472f5ccf91f1f4 /spec/models | |
parent | 0af8d48805d575fd379468531067af64596b3b33 (diff) | |
parent | 1ad88a5c0d274dad87cf28d952f2f96d114be783 (diff) |
Merge remote-tracking branch 'openaustralia_github/blank-request-email' into rails-3-develop
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/public_body_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index 7b55efda1..cce017424 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -1237,6 +1237,33 @@ describe PublicBody do end + describe :request_email do + context "when the email is set" do + subject(:public_body) { FactoryGirl.create(:public_body, :request_email => "request@example.com") } + + it "should return the set email address" do + expect(public_body.request_email).to eq("request@example.com") + end + + it "should return a different email address when overridden in configuration" do + AlaveteliConfiguration.stub!(:override_all_public_body_request_emails).and_return("tester@example.com") + expect(public_body.request_email).to eq("tester@example.com") + end + end + + context "when no email is set" do + subject(:public_body) { FactoryGirl.create(:public_body, :request_email => "") } + + it "should return a blank email address" do + expect(public_body.request_email).to be_blank + end + + it "should still return a blank email address when overridden in configuration" do + AlaveteliConfiguration.stub!(:override_all_public_body_request_emails).and_return("tester@example.com") + expect(public_body.request_email).to be_blank + end + end + end end describe PublicBody::Translation do |