Class: Moto::Test

Inherits:
Object
  • Object
show all
Includes:
Assert
Defined in:
lib/test.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Assert

#assert, #assert_equal

Constructor Details

#initializeTest

Returns a new instance of Test.



25
26
27
28
# File 'lib/test.rb', line 25

def initialize
  # @context = context
  @result = Moto::Result::PENDING
end

Class Attribute Details

._pathObject

Returns the value of attribute _path.



14
15
16
# File 'lib/test.rb', line 14

def _path
  @_path
end

Instance Attribute Details

#context=(value) ⇒ Object (writeonly)

Sets the attribute context

Parameters:

  • value

    the value to set the attribute context to.



6
7
8
# File 'lib/test.rb', line 6

def context=(value)
  @context = value
end

#envObject (readonly)

Returns the value of attribute env.



9
10
11
# File 'lib/test.rb', line 9

def env
  @env
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/test.rb', line 8

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



10
11
12
# File 'lib/test.rb', line 10

def params
  @params
end

#resultObject

Returns the value of attribute result.



7
8
9
# File 'lib/test.rb', line 7

def result
  @result
end

#static_path=(value) ⇒ Object (writeonly)

Sets the attribute static_path

Parameters:

  • value

    the value to set the attribute static_path to.



11
12
13
# File 'lib/test.rb', line 11

def static_path=(value)
  @static_path = value
end

Class Method Details

.inherited(k) ⇒ Object



17
18
19
# File 'lib/test.rb', line 17

def self.inherited(k)
  k._path = caller.first.match( /(.+):\d+:in/ )[1]
end

Instance Method Details

#afterObject



69
70
71
# File 'lib/test.rb', line 69

def after
  # abstract
end

#beforeObject



65
66
67
# File 'lib/test.rb', line 65

def before
  # abstract
end

#client(name) ⇒ Object



73
74
75
# File 'lib/test.rb', line 73

def client(name)
  @context.client(name)
end

#const(key) ⇒ Object



57
58
59
# File 'lib/test.rb', line 57

def const(key)
  @context.const(key)
end

#dirObject



46
47
48
49
50
# File 'lib/test.rb', line 46

def dir
  # puts self.class.path
  return File.dirname(@static_path) unless @static_path.nil?
  File.dirname(self.path)
end

#filenameObject



52
53
54
55
# File 'lib/test.rb', line 52

def filename
  return File.basename(@static_path, ".*") unless @static_path.nil?
  File.basename(path, ".*")
end

#init(env, params) ⇒ Object



30
31
32
33
34
# File 'lib/test.rb', line 30

def init(env, params)
  @env = env
  @params = params
  set_name
end

#loggerObject



36
37
38
# File 'lib/test.rb', line 36

def logger
  @context.logger
end

#pathObject



21
22
23
# File 'lib/test.rb', line 21

def path
  self.class._path
end

#runObject



61
62
63
# File 'lib/test.rb', line 61

def run
  # abstract
end

#set_nameObject



40
41
42
43
44
# File 'lib/test.rb', line 40

def set_name
  return @name = "#{self.class.to_s}/#{@env}" if @params.empty?
  return @name = "#{self.class.to_s}/#{@env}/#{@params[:__name]}" if @params.key?(:__name)
  @name = self.class.to_s
end