Sha256: 9f7ad551a179f725f90a3ba238222d1a5efaad4e80e6e42b5af55424c52b4a60

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'sitehub/collection'

class SiteHub
  describe Collection do
    describe '#valid?' do
      it 'must be overiden and raises an exception by default' do
        expect { subject.valid? }.to raise_exception "implement me"
      end
    end

    describe '#resolve' do
      it 'must be overiden and raises an exception by default' do
        expect { subject.resolve }.to raise_exception "implement me"
      end
    end

    describe '.inherited' do
      describe '#add' do
        context 'duplicate ids added' do
          subject do
            inheritor = Class.new(described_class) do
              def add id, value, *args
                self[id] = value
              end
            end

            inheritor.new
          end
          it 'raises an error' do
            duplicate = Struct.new(:id).new(1)
            subject.add(duplicate.id, duplicate)
            expect{subject.add(duplicate.id, duplicate)}.to raise_exception described_class::DuplicateVersionException, 'supply unique labels'
          end
        end
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sitehub-0.4.2 spec/sitehub/collection_spec.rb
sitehub-0.4.1 spec/sitehub/collection_spec.rb