Sha256: 65713603bf6cbc2585106e3174c733889c98a4619445f0b8e2d9754a9209a3c4

Contents?: true

Size: 977 Bytes

Versions: 9

Compression:

Stored size: 977 Bytes

Contents

require 'spec_helper'

module Artwork
  describe View do
    let(:view_context) { Class.new { include View }.new }

    describe '#activate_resolution_independence' do
      it 'returns an HTML script tag' do
        stub_const('Uglifier', double(:compile => 'compiled_script'))
        expect(Thread).to receive(:current).and_return({})
        expect(view_context).to receive(:content_tag).with(:script, 'compiled_script').and_return('compiled_script_html')

        expect(view_context.activate_resolution_independence).to eq 'compiled_script_html'
      end

      it 'caches the compiled script in Thread.current' do
        expect(Thread).to receive(:current).and_return(:artwork_script => 'cached_compiled_script')
        expect(view_context.activate_resolution_independence).to eq 'cached_compiled_script'
      end
    end

    it 'defines the artwork_tag helper method' do
      expect(View.instance_methods.map(&:to_sym)).to include(:artwork_tag)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
artwork-0.6.1 spec/artwork/view_spec.rb
artwork-0.6.0 spec/artwork/view_spec.rb
artwork-0.5.0 spec/artwork/view_spec.rb
artwork-0.4.2 spec/artwork/view_spec.rb
artwork-0.4.1 spec/artwork/view_spec.rb
artwork-0.4.0 spec/artwork/view_spec.rb
artwork-0.3.2 spec/artwork/view_spec.rb
artwork-0.3.1 spec/artwork/view_spec.rb
artwork-0.3.0 spec/artwork/view_spec.rb