Sha256: def8b6af286d6762308c83b440aca3891d9377f1f7dece29fdc2a61721adbd12

Contents?: true

Size: 1.07 KB

Versions: 53

Compression:

Stored size: 1.07 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)
    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

53 entries across 53 versions & 1 rubygems

Version Path
curation_concerns-1.6.3 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.6.2 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.6.1 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.6.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.5.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.4.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.3.3 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.3.2 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.3.1 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.3.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.2.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.1.2 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.1.1 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.1.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.0.0 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.0.0.beta10 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.0.0.beta9 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.0.0.beta8 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.0.0.beta7 spec/views/shared/_my_actions.html.erb_spec.rb
curation_concerns-1.0.0.beta6 spec/views/shared/_my_actions.html.erb_spec.rb