Skip to content
Browse files

Added a test for the package_name

  • Loading branch information...
1 parent 2474676 commit 97efbf6a14b44061eddb85757a5f8553804f0606 @amanelis amanelis committed with sferik
Showing with 15 additions and 2 deletions.
  1. +2 −2 spec/base_spec.rb
  2. +13 −0 spec/thor_spec.rb
View
4 spec/base_spec.rb
@@ -193,8 +193,8 @@ def hello
thorfile = File.join(File.dirname(__FILE__), "fixtures", "script.thor")
expect(Thor::Base.subclass_files[File.expand_path(thorfile)]).to eq([
MyScript, MyScript::AnotherScript, MyChildScript, Barn,
- Scripts::MyScript, Scripts::MyDefaults, Scripts::ChildDefault,
- Scripts::Arities
+ PackageNameScript, Scripts::MyScript, Scripts::MyDefaults,
+ Scripts::ChildDefault, Scripts::Arities
])
end
View
13 spec/thor_spec.rb
@@ -170,6 +170,19 @@ def boring(*args)
end
end
+ describe "#package_name" do
+ it "provides a proper description for a command when the package_name is assigned" do
+ content = capture(:stdout) { PackageNameScript.start(["help"]) }
+ expect(content).to match(/Baboon commands:/m)
+ end
+
+ # TODO: remove this, might be redundant, just wanted to prove full coverage
+ it "provides a proper description for a command when the package_name is NOT assigned" do
+ content = capture(:stdout) { MyScript.start(["help"]) }
+ expect(content).to match(/Commands:/m)
+ end
+ end
+
describe "#desc" do
it "provides description for a command" do
content = capture(:stdout) { MyScript.start(["help"]) }

0 comments on commit 97efbf6

Please sign in to comment.
Something went wrong with that request. Please try again.