Skip to content

Commit

Permalink
Added a test for the package_name
Browse files Browse the repository at this point in the history
  • Loading branch information
amanelis authored and sferik committed Mar 19, 2013
1 parent 2474676 commit 97efbf6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/base_spec.rb
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions spec/thor_spec.rb
Expand Up @@ -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"]) }
Expand Down

0 comments on commit 97efbf6

Please sign in to comment.