lib/stella/testplan.rb in stella-0.7.6.007 vs lib/stella/testplan.rb in stella-0.8.0.000
- old
+ new
@@ -36,10 +36,13 @@
field :usecases
field :description
#field :resources
+ # TODO: Add Stellar::TOKEN to the calculation
+ gibbler :id, :usecases, :description
+
def initialize(uris=[], opts={})
self.description = "Test plan"
@usecases = []
@testplan_current_ratio = 0
#@resources = {}
@@ -117,13 +120,11 @@
# for DSL use-only (otherwise use: self.description)
def desc(*args)
self.description = args.first unless args.empty?
self.description
end
-
-
-
+
def pretty(long=false)
str = []
dig = long ? self.digest_cache : self.digest_cache.shorter
str << " %-66s ".att(:reverse) % ["#{self.description} (#{dig})"]
@usecases.each_with_index do |uc,i|
@@ -284,10 +285,14 @@
@http_auth ||= Auth.new
@http_auth.user, @http_auth.pass, @http_auth.domain = user, pass, domain
end
def add_request(meth, *args, &blk)
- raise "'#{meth}' block given in #{self.plan_path} with no URI" if args[0].nil?
+ if args[0].nil?
+ msg = "No URI given for request ##{@requests.size} "
+ msg << "#{meth} block in #{self.plan_path}"
+ raise Stella::Error, msg
+ end
req = Stella::Data::HTTP::Request.new meth.to_s.upcase, args[0], &blk
req.description = args[1] if args.size > 1 # Description is optional
Stella.ld req
@requests << req
req