redirect to frendly url for debates and proposals if needed
This commit is contained in:
24
spec/controllers/proposals_controller_spec.rb
Normal file
24
spec/controllers/proposals_controller_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe ProposalsController do
|
||||
|
||||
describe "GET show" do
|
||||
|
||||
let(:proposal) { create :proposal }
|
||||
|
||||
context "when path matches" do
|
||||
it "should not redirect to real path" do
|
||||
get :show, id: proposal.id
|
||||
expect(response).to_not redirect_to proposals_path(proposal)
|
||||
end
|
||||
end
|
||||
|
||||
context "when path does not match" do
|
||||
it "should redirect to real path" do
|
||||
expect(request).to receive(:path).exactly(3).times.and_return "/#{proposal.id}-something-else"
|
||||
get :show, id: proposal.id
|
||||
expect(response).to redirect_to proposal_path(proposal)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user