diff options
author | Henare Degan <henare.degan@gmail.com> | 2015-04-21 16:38:56 +1000 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2015-04-21 16:38:56 +1000 |
commit | 1ad88a5c0d274dad87cf28d952f2f96d114be783 (patch) | |
tree | c3245875ddaeb1a013e618e23ed10b8352c3e6e0 | |
parent | 177c3c13b7eb3e34d78795f030ae7f352d3bd621 (diff) |
Change PublicBody behaviour to not override blank request emails
This is so if you're overriding the request email you can still
observe how Alaveteli behaves when there's no request email set.
-rw-r--r-- | app/models/public_body.rb | 2 | ||||
-rw-r--r-- | spec/models/public_body_spec.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 0bcb1da8c..5bce8ecc7 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -578,7 +578,7 @@ class PublicBody < ActiveRecord::Base end def request_email - if AlaveteliConfiguration::override_all_public_body_request_emails.blank? + if AlaveteliConfiguration::override_all_public_body_request_emails.blank? || read_attribute(:request_email).blank? read_attribute(:request_email) else AlaveteliConfiguration::override_all_public_body_request_emails diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index 07c9b860b..cce017424 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -1258,9 +1258,9 @@ describe PublicBody do expect(public_body.request_email).to be_blank end - it "should return a different email address when overridden in configuration" do + 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 eq("tester@example.com") + expect(public_body.request_email).to be_blank end end end |