Sha256: 3cabdb838e150eee92bbf7320c9ddcc84119a2584ab9a80a547a3ce20404419b

Contents?: true

Size: 921 Bytes

Versions: 10

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

describe Hyrax::QuickClassificationQuery do
  let(:user) { create(:user) }

  context "with no options" do
    let(:query) { described_class.new(user) }
    describe "#all?" do
      subject { query.all? }
      it { is_expected.to be true }
    end

    describe '#each' do
      let(:thing) { double }
      before do
        # Ensure that no other test has altered the configuration:
        allow(Hyrax.config).to receive(:registered_curation_concern_types).and_return(['GenericWork'])
      end
      it "calls the block once for every model" do
        expect(thing).to receive(:test).with(GenericWork)
        query.each do |f|
          thing.test(f)
        end
      end
    end
  end

  context "with models" do
    let(:query) { described_class.new(user, models: ['dataset']) }
    describe "#all?" do
      subject { query.all? }
      it { is_expected.to be false }
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.1.0 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.5 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.4 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.3 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.2 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.1 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.0.rc2 spec/services/hyrax/quick_classification_query_spec.rb
hyrax-1.0.0.rc1 spec/services/hyrax/quick_classification_query_spec.rb
test_hyrax-0.0.1.alpha spec/services/hyrax/quick_classification_query_spec.rb