Skip to content

Commit

Permalink
Redo the specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Haerezis committed Feb 1, 2025
1 parent 218b662 commit 7f7e044
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 121 deletions.
121 changes: 0 additions & 121 deletions spec/grape/api/setup_set_vs_array_spec.rb

This file was deleted.

60 changes: 60 additions & 0 deletions spec/grape/api_remount_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -505,5 +505,65 @@ def printed_response
end
end
end

context 'with settings on defined routes' do
before do
a_remounted_api.desc 'Identical description'
a_remounted_api.route_setting :custom, key: 'value'
a_remounted_api.route_setting :custom_diff, key: 'foo'
a_remounted_api.get '/api1' do
status 200
end

a_remounted_api.desc 'Identical description'
a_remounted_api.route_setting :custom, key: 'value'
a_remounted_api.route_setting :custom_diff, key: 'bar'
a_remounted_api.get '/api2' do
status 200
end
end

it 'has all the settings for both routes' do
expect(a_remounted_api.routes.count).to be(2)
expect(a_remounted_api.routes[0].settings).to include(
{
description: { description: 'Identical description' },
custom: { key: 'value' },
custom_diff: { key: 'foo' }
}
)
expect(a_remounted_api.routes[1].settings).to include(
{
description: { description: 'Identical description' },
custom: { key: 'value' },
custom_diff: { key: 'bar' }
}
)
end

context 'when mounting it' do
before do
root_api.mount a_remounted_api
end

it 'still has all the settings for both routes, even after mount' do
expect(root_api.routes.count).to be(2)
expect(root_api.routes[0].settings).to include(
{
description: { description: 'Identical description' },
custom: { key: 'value' },
custom_diff: { key: 'foo' }
}
)
expect(root_api.routes[1].settings).to include(
{
description: { description: 'Identical description' },
custom: { key: 'value' },
custom_diff: { key: 'bar' }
}
)
end
end
end
end
end

0 comments on commit 7f7e044

Please sign in to comment.