Sha256: 0fcbe6d379e356e3c59405647ae71c42c74a9eece5b55ac17b25ded545b85a85
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
require 'rails_helper' describe MessageTrain::AttachmentsHelper do include_context 'loaded site' before do view.extend BootstrapLeather::ApplicationHelper end describe '#attachment_icon' do context 'when attachment is an image' do subject { helper.attachment_icon(image_attachment) } it do should have_tag( :img, with: { src: image_attachment.attachment.url(:thumb) } ) end end context 'when attachment is a file' do subject { helper.attachment_icon(pdf_attachment) } it { should have_tag :span, with: { class: 'glyphicon-save-file' } } end end describe '#attachment_link' do context 'when attachment is an image' do subject { helper.attachment_link(image_attachment) } it do should have_tag( :a, with: { href: '#', class: 'thumbnail', 'data-toggle' => 'modal', 'data-target' => '#attachment_preview', 'data-src' => image_attachment.attachment.url(:large), 'data-original' => image_attachment.attachment.url(:original), 'data-text' => 'Click for Original' } ) end end context 'when attachment is a file' do subject { helper.attachment_link(pdf_attachment) } it do should have_tag( :a, with: { href: pdf_attachment.attachment.url, class: 'thumbnail' } ) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems