-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing specs for the routes management command
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require "./spec_helper" | ||
|
||
describe Marten::CLI::Manage::Command::Routes do | ||
describe "#run" do | ||
it "displays top-level routes as expected" do | ||
stdout = IO::Memory.new | ||
stderr = IO::Memory.new | ||
|
||
command = Marten::CLI::Manage::Command::Routes.new( | ||
options: [] of String, | ||
stdout: stdout, | ||
stderr: stderr | ||
) | ||
|
||
command.run | ||
|
||
output = stdout.rewind.gets_to_end | ||
output.includes?("/dummy/<id:int>/and/<scope:slug>").should be_true | ||
output.includes?("[dummy_with_id_and_scope]").should be_true | ||
end | ||
|
||
it "displays nested routes involving a single namespace as expected" do | ||
stdout = IO::Memory.new | ||
stderr = IO::Memory.new | ||
|
||
command = Marten::CLI::Manage::Command::Routes.new( | ||
options: [] of String, | ||
stdout: stdout, | ||
stderr: stderr | ||
) | ||
|
||
command.run | ||
|
||
output = stdout.rewind.gets_to_end | ||
output.includes?("/nested-1/dummy/<id:int>").should be_true | ||
output.includes?("[nested_1:dummy_with_id]").should be_true | ||
end | ||
|
||
it "displays nested routes involving multiple namespaces as expected" do | ||
stdout = IO::Memory.new | ||
stderr = IO::Memory.new | ||
|
||
command = Marten::CLI::Manage::Command::Routes.new( | ||
options: [] of String, | ||
stdout: stdout, | ||
stderr: stderr | ||
) | ||
|
||
command.run | ||
|
||
output = stdout.rewind.gets_to_end | ||
output.includes?("/nested-1/nested-2/dummy/<id:int>").should be_true | ||
output.includes?("[nested_1:nested_2:dummy_with_id]").should be_true | ||
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