Sha256: 3c5ec69d5376bc652589e982877f9689337486ff4eff298278ac18bfcc8f3efb

Contents?: true

Size: 1.2 KB

Versions: 64

Compression:

Stored size: 1.2 KB

Contents

RSpec.shared_examples 'a publishable object' do
  describe '#publishable?' do
    let(:object) { described_class.new }
    it 'should be publishable' do
      expect(object.publishable?).to be true
    end
  end
end

RSpec.shared_examples 'an unpublishable object' do
  describe '#publishable?' do
    let(:object) { described_class.new }
    it 'should not be publishable' do
      expect(object.publishable?).to be false
    end
  end
end

RSpec.shared_examples 'a potentially publishable object' do
  describe "#publishable?" do
    let(:object) { described_class.new }
    context "has parent" do
      before { allow(object).to receive(:parent) { parent } }
      context "parent is published" do
        let(:parent) { double(published?: true) }
        it "should be publishable" do
          expect(object.publishable?).to be true
        end
      end
      context "parent is not published" do
        let(:parent) { double(published?: false) }
        it "should not be publishable" do
          expect(object.publishable?).to be false
        end
      end
    end
    context "does not have parent" do
      it "should not be publishable" do
        expect(object.publishable?).to be false
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
ddr-models-2.11.0 spec/support/shared_examples_for_publication.rb
ddr-models-2.10.2 spec/support/shared_examples_for_publication.rb
ddr-models-2.10.1 spec/support/shared_examples_for_publication.rb
ddr-models-2.10.0 spec/support/shared_examples_for_publication.rb
ddr-models-2.10.0.rc2 spec/support/shared_examples_for_publication.rb
ddr-models-2.10.0.rc1 spec/support/shared_examples_for_publication.rb
ddr-models-2.9.2 spec/support/shared_examples_for_publication.rb
ddr-models-2.9.1 spec/support/shared_examples_for_publication.rb
ddr-models-2.9.0 spec/support/shared_examples_for_publication.rb
ddr-models-2.9.0.rc1 spec/support/shared_examples_for_publication.rb
ddr-models-2.8.0 spec/support/shared_examples_for_publication.rb
ddr-models-2.8.0.rc1 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.6 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.5 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.4 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.3 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.2 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.1 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.0 spec/support/shared_examples_for_publication.rb
ddr-models-2.7.0.rc1 spec/support/shared_examples_for_publication.rb