Move redirection test to controller specs
We make the test faster and avoid a strange issue with `current_path` in
JavaScript tests.
We should probably have done this in commit ec1874325.
This commit is contained in:
11
spec/controllers/legislation/proposals_controller_spec.rb
Normal file
11
spec/controllers/legislation/proposals_controller_spec.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Legislation::ProposalsController do
|
||||
describe "GET new" do
|
||||
it "redirects to register path if user is not logged in" do
|
||||
get :new, params: { process_id: create(:legislation_process, :in_proposals_phase).id }
|
||||
|
||||
expect(response).to redirect_to new_user_session_path
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -387,16 +387,6 @@ describe "Legislation" do
|
||||
expect(page).to have_content("There are no proposals")
|
||||
end
|
||||
|
||||
scenario "create proposal button redirects to register path if user is not logged in" do
|
||||
process = create(:legislation_process, :in_proposals_phase)
|
||||
|
||||
visit legislation_process_proposals_path(process)
|
||||
click_link "Create a proposal"
|
||||
|
||||
expect(page).to have_current_path new_user_session_path
|
||||
expect(page).to have_content "You must sign in or register to continue"
|
||||
end
|
||||
|
||||
include_examples "not published permissions", :legislation_process_proposals_path
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user