spec/sprockets-helpers_spec.rb in sprockets-helpers-1.2.3 vs spec/sprockets-helpers_spec.rb in sprockets-helpers-1.3.0
- old
+ new
@@ -534,31 +534,31 @@
end
end
describe '#javascript_tag' do
it 'generates script tag' do
- expect(context.javascript_tag('/main.js')).to eq('<script src="/main.js"></script>')
+ expect(context.javascript_tag('/main.js')).to eq('<script src="/main.js" type="text/javascript"></script>')
end
it 'appends extension' do
- expect(context.javascript_tag('/main')).to eq('<script src="/main.js"></script>')
+ expect(context.javascript_tag('/main')).to eq('<script src="/main.js" type="text/javascript"></script>')
end
it 'prepends the javascript dir' do
- expect(context.javascript_tag('main')).to eq('<script src="/javascripts/main.js"></script>')
+ expect(context.javascript_tag('main')).to eq('<script src="/javascripts/main.js" type="text/javascript"></script>')
end
describe 'when expanding' do
context 'in Sprockets 3.x' do
next unless Sprockets::Helpers.are_using_sprockets_3
it 'generates script tag for each javascript asset' do
within_construct do |construct|
assets_layout(construct)
tags = context.javascript_tag('main.js', :expand => true)
- expect(tags).to include('<script src="/assets/main.self.js?body=1"></script>')
- expect(tags).to include('<script src="/assets/a.self.js?body=1"></script>')
- expect(tags).to include('<script src="/assets/b.self.js?body=1"></script>')
+ expect(tags).to include('<script src="/assets/main.self.js?body=1" type="text/javascript"></script>')
+ expect(tags).to include('<script src="/assets/a.self.js?body=1" type="text/javascript"></script>')
+ expect(tags).to include('<script src="/assets/b.self.js?body=1" type="text/javascript"></script>')
end
end
end
context 'in Sprockets 2.x' do
@@ -566,58 +566,58 @@
it 'generates script tag for each javascript asset' do
within_construct do |construct|
assets_layout(construct)
tags = context.javascript_tag('main.js', :expand => true)
- expect(tags).to include('<script src="/assets/main.js?body=1"></script>')
- expect(tags).to include('<script src="/assets/a.js?body=1"></script>')
- expect(tags).to include('<script src="/assets/b.js?body=1"></script>')
+ expect(tags).to include('<script src="/assets/main.js?body=1" type="text/javascript"></script>')
+ expect(tags).to include('<script src="/assets/a.js?body=1" type="text/javascript"></script>')
+ expect(tags).to include('<script src="/assets/b.js?body=1" type="text/javascript"></script>')
end
end
end
end
end
describe '#stylesheet_tag' do
it 'generates stylesheet tag' do
- expect(context.stylesheet_tag('/main.css')).to eq('<link rel="stylesheet" href="/main.css">')
+ expect(context.stylesheet_tag('/main.css')).to eq('<link rel="stylesheet" type="text/css" href="/main.css">')
end
it 'appends extension' do
- expect(context.stylesheet_tag('/main')).to eq('<link rel="stylesheet" href="/main.css">')
+ expect(context.stylesheet_tag('/main')).to eq('<link rel="stylesheet" type="text/css" href="/main.css">')
end
it 'prepends the stylesheets dir' do
- expect(context.stylesheet_tag('main')).to eq('<link rel="stylesheet" href="/stylesheets/main.css">')
+ expect(context.stylesheet_tag('main')).to eq('<link rel="stylesheet" type="text/css" href="/stylesheets/main.css">')
end
it 'uses media attribute when provided' do
- expect(context.stylesheet_tag('main', :media => "print")).to eq('<link rel="stylesheet" href="/stylesheets/main.css" media="print">')
+ expect(context.stylesheet_tag('main', :media => "print")).to eq('<link rel="stylesheet" type="text/css" href="/stylesheets/main.css" media="print">')
end
describe 'when expanding' do
context 'in Sprockets 3.x' do
it 'generates stylesheet tag for each stylesheet asset' do
next unless Sprockets::Helpers.are_using_sprockets_3
within_construct do |construct|
assets_layout(construct)
tags = context.stylesheet_tag('main.css', :expand => true)
- expect(tags).to include('<link rel="stylesheet" href="/assets/main.self.css?body=1">')
- expect(tags).to include('<link rel="stylesheet" href="/assets/a.self.css?body=1">')
- expect(tags).to include('<link rel="stylesheet" href="/assets/b.self.css?body=1">')
+ expect(tags).to include('<link rel="stylesheet" type="text/css" href="/assets/main.self.css?body=1">')
+ expect(tags).to include('<link rel="stylesheet" type="text/css" href="/assets/a.self.css?body=1">')
+ expect(tags).to include('<link rel="stylesheet" type="text/css" href="/assets/b.self.css?body=1">')
end
end
end
context "in Sprockets 2.x" do
next if Sprockets::Helpers.are_using_sprockets_3
it 'generates stylesheet tag for each stylesheet asset' do
within_construct do |construct|
assets_layout(construct)
tags = context.stylesheet_tag('main.css', :expand => true)
- expect(tags).to include('<link rel="stylesheet" href="/assets/main.css?body=1">')
- expect(tags).to include('<link rel="stylesheet" href="/assets/a.css?body=1">')
- expect(tags).to include('<link rel="stylesheet" href="/assets/b.css?body=1">')
+ expect(tags).to include('<link rel="stylesheet" type="text/css" href="/assets/main.css?body=1">')
+ expect(tags).to include('<link rel="stylesheet" type="text/css" href="/assets/a.css?body=1">')
+ expect(tags).to include('<link rel="stylesheet" type="text/css" href="/assets/b.css?body=1">')
end
end
end
end
end