Skip to content

Commit

Permalink
fix(admin): all procedures really filtered by tags
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux authored and kara22 committed Oct 14, 2024
1 parent 041e98f commit 5eaf103
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/controllers/administrateurs/procedures_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,17 +291,22 @@

it 'returns procedure who contains at least one tag included in params' do
get :all, params: { procedure_tag_names: ['environnement'] }
expect(assigns(:procedures).any? { |p| p.id == procedure.id }).to be_truthy
expect(assigns(:procedures).find { |p| p.id == procedure.id }).to be_present
end

it 'returns procedures who contains all tags included in params' do
get :all, params: { procedure_tag_names: ['environnement', 'diplomatie'] }
expect(assigns(:procedures).any? { |p| p.id == procedure.id }).to be_truthy
expect(assigns(:procedures).find { |p| p.id == procedure.id }).to be_present
end

it 'returns the procedure when at least one tag is include' do
get :all, params: { procedure_tag_names: ['environnement', 'diplomatie', 'football'] }
expect(assigns(:procedures).any? { |p| p.id == procedure.id }).to be_truthy
expect(assigns(:procedures).find { |p| p.id == procedure.id }).to be_present
end

it 'does not return procedure not having the queried tag' do
get :all, params: { procedure_tag_names: ['football'] }
expect(assigns(:procedures)).to be_empty
end
end

Expand Down

0 comments on commit 5eaf103

Please sign in to comment.