Sha256: c1d40e6721c304c8433122fa9865a540350d8b59c6ce7055fc614d5a2bd5d11a

Contents?: true

Size: 863 Bytes

Versions: 27

Compression:

Stored size: 863 Bytes

Contents

require 'spec_helper'

describe 'alchemy/essences/_essence_file_view' do
  let(:file)       { File.new(File.expand_path('../../../fixtures/image with spaces.png', __FILE__)) }
  let(:attachment) { mock_model('Attachment', file: file, name: 'image', file_name: 'Image') }
  let(:essence)    { Alchemy::EssenceFile.new(attachment: attachment) }
  let(:content)    { Alchemy::Content.new(essence: essence) }

  context 'without attachment' do
    let(:essence) { Alchemy::EssenceFile.new(attachment: nil) }

    it "renders nothing" do
      render content, content: content
      expect(rendered).to eq('')
    end
  end

  context 'with attachment' do
    it "renders a link to download the attachment" do
      render content, content: content
      expect(rendered).to have_selector("a.file_link[href='/attachment/#{attachment.id}/download']")
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.3 spec/views/essences/essence_file_view_spec.rb
lc_alchemy_cms-3.2.1 spec/views/essences/essence_file_view_spec.rb
lc_alchemy_cms-3.2.0 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.2.0 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.2.0.rc1 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.2.0.beta spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.1 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.0.4 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.rc3 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.rc2 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.rc1 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.beta6 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.beta5 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.beta4 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.0.3 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.beta3 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.beta2 spec/views/essences/essence_file_view_spec.rb
alchemy_cms-3.1.0.beta1 spec/views/essences/essence_file_view_spec.rb