Skip to content

Commit

Permalink
add specs for :inline_css option for transmission
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil committed Apr 25, 2016
1 parent 111654d commit 4852cff
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions spec/inline_css_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require 'spec_helper'

describe SparkPostRails::DeliveryMethod do

before(:each) do
SparkPostRails.configuration.set_defaults
@delivery_method = SparkPostRails::DeliveryMethod.new
end

context "Inline css" do
it "handles inline_css set in the configuration" do
SparkPostRails.configure do |c|
c.inline_css = true
end

test_email = Mailer.test_email
@delivery_method.deliver!(test_email)

expect(@delivery_method.data[:options][:inline_css]).to eq(true)
end

it "handles inline_css set on an individual message" do
test_email = Mailer.test_email sparkpost_data: {inline_css: true}

@delivery_method.deliver!(test_email)

expect(@delivery_method.data[:options][:inline_css]).to eq(true)
end

it "handles the value on an individual message overriding configuration" do
SparkPostRails.configure do |c|
c.inline_css = false
end

test_email = Mailer.test_email sparkpost_data: {inline_css: true}

@delivery_method.deliver!(test_email)

expect(@delivery_method.data[:options][:inline_css]).to eq(true)
end

it "handles a default setting of inline_css" do
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)

expect(@delivery_method.data[:options][:inline_css]).to eq(false)
end
end
end

0 comments on commit 4852cff

Please sign in to comment.