Sha256: 2230e91221f809353961d253cbec664267fb66fd3fda130482b5c725b1b02e9b

Contents?: true

Size: 1.16 KB

Versions: 13

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe 'shared/_my_actions.html.erb' do
  include CurationConcerns::SearchPathsHelper

  before do
    allow(view).to receive(:current_user).and_return(build(:user, email: 'geraldine@example.com'))
  end
  context "for admins" do
    before do
      allow(view).to receive(:can?).and_return(true)
      render
    end

    it 'has links' do
      expect(rendered).to have_text 'geraldine@example.com'
      expect(rendered).to have_link("My Works", href: search_path_for_my_works)
      expect(rendered).to have_link("My Collections", href: search_path_for_my_collections)
      expect(rendered).to have_link("Embargos", href: embargoes_path)
      expect(rendered).to have_link("Leases", href: leases_path)
      expect(rendered).to have_link("Admin Dashboard", href: curation_concerns.admin_index_path)
    end
  end

  context "for non-admins" do
    before do
      allow(view).to receive(:can?).and_return(false)
      render
    end
    it 'does not have links to edit' do
      expect(rendered).to have_text 'geraldine@example.com'
      expect(rendered).not_to have_text("My Works")
      expect(rendered).not_to have_text("My Collections")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.7 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-2.0.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-2.0.0.rc2 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.6 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.5 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.4 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.3 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.2 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-2.0.0.rc1 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.1 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.7.0.beta1 spec/views/shared/_my_actions.html.erb_spec.rb