require 'spec_helper' require 'email' describe EmailStyles do def style_exists(html, css_rule) fragment = Nokogiri::HTML.fragment(EmailStyles.new(html).format) element = fragment.at(css_rule) expect(element["style"]).not_to be_blank end it "returns blank from an empty string" do EmailStyles.new("").format.should be_blank end it "attaches a style to h3 tags" do style_exists("

hello

", "h3") end it "attaches a style to hr tags" do style_exists("hello
", "hr") end it "attaches a style to a tags" do style_exists("wat", "a") end it "attaches a style to ul tags" do style_exists("", "ul") end it "attaches a style to li tags" do style_exists("", "li") end it "removes pre tags but keeps their contents" do expect(EmailStyles.new("
hello
").format).to eq("hello") end end