Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/send_grid/api_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def add_filter_setting(fltr, setting, val)
end

def to_json
@data.to_json
JSON.generate(@data, {:indent => " ", :space => "", :space_before => "", :object_nl => "", :array_nl => ""})
end

def standard_smtp(enabled = false)
Expand Down
12 changes: 6 additions & 6 deletions spec/api_header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@

it "contains 1 recipient (as array)" do
header.add_recipients '[email protected]'
header.to_json.should eql '{"to":["[email protected]"]}'
header.to_json.should eql '{ "to":[ "[email protected]"]}'
end

it "contaions an array of recipients" do
header.add_recipients %w([email protected] [email protected])
header.to_json.should eql '{"to":["[email protected]","[email protected]"]}'
header.to_json.should eql '{ "to":[ "[email protected]", "[email protected]"]}'
end

it "contains substitution" do
header.substitute :var1, 'Hello'
header.to_json.should eql '{"sub":{"var1":["Hello"]}}'
header.to_json.should eql '{ "sub":{ "var1":[ "Hello"]}}'
end

it "contains uniq args" do
header.uniq_args :arg1 => 'val1'
header.to_json.should eql '{"unique_args":{"arg1":"val1"}}'
header.to_json.should eql '{ "unique_args":{ "arg1":"val1"}}'
end

it "contains category" do
header.category 'category_name'
header.to_json.should eql '{"category":"category_name"}'
header.to_json.should eql '{ "category":"category_name"}'
end

it "contains filter settings" do
header.add_filter_setting :filter1, :setting1, 'val1'
header.to_json.should eql '{"filters":{"filter1":{"settings":{"setting1":"val1"}}}}'
header.to_json.should eql '{ "filters":{ "filter1":{ "settings":{ "setting1":"val1"}}}}'
end
end
end
6 changes: 3 additions & 3 deletions spec/mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe 'email with multiple recipients' do
it 'set correct recipients in X-SMTAPI header' do
Mailer.email_with_multiple_recipients(%w([email protected] [email protected])).deliver.header.to_s.
should include('X-SMTPAPI: {"to":["[email protected]","[email protected]"]}')
should include('X-SMTPAPI: { "to":[ "[email protected]", "[email protected]"]}')
end

it 'removes original TO header part' do
Expand All @@ -16,12 +16,12 @@
describe '#open_tracking' do
it 'set correct open tracking enabled X-SMTAPI header' do
Mailer.email_open_tracking.deliver.header.to_s.
should include('"filters":{"opentrack":{"settings":{"enabled":1}}}')
should include(' "filters":{ "opentrack":{ "settings":{ "enabled":1}}}')
end

it 'set correct open tracking disabled X-SMTAPI header' do
Mailer.email_open_tracking(false).deliver.header.to_s.
should include('"filters":{"opentrack":{"settings":{"enabled":0}}}')
should include(' "filters":{ "opentrack":{ "settings":{ "enabled":0}}}')
end

it 'set correct open tracking nil X-SMTAPI header' do
Expand Down