Sha256: c2c803648becfbc91c6cf440e3998108a34457a26858b0fbc600e9dc88b0e5cc
Contents?: true
Size: 1.04 KB
Versions: 18
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' module Alchemy describe EssenceFile do let(:attachment) { build_stubbed(:attachment) } let(:essence) { EssenceFile.new(attachment: attachment) } it_behaves_like "an essence" do let(:essence) { EssenceFile.new } let(:ingredient_value) { attachment } end describe '#attachment_url' do subject { essence.attachment_url } it "returns the download attachment url." do is_expected.to match(/\/attachment\/#{attachment.id}\/download\/#{attachment.file_name}/) end context 'without attachment assigned' do let(:attachment) { nil } it { is_expected.to be_nil } end end describe '#preview_text' do it "returns the attachment's name as preview text" do expect(essence.preview_text).to eq(attachment.name) end context "with no attachment assigned" do it "returns empty string" do essence.attachment = nil expect(essence.preview_text).to eq('') end end end end end
Version data entries
18 entries across 18 versions & 2 rubygems