Sha256: 133f1ca9e7363190cba86618528f20952c56bf8238362a51d561a3d660893a39

Contents?: true

Size: 1.32 KB

Versions: 25

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe 'SelectWithHelpInput', type: :input do
  subject { input_for form, :resource_type, options }
  let(:file) { FileSet.new }
  let(:form_class) do
    Class.new do
      include HydraEditor::Form
      self.model_class = FileSet
      self.terms = [:resource_type]
    end
  end
  let(:form) { form_class.new(FileSet.new) }
  let(:collection) { ResourceTypesService.select_options }
  let(:base_options) do
    { as: :select_with_help, collection: collection,
      input_html: { class: 'form-control', multiple: true } }
  end
  let(:options) { base_options }

  it "does not be required by default" do
    expect(subject).to have_selector 'select'
    expect(subject).not_to match(/required/)
  end

  context 'with File Edit' do
    let(:user) { create(:user) }
    let(:file) { FileSet.create(label: 'f1') { |f| f.apply_depositor_metadata(user) } }
    let(:form) { CurationConcerns::Forms::FileSetEditForm.new(file) }
    let(:base_options) do
      { as: :select_with_help, collection: collection,
        input_html: { class: 'form-control', multiple: true } }
    end
    let(:options) { base_options }

    subject { input_for form, :resource_type, options }

    it "is not required by default" do
      expect(subject).to have_selector 'select'
      expect(subject).not_to match(/required/)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
curation_concerns-1.0.0.beta4 spec/inputs/select_with_help_input_spec.rb
curation_concerns-1.0.0.beta3 spec/inputs/select_with_help_input_spec.rb
curation_concerns-1.0.0.beta2 spec/inputs/select_with_help_input_spec.rb
curation_concerns-1.0.0.beta1 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.14.0 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.14.0.pre4 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.14.0.pre3 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.14.0.pre2 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.14.0.pre1 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.13.1 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.13.0 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre9 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre8 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre7 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre6 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre5 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre4 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre3 spec/inputs/select_with_help_input_spec.rb
curation_concerns-0.12.0.pre2 spec/inputs/select_with_help_input_spec.rb