Sha256: e29c313a3d236672c528918d056d4fb633cabe9f95dd2823089c1c9368680c4a

Contents?: true

Size: 970 Bytes

Versions: 10

Compression:

Stored size: 970 Bytes

Contents

require 'spec_helper'

RSpec.describe 'hyrax/dashboard/_create_work_action.html.erb', type: :view do
  before do
    allow(view).to receive(:create_work_presenter).and_return(presenter)
    allow(presenter).to receive(:first_model).and_yield(GenericWork)
    render
  end

  context "when we have more than one model" do
    let(:presenter) { instance_double(Hyrax::SelectTypeListPresenter, many?: true) }

    it "renders the select template" do
      expect(rendered).to have_selector 'a[data-behavior="select-work"][data-target="#worktypes-to-create"][data-create-type="single"]'
      expect(rendered).to have_link('Create Work', href: '#')
    end
  end

  context "when we have one model" do
    let(:presenter) { instance_double(Hyrax::SelectTypeListPresenter, many?: false) }

    it "doesn't draw the modal" do
      expect(rendered).not_to include "modal"
      expect(rendered).to have_link "Create Work", href: '/concern/generic_works/new'
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.1.0 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.5 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.4 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.3 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.2 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.1 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.0.rc2 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
hyrax-1.0.0.rc1 spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb
test_hyrax-0.0.1.alpha spec/views/hyrax/dashboard/create_work_action.html.erb_spec.rb