tests
This commit is contained in:
parent
cb0417aad4
commit
4ea7bb2f1c
1 changed files with 14 additions and 4 deletions
|
@ -176,11 +176,21 @@ describe Administrateurs::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'with specific tag' do
|
||||
let!(:tag_procedure) { create(:procedure, :published, tags: ['environnement']) }
|
||||
let!(:tags_procedure) { create(:procedure, :published, tags: ['environnement', 'diplomatie']) }
|
||||
|
||||
it 'returns procedures with specific tag' do
|
||||
get :all, params: { tag: 'environnement' }
|
||||
expect(assigns(:procedures).any? { |p| p.id == tag_procedure.id }).to be_truthy
|
||||
it 'returns procedure who contains at least one tag included in params' do
|
||||
get :all, params: { tags: ['environnement'] }
|
||||
expect(assigns(:procedures).any? { |p| p.id == tags_procedure.id }).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns procedures who contains all tags included in params' do
|
||||
get :all, params: { tags: ['environnement', 'diplomatie'] }
|
||||
expect(assigns(:procedures).any? { |p| p.id == tags_procedure.id }).to be_truthy
|
||||
end
|
||||
|
||||
it 'does not returns the procedure' do
|
||||
get :all, params: { tags: ['environnement', 'diplomatie', 'football'] }
|
||||
expect(assigns(:procedures).any? { |p| p.id == tags_procedure.id }).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue