Sha256: e7359e30e0b41e779c63fac8d908a14b8a8d0a70b044ca289c67c22df935a268

Contents?: true

Size: 1.08 KB

Versions: 16

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Locomotive::Steam::Middlewares::WysihtmlCss do

  let(:url)         { 'http://example.com/' }
  let(:html)        { 'Hello world' }
  let(:page)        { nil }
  let(:app)         { ->(env) { [200, env, [html]] } }
  let(:env)         { env_for(url).tap { |e| e['steam.page'] = page } }
  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>)) }

    end

  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
locomotivecms-3.3.0.rc3 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.3.0.rc2 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.1.2 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.2.1 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.3.0.rc1 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.2.0 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.2.0.rc2 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.2.0.rc1 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.1.1 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.1.0 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.1.0.rc3 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.1.0.rc2 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.1.0.rc1 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.0.1 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.0.0 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.0.0.rc7 spec/requests/locomotive/steam/wysihtml_css_spec.rb