Class Stella::Usecase

  1. lib/stella/testplan.rb
Parent: Storable

Methods

public class

  1. checkup
  2. from_hash
  3. inherited
  4. names
  5. new

public instance

  1. freeze
  2. id
  3. postprocess
  4. preprocess
  5. ucid

Included modules

  1. Gibbler::Complex

Classes and Modules

Module Stella::Usecase::ClassMethods

Attributes

instance [RW]
registered_classes [R] The class syntax uses the session method defined in ClassMethods. This is here for autogenerated usecases and ones loaded from JSON.
session [R] The class syntax uses the session method defined in ClassMethods. This is here for autogenerated usecases and ones loaded from JSON.
testplan [RW]

Public class methods

checkup (base_uri, opts={})
[show source]
# File lib/stella/testplan.rb, line 254
      def checkup base_uri, opts={}
        (opts[:usecases] ||= []) << self
        testplan.checkup base_uri, opts
      end
from_hash (*args)
[show source]
# File lib/stella/testplan.rb, line 249
      def from_hash(*args)
        me = super(*args)
        me.requests.collect! { |req| Stella::RequestTemplate.from_hash(req) }
        me
      end
inherited (obj)
[show source]
# File lib/stella/testplan.rb, line 265
      def inherited(obj)
        super
        planclass, ucname = *obj.names
        planclass.extend Stella::Testplan::ClassMethods
        unless Stella::Testplan.plan? planclass
          Stella::Testplan.plan(planclass, planclass.new)
          Stella::Testplan.plan(planclass).desc = planclass
        end
        
        obj.instance = obj.new
        obj.testplan = Stella::Testplan.plan(planclass)
        Stella::Testplan.plan(planclass).usecases << obj.instance
        Stella::Testplan.plan(planclass).usecases.last.desc = ucname
        obj.extend ClassMethods
      end
names ()
[show source]
# File lib/stella/testplan.rb, line 258
      def names
        names = self.to_s.split('::')
        planname, ucname = case names.size
        when 1 then ['DefaultTestplan', names.last]
        else        [names[0..-2].join('::'), names[-1]] end
        [eval(planname), ucname.to_sym]
      end
new (req=nil)
[show source]
# File lib/stella/testplan.rb, line 181
    def initialize(req=nil)
      preprocess
      @requests << req if req
    end

Public instance methods

freeze ()
[show source]
# File lib/stella/testplan.rb, line 196
    def freeze
      return if frozen?
      @requests.each { |r| r.freeze }
      @id &&= Gibbler::Digest.new(@id || self.digest)
      super
      self
    end
id ()
[show source]
# File lib/stella/testplan.rb, line 185
    def id 
      @id ||= gibbler
      @id
    end
postprocess ()
[show source]
# File lib/stella/testplan.rb, line 193
    def postprocess
      @id &&= Gibbler::Digest.new(@id)
    end
preprocess ()
[show source]
# File lib/stella/testplan.rb, line 190
    def preprocess
      @requests ||= []
    end
ucid ()

Alias for id