Sha256: b11b42c75613f612c4ca8be1510557967fbca63a9c3d5eff6b1bb37c9119765e

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'
require 'foo_mailer'
require 'rails/all'

describe InlineStylesMailer do
  before(:each) do
    FooMailer.reset
    Rails.should_receive(:root).any_number_of_times.and_return(Pathname.new(File.join("spec", "fixtures")))
  end

  context "SCSS preprocessing" do
    before(:each) do
      file = File.join("spec", "fixtures", "assets", "stylesheets", "_foo_mailer.css.scss")
      FooMailer.should_receive(:locate_css_file).and_return(file)
    end
    it "should inline the CSS" do
      mail = FooMailer.foo
      mail.body.should =~ /<p style="color: red;">Testing foo\.<\/p>/
      mail.body.should =~ /<body style="background: yellow;">/
    end
  end

  context "SASS preprocessing" do
    before(:each) do
      file = File.join("spec", "fixtures", "assets", "stylesheets", "_foo_mailer.css.sass")
      FooMailer.should_receive(:locate_css_file).and_return(file)
    end
    it "should inline the CSS" do
      mail = FooMailer.foo
      mail.body.should =~ /<p style="color: red;">Testing foo\.<\/p>/
      mail.body.should =~ /<body style="background: yellow;">/
    end
  end

  context "No preprocessing (plain old CSS)" do
    before(:each) do
      file = File.join("spec", "fixtures", "assets", "stylesheets", "_foo_mailer.css")
      FooMailer.should_receive(:locate_css_file).and_return(file)
    end
    it "should inline the CSS" do
      mail = FooMailer.foo
      mail.body.should =~ /<p style="color: red;">Testing foo\.<\/p>/
      mail.body.should =~ /<body style="background: yellow;">/
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inline_styles_mailer-0.0.3 spec/inline_styles_mailer/inline_styles_mailer_spec.rb