Sha256: 68bb1749698d6230fce1782d05da5e508be3681ea36e06cb292ba13c0eaaf38f

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 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 eq('<html><head><link rel="stylesheet" type="text/css" href="/assets/locomotive/wysihtml5_editor.css"></head><body></body></html>') }

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc6 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.0.0.rc5 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.0.0.rc4 spec/requests/locomotive/steam/wysihtml_css_spec.rb
locomotivecms-3.0.0.rc3 spec/requests/locomotive/steam/wysihtml_css_spec.rb