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-3.0.6 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.5 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.4 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.3 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.2 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.1 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.rc6 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.rc5 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.rc4 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.rc3 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.rc2 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.rc1 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.22 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.21 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.20 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.18 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.17 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.16 spec/support/shared_examples_for_publication.rb
ddr-models-3.0.0.beta.15 spec/support/shared_examples_for_publication.rb