Sha256: cc457dc3a697c9dc555357ae3f5a6a0240f90c5b8bfb279714660fc317aa68de
Contents?: true
Size: 1.29 KB
Versions: 36
Compression:
Stored size: 1.29 KB
Contents
RSpec.shared_examples "an object that has a display title" do describe "#title_display" do let(:object) { described_class.new } subject { object.title_display } context "has title" do before { object.title = [ 'Title' ] } it "should return the first title" do expect(subject).to eq('Title') end end context "has no title, has identifier" do before { object.identifier = [ 'id001' ] } it "should return the first identifier" do expect(subject).to eq('id001') end end # Only objects with content implement :original_filename # This test worked before b/c allowing rspec to stub methods # that aren't defined on object. This rspec-mocks config setting prevents that: # # verify_partial_doubles = true # # context "has no title, no identifier, has original_filename" do # before { allow(object).to receive(:original_filename) { "file.txt" } } # it "should return original_filename" do # expect(subject).to eq "file.txt" # end # end context "has no title, no identifier, no original_filename" do let(:object) { described_class.new(:pid => 'duke:test') } it "should return the PID in square brackets" do expect(subject).to eq "[duke:test]" end end end end
Version data entries
36 entries across 36 versions & 1 rubygems