Fix DEPRECATION WARNING for spec/controllers/*.rb
This commit is contained in:
parent
d9a5eff21d
commit
430d32dfca
4 changed files with 11 additions and 10 deletions
|
@ -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
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue