Sha256: c88bcf9ef90059b33bb7387d4687524039a6f5d6c740572017065348c38c7f6a

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe 'curation_concern/base/show.html.erb' do

  let!(:curation_concern) { FactoryGirl.create(:private_generic_work) }

  context "for editors" do
    before do
      allow(view).to receive(:can?).and_return(true)
    end

    it 'has links to edit and add to collections' do
      render file: 'curation_concern/base/show', locals: { curation_concern: curation_concern }
      expect(rendered).to have_link("Edit This Generic Work", href: edit_polymorphic_path([:curation_concern, curation_concern]))
      expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
      expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
    end
  end

  context "for non-editors" do
    it 'does not have links to edit, but has add to collection' do
      render file: 'curation_concern/base/show', locals: { curation_concern: curation_concern }
      expect(rendered).not_to have_content("Edit this Generic Work")

      expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
      expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
worthwhile-0.1.2 spec/views/curation_concern/base/show.html.erb_spec.rb
worthwhile-0.1.1 spec/views/curation_concern/base/show.html.erb_spec.rb
worthwhile-0.1.0 spec/views/curation_concern/base/show.html.erb_spec.rb
worthwhile-0.0.3 spec/views/curation_concern/base/show.html.erb_spec.rb
worthwhile-0.0.2 spec/views/curation_concern/base/show.html.erb_spec.rb