Sha256: 2b6c3c75e94baf99551f1a2b5431edba600c76a0589f1813516fecdd99a4328f

Contents?: true

Size: 923 Bytes

Versions: 6

Compression:

Stored size: 923 Bytes

Contents

require 'spec_helper'

describe 'shared/_my_actions.html.erb' do
  include Worthwhile::SearchPathsHelper
  context "for admins" do
    it 'has links to edit and add to collections' do
      allow(view).to receive(:current_user).and_return(FactoryGirl.create(:user))
      allow(view).to receive(:can?).and_return(true)
      render partial: 'shared/my_actions'
      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)
    end
  end
  context "for non-admins" do
    it 'does not have links to edit' do
      allow(view).to receive(:current_user).and_return(FactoryGirl.create(:user))
      allow(view).to receive(:can?).and_return(false)
      render partial: 'shared/my_actions'
      expect(rendered).not_to have_text("My Works")
      expect(rendered).not_to have_text("My Collections")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
worthwhile-0.1.2 spec/views/shared/_my_actions.html.erb_spec.rb
worthwhile-0.1.1 spec/views/shared/_my_actions.html.erb_spec.rb
worthwhile-0.1.0 spec/views/shared/_my_actions.html.erb_spec.rb
worthwhile-0.0.3 spec/views/shared/_my_actions.html.erb_spec.rb
worthwhile-0.0.2 spec/views/shared/_my_actions.html.erb_spec.rb
worthwhile-0.0.1 spec/views/shared/_my_actions.html.erb_spec.rb