Sha256: f492f4f88f0f68a557200fd8f497ef96e623894b2319b6d27fb1992160f47a1d
Contents?: true
Size: 1006 Bytes
Versions: 36
Compression:
Stored size: 1006 Bytes
Contents
require 'ostruct' shared_examples 'content_image' do describe "when there is a default paperclip image" do subject { get_presenter(stub_presenter(image: ContentImage::MISSING_WOOPLE_IMAGE)) } it "yields the default image" do subject.image { |url| url }.should == ContentImage::DEFAULT_IMAGE end end describe "when there is a null image" do subject { get_presenter(stub_presenter(image: nil)) } it "yields the default image" do subject.image { |url| url }.should == ContentImage::DEFAULT_IMAGE end end describe "when there is an image" do subject { get_presenter(stub_presenter(image: 'image.jpg')) } it "yields the specified image" do subject.image { |url| url }.should == 'image.jpg' end end private def get_presenter(model) presenter.new(model) end def stub_presenter(options = {}) defaults = {name: 'Content Item', url: '/course', image: nil} defaults.merge!(options) OpenStruct.new(defaults) end end
Version data entries
36 entries across 36 versions & 1 rubygems