And add tests for empty string & null

This commit is contained in:
Anton Batenev 2013-07-09 20:19:10 +04:00
parent 4e04c4dddd
commit b0dbb0ea13
3 changed files with 10 additions and 2 deletions

View File

@ -129,7 +129,7 @@ class SiteSetting < ActiveRecord::Base
# we need to think of a way to force users to enter certain settings, this is a minimal config thing
setting(:notification_email, 'info@discourse.org')
setting(:email_custom_headers, 'Precedence: bulk|Auto-Submitted: auto-generated')
setting(:email_custom_headers, 'Auto-Submitted: auto-generated')
setting(:allow_index_in_robots_txt, true)

View File

@ -87,7 +87,7 @@ module Email
value = header[1].strip
result[name] = value if name.length > 0 && value.length > 0
end
}
} if !string.nil?
result
end

View File

@ -84,6 +84,14 @@ describe Email::MessageBuilder do
expect(Email::MessageBuilder.custom_headers(custom_headers_string)).to eq(custom_headers_result)
end
it "empty headers builder" do
expect(Email::MessageBuilder.custom_headers("")).to eq({})
end
it "null headers builder" do
expect(Email::MessageBuilder.custom_headers(nil)).to eq({})
end
end
context "header args" do