Fix DEPRECATION WARNING for spec/controllers/*.rb

This commit is contained in:
Xavier J 2016-11-15 04:24:09 +01:00
parent d9a5eff21d
commit 430d32dfca
4 changed files with 11 additions and 10 deletions

View file

@ -5,6 +5,7 @@ describe APIController, type: :controller do
def show
render json: {}, satus: 200
end
def index
render json: {}, satus: 200
end
@ -13,17 +14,17 @@ describe APIController, type: :controller do
describe 'GET index' do
context 'when token is missing' do
subject { get :index }
it { expect(subject.status).to eq(401) }
it { expect(subject.status).to eq(401) }
end
context 'when token does not exist' do
let(:token) { 'invalid_token' }
subject { get :index, token: token }
it { expect(subject.status).to eq(401) }
subject { get :index, params: {token: token} }
it { expect(subject.status).to eq(401) }
end
context 'when token exist' do
let(:administrateur) { create(:administrateur) }
subject { get :index, token: administrateur.api_token }
it { expect(subject.status).to eq(200) }
subject { get :index, params: {token: administrateur.api_token} }
it { expect(subject.status).to eq(200) }
end
end
end

View file

@ -11,7 +11,7 @@ describe InvitesController, type: :controller do
sign_in create(:gestionnaire)
end
subject { post :create, dossier_id: dossier.id, email: email }
subject { post :create, params: {dossier_id: dossier.id, email: email} }
it { expect { subject }.to change(InviteGestionnaire, :count).by(1) }

View file

@ -1,6 +1,6 @@
shared_examples 'current_user_dossier_spec' do
context 'when no dossier_id is filled' do
it { expect { subject.current_user_dossier }.to raise_error }
it { expect { subject.current_user_dossier }.to raise_error ActiveRecord::RecordNotFound }
end
context 'when dossier_id is given as a param' do
@ -11,7 +11,7 @@ shared_examples 'current_user_dossier_spec' do
end
context 'when dossier id is incorrect' do
it { expect { subject.current_user_dossier 1 }.to raise_error }
it { expect { subject.current_user_dossier 1 }.to raise_error ActiveRecord::RecordNotFound }
end
end
@ -27,7 +27,7 @@ shared_examples 'current_user_dossier_spec' do
end
context 'when dossier id is incorrect' do
it { expect { subject.current_user_dossier }.to raise_error }
it { expect { subject.current_user_dossier }.to raise_error ActiveRecord::RecordNotFound }
end
context 'when dossier_id is given as a param' do

View file

@ -1,6 +1,6 @@
require 'spec_helper'
require 'controllers/user_controller_shared_example'
require 'controllers/users_controller_shared_example'
describe UsersController, type: :controller do
describe '#current_user_dossier' do