Sha256: c815c04394e2ef4f0caf8095f4f8b1d27af914bff49b9691f4c5c890245077b9

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe ClassifyConcern do
  subject { ClassifyConcern.new(curation_concern_type: curation_concern_type) }
  let(:curation_concern_type) { nil }

  describe '.all_curation_concern_classes' do
    it 'has MockCurationConcern' do
      expect(ClassifyConcern.all_curation_concern_classes).to include(MockCurationConcern)
      expect(ClassifyConcern.all_curation_concern_classes).to_not include('MockCurationConcern')
    end
  end

  describe '#all_curation_concern_classes' do
    it 'has MockCurationConcern' do
      expect(subject.all_curation_concern_classes).to include(MockCurationConcern)
      expect(subject.all_curation_concern_classes).to_not include('MockCurationConcern')
    end
  end


  describe 'with curation_concern_type: nil' do
    it 'is not valid' do
      expect(subject).to_not be_valid
    end

    it 'raises an error on .curation_concern_class' do
      expect{
        subject.curation_concern_class
      }.to raise_error(RuntimeError)
    end
  end

  describe 'with curation_concern_type: "MockCurationConcern"' do
    let(:curation_concern_type) { "MockCurationConcern" }

    it 'is valid if curation_concern_type is from the right list' do
      expect(subject).to be_valid
    end

    it 'has a <MockCurationConcern> class for curation_concern_class' do
      expect(subject.curation_concern_class).to eq(MockCurationConcern)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curate-0.3.2 spec/models/classify_concern_spec.rb
curate-0.3.1 spec/models/classify_concern_spec.rb