Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test around perform

Ensuring that both the action del and method definition are valid
  • Loading branch information...
commit 24243a1959faaef2a2d93c762a6a39dd9e481584 1 parent 20dde0b
Keith Gaddis authored
Showing with 30 additions and 6 deletions.
  1. +30 −6 spec/imperator/command_spec.rb
View
36 spec/imperator/command_spec.rb
@@ -3,15 +3,39 @@
describe "#perform" do
class CommandTestException < Exception; end
- class TestCommand < Imperator::Command
- action do
- raise CommandTestException.new
+ context "using DSL " do
+ class DSLTestCommand < Imperator::Command
+ action do
+ raise CommandTestException.new
+ end
+ end
+
+ let(:command){DSLTestCommand.new}
+ it "runs the action block when #perform is called" do
+ lambda{command.perform}.should raise_exception(CommandTestException)
end
end
- let(:command){TestCommand.new}
- it "runs the action block when #perform is called" do
- lambda{command.perform}.should raise_exception(CommandTestException)
+ context "using method definition" do
+ class MethodTestCommand < Imperator::Command
+ def action
+ raise CommandTestException.new
+ end
+ end
+ let(:command){MethodTestCommand.new}
+ it "runs the action method when #perform is called" do
+ lambda{command.perform}.should raise_exception(CommandTestException)
+ end
+ end
+ end
+
+ describe "actions" do
+ context "using DSL" do
+ class ActionDSLExampleCommand < Imperator::Command
+ action do
+
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.