spec/runner_spec.rb in thor-0.13.4 vs spec/runner_spec.rb in thor-0.13.5
- old
+ new
@@ -28,13 +28,12 @@
content = capture(:stdout){ Thor::Runner.start(["help", "my_counter"]) }
content.must =~ /my_counter N/
end
it "raises error if a class/task cannot be found" do
- Thor::Runner.should_receive(:exit).with(1)
content = capture(:stderr){ Thor::Runner.start(["help", "unknown"]) }
- content.strip.must == 'Could not find namespace or task "unknown".'
+ content.strip.must == 'Could not find task "unknown" in "default" namespace.'
end
end
describe "#start" do
it "invokes a task from Thor::Runner" do
@@ -66,14 +65,13 @@
ARGV.replace ["my_counter", "1", "2", "--third", "3"]
Thor::Runner.start.must == [1, 2, 3]
end
it "raises an error if class/task can't be found" do
- Thor::Runner.should_receive(:exit).with(1)
ARGV.replace ["unknown"]
content = capture(:stderr){ Thor::Runner.start }
- content.strip.must == 'Could not find namespace or task "unknown".'
+ content.strip.must == 'Could not find task "unknown" in "default" namespace.'
end
it "does not swallow NoMethodErrors that occur inside the called method" do
ARGV.replace ["my_script:call_unexistent_method"]
lambda { Thor::Runner.start }.must raise_error(NoMethodError)
@@ -143,15 +141,25 @@
capture(:stdout) { Thor::Runner.start }.must_not =~ /amazing:help/
end
it "presents tasks in the default namespace with an empty namespace" do
ARGV.replace ["list"]
- capture(:stdout) { Thor::Runner.start }.must =~ /^thor :test\s+# prints 'test'/m
+ capture(:stdout) { Thor::Runner.start }.must =~ /^thor :cow\s+# prints 'moo'/m
end
it "runs tasks with an empty namespace from the default namespace" do
- ARGV.replace [":test"]
- capture(:stdout) { Thor::Runner.start }.must == "test\n"
+ ARGV.replace [":task_conflict"]
+ capture(:stdout) { Thor::Runner.start }.must == "task\n"
+ end
+
+ it "runs groups even when there is a task with the same name" do
+ ARGV.replace ["task_conflict"]
+ capture(:stdout) { Thor::Runner.start }.must == "group\n"
+ end
+
+ it "runs tasks with no colon in the default namespace" do
+ ARGV.replace ["cow"]
+ capture(:stdout) { Thor::Runner.start }.must == "moo\n"
end
end
describe "uninstall" do
before(:each) do