lib/unencumbered.rb in unencumbered-0.1.0 vs lib/unencumbered.rb in unencumbered-0.1.1
- old
+ new
@@ -1,40 +1,24 @@
module Spec::DSL::Main
- alias :Feature :describe
- def Story(description)
+ alias_method :Feature, :describe
+ def narrative(description)
@description_args.push("\n#{description}\n")
end
end
module Spec::Example::ExampleGroupMethods
- def Scenario(description, &blk)
- describe("Scenario: #{description}", &blk)
+ def Scenario(description, &implementation)
+ describe("Scenario: #{description}", &implementation)
end
- def Given(description, &blk)
- describe("Given #{description}", &blk)
+ def executes(scope=:all, &implementation)
+ before(scope, &implementation)
end
- def When(description, &blk)
- describe("When #{description}", &blk)
- end
-
- def Then(description, &blk)
- example("Then #{description}", &blk)
- end
-
- def And(description, &blk)
- example("And #{description}", &blk)
- end
-
- def But(description, &blk)
- example("But #{description}", &blk)
- end
-
- def executes(scope=:all, &blk)
- before(scope, &blk)
- end
-
- def Background(description, &blk)
- describe("Background #{description}", &blk)
+ def method_missing(symbol,*args,&block)
+ if symbol.to_s =~ /Given|When|Background/
+ describe("#{symbol} #{args.first}", &block)
+ elsif symbol.to_s =~ /Then|And|But/
+ example("#{symbol} #{args.first}", &block)
+ end
end
end