Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apricot13 committed May 1, 2024
1 parent a8782da commit c9499e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/requests/api/get_taxonomies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
end

it 'can filter by directory' do
get "/api/v1/taxonomies?directory=#{directory_a.label}"
get "/api/v1/taxonomies?directory[]=#{directory_a.label}"
response_body = JSON.parse(response.body)

root_taxonomy_ids = response_body.map{|taxonomy| taxonomy["id"]}
expect(root_taxonomy_ids).to match_array([root_taxonomy.id])

get "/api/v1/taxonomies?directory=#{directory_b.label}"
get "/api/v1/taxonomies?directory[]=#{directory_b.label}"
response_body = JSON.parse(response.body)

root_taxonomy_ids = response_body.map{|taxonomy| taxonomy["id"]}
Expand All @@ -51,15 +51,15 @@
context 'filtering by an empty directory' do
let!(:directory_c) { FactoryBot.create(:directory, name: "Directory C", label: "c") }
it 'returns no results' do
get "/api/v1/taxonomies?directory=#{directory_c.label}"
get "/api/v1/taxonomies?directory[]=#{directory_c.label}"
response_body = JSON.parse(response.body)
expect(response_body).to match_array([])
end
end

context 'filtering by a directory that does not exist' do
it 'returns all results' do
get "/api/v1/taxonomies?directory=not-a-real-directory"
get "/api/v1/taxonomies?directory[]=not-a-real-directory"
response_body = JSON.parse(response.body)

root_taxonomy_ids = response_body.map{|taxonomy| taxonomy["id"]}
Expand Down

0 comments on commit c9499e2

Please sign in to comment.