spec/lib/roadie/inliner_spec.rb in roadie-1.0.0 vs spec/lib/roadie/inliner_spec.rb in roadie-1.0.1
- old
+ new
@@ -1,11 +1,13 @@
+# encoding: UTF-8
require 'spec_helper'
describe Roadie::Inliner do
def use_css(css); @css = css; end
def rendering(html, options = {})
- Nokogiri::HTML.parse Roadie::Inliner.new(@css, html, options.fetch(:url_options, {:host => 'example.com'})).execute
+ url_options = options.fetch(:url_options, {:host => 'example.com'})
+ Nokogiri::HTML.parse Roadie::Inliner.new(@css, html, url_options).execute
end
describe "inlining styles" do
before(:each) do
# Make sure to have some css even when we don't specify any
@@ -205,10 +207,13 @@
it "should insert <head> if not present" do
rendering('<html><body></body></html>').should have_selector('html > head + body')
end
it "should insert meta tag describing content-type" do
- rendering('<html><head></head><body></body></html>').should have_selector('head meta[http-equiv="Content-Type"][content="text/html; charset=utf-8"]')
+ rendering('<html><head></head><body></body></html>').tap do |document|
+ document.should have_selector('head meta[http-equiv="Content-Type"]')
+ document.css('head meta[http-equiv="Content-Type"]').first['content'].should == 'text/html; charset=UTF-8'
+ end
end
it "should not insert duplicate meta tags describing content-type" do
rendering(<<-HTML).to_html.scan('meta').should have(1).item
<html>