force user login on commentaire

This commit is contained in:
Tanguy PATTE 2015-09-24 10:34:01 +02:00
parent 6eeac88c95
commit a91380182d
2 changed files with 3 additions and 2 deletions

View file

@ -1,3 +1,3 @@
class Users::CommentairesController < CommentairesController
before_action :authenticate_user!
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Users::CommentairesController, type: :controller do
let(:dossier) { create(:dossier) }
let(:dossier) { create(:dossier, :with_user) }
let(:dossier_id) { dossier.id }
let(:email_commentaire) { 'test@test.com' }
let(:texte_commentaire) { 'Commentaire de test' }
@ -9,6 +9,7 @@ describe Users::CommentairesController, type: :controller do
describe '#POST create' do
context 'création correct d\'un commentaire' do
it 'depuis la page récapitulatif' do
sign_in dossier.user
post :create, dossier_id: dossier_id, email_commentaire: email_commentaire, texte_commentaire: texte_commentaire
expect(response).to redirect_to("/users/dossiers/#{dossier_id}/recapitulatif")
end