Sha256: 381ef62055fbeeecd74f4b594e7984786bebf9c909c8717f09f070205fad3442
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' describe Locomotive::Steam::Middlewares::WysihtmlCss do let(:url) { 'http://example.com/' } let(:path) { 'index' } let(:html) { 'Hello world' } let(:page) { nil } let(:app) { ->(env) { [200, env, [html]] } } let(:env) { env_for(url).tap { |e| e['steam.page'] = page; e['steam.path'] = path } } let(:middleware) { described_class.new(app) } subject { middleware.call(env).last.first } describe 'not a html page' do let(:page) { instance_double('SimplePage', redirect: false, response_type: 'application/xml') } it { is_expected.to eq('Hello world') } end describe 'html page' do let(:page) { instance_double('SimplePage', redirect: false, response_type: 'text/html') } describe 'no head tag' do it { is_expected.to eq('Hello world') } end describe 'head tag found' do let(:html) { '<html><head></head><body></body></html>' } it { is_expected.to match(%r(<html><head><link rel="stylesheet" type="text/css" href="/assets/locomotive/wysihtml5_editor-[^.]+.css"></head><body></body></html>)) } context 'Google AMP page' do let(:path) { '_amp/simple' } it { is_expected.to eq('<html><head></head><body></body></html>') } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
locomotivecms-3.3.0 | spec/requests/locomotive/steam/wysihtml_css_spec.rb |