27 lines
859 B
Ruby
27 lines
859 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "spec_helper"
|
|
|
|
describe WorksController do
|
|
include LoginMacros
|
|
include RedirectExpectationHelper
|
|
|
|
describe "GET #navigate" do
|
|
context "denies access for work that isn't visible to user" do
|
|
subject { get :navigate, params: { id: work.id } }
|
|
let(:success) { expect(response).to render_template("navigate") }
|
|
let(:success_admin) { success }
|
|
|
|
include_examples "denies access for work that isn't visible to user"
|
|
end
|
|
|
|
context "denies access for restricted work to guest" do
|
|
let(:work) { create(:work, restricted: true) }
|
|
|
|
it "redirects with an error" do
|
|
get :navigate, params: { id: work.id }
|
|
it_redirects_to_with_error(root_path, "Sorry, you don't have permission to access the page you were trying to reach. Please log in.")
|
|
end
|
|
end
|
|
end
|
|
end
|