Sha256: f4146c3009f0afbf64555fbc3f5dcfc936417375064997d118a5660c047180b5

Contents?: true

Size: 1.45 KB

Versions: 10

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe 'hyrax/my/_work_action_menu.html.erb' do
  let(:id) { '123' }
  let(:document) { SolrDocument.new(id: id, has_model_ssim: 'GenericWork') }
  let(:user) { build(:user) }

  before do
    allow(view).to receive(:current_user).and_return(user)
    allow(view).to receive(:display_trophy_link).and_return("Highlight Work on Profile")
  end

  context "When the user can transfer works" do
    before do
      allow(view).to receive(:can?).with(:transfer, id).and_return(true)
      render 'hyrax/my/work_action_menu', document: document
    end

    it "draws the page" do
      expect(rendered).to have_link "Transfer Ownership of Work"
      expect(rendered).to have_link 'Edit Work', href: edit_hyrax_generic_work_path(id)
      expect(rendered).to have_link 'Delete Work', href: hyrax_generic_work_path(id)
      expect(rendered).to have_content 'Highlight Work on Profile'
    end
  end

  context "when the user can't transfer works" do
    before do
      allow(view).to receive(:can?).with(:transfer, id).and_return(false)
      render 'hyrax/my/work_action_menu', document: document
    end

    it "draws the page" do
      expect(rendered).not_to have_link "Transfer Ownership of Work"
      expect(rendered).to have_link 'Edit Work', href: edit_hyrax_generic_work_path(id)
      expect(rendered).to have_link 'Delete Work', href: hyrax_generic_work_path(id)
      expect(rendered).to have_content 'Highlight Work on Profile'
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

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