spec/models/journey/resource/attachments_spec.rb in embark-journey-0.0.24 vs spec/models/journey/resource/attachments_spec.rb in embark-journey-0.0.25

- old
+ new

@@ -1,10 +1,10 @@ require 'spec_helper' describe Journey::Resource::Attachments do - let(:klass) do + let(:klass) do Class.new(Journey::Resource) do self.element_name = 'job' attachment :important_file attachment :boring_file end @@ -13,11 +13,12 @@ describe '.attachment' do let(:instance) do klass.new(display_attachments: OpenStruct.new({ 'important_file' => OpenStruct.new({ 'original' => 'O.jpg', - 'thumbnail' => 'T.jpg' + 'thumbnail' => 'T.jpg', + 'with_sha' => '/S?sha=asdasd' }) })) end describe '##{attachment}_path' do @@ -41,9 +42,13 @@ end describe '##{attachment}_url' do it 'is blank when attachment doesnt exist' do expect(instance.boring_file_url).to be_blank + end + + it 'generates a valid url with sha (update due to journey attachment security updates)' do + expect(instance.important_file_url('with_sha')).to include(instance.display_attachments.important_file.with_sha) end end end end