spec/lib/sendgrid_actionmailer_spec.rb in sendgrid-actionmailer-2.0.1 vs spec/lib/sendgrid_actionmailer_spec.rb in sendgrid-actionmailer-2.1.0

- old
+ new

@@ -382,10 +382,19 @@ mail['tracking_settings'] = tracking mailer.deliver!(mail) expect(client.sent_mail['tracking_settings']).to eq(tracking) end end + + context 'dynamic template data' do + it 'sets dynamic_template_data' do + template_data = { variable_1: '1', variable_2: '2' } + mail['dynamic_template_data'] = template_data + mailer.deliver!(mail) + expect(client.sent_mail['personalizations'].first['dynamic_template_data']).to eq(template_data) + end + end end context 'multipart/alternative' do before do mail.content_type 'multipart/alternative' @@ -441,11 +450,11 @@ 'value' => 'I heard you like pineapple.' }) end it 'adds the attachment' do - expect(mail.attachments.first.read).to eq(File.read(__FILE__)) + expect(mail.attachments.first.read).to include("it 'adds the attachment' do") mailer.deliver!(mail) attachment = client.sent_mail['attachments'].first expect(attachment['filename']).to eq('specs.rb') expect(attachment['type']).to eq('application/x-ruby') end @@ -478,10 +487,10 @@ 'value' => 'I heard you like pineapple.' }) end it 'adds the inline attachment' do - expect(mail.attachments.first.read).to eq(File.read(__FILE__)) + expect(mail.attachments.first.read).to include("it 'adds the inline attachment' do") mailer.deliver!(mail) content = client.sent_mail['attachments'].first expect(content['filename']).to eq('specs.rb') expect(content['type']).to eq('application/x-ruby') expect(content['content_id'].class).to eq(String)