-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Description This pull request changes the way the Engine is mounted, using an initializer or default settings. This will allow us to change the settings in case there's a conflict with the selected routing. ### Changes * Mount the engine dynamically * Reload routes for testing * Updated the documentation ### Ticket [CIOPS-1082](https://customink.atlassian.net/browse/CIOPS-1082)
- Loading branch information
Showing
8 changed files
with
43 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module IsItReady | ||
VERSION = '0.0.2' | ||
VERSION = '0.0.3' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Rails.application.routes.draw do | ||
|
||
mount IsItReady::Engine => "/is_it_ready" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'test_helper' | ||
|
||
module IsItReady | ||
class CustomNavigationTest < ActionDispatch::IntegrationTest | ||
include Engine.routes.url_helpers | ||
|
||
setup do | ||
::IsItReady.endpoint = '/something_else' | ||
Rails.application.reload_routes! | ||
end | ||
|
||
test('it returns the correct response status on the root') do | ||
get root_url | ||
|
||
assert_response :success | ||
end | ||
|
||
test('it returns the correct output on the root') do | ||
get root_url | ||
|
||
response = ::JSON.parse(@response.body, symbolize_names: true) | ||
|
||
assert_equal({ :status => "ok", :code => 200 }, response) | ||
end | ||
|
||
test('it returns the not found response status on the default path') do | ||
assert_raises(ActionController::RoutingError) { get DEFAULT_PATH } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters