Class: Testcase

Inherits:
Object
  • Object
show all
Defined in:
lib/testcase.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw, substitution) ⇒ Testcase

Returns a new instance of Testcase.



7
8
9
10
11
12
13
14
# File 'lib/testcase.rb', line 7

def initialize(raw, substitution)
  @raw = raw
  @name = raw['name']
  @request = @raw['request']
  @response_expectation = @raw['response_expectation']
  @wait_before_request = @raw['wait_before_request'].nil? ? 0 : @raw['wait_before_request']
  create_resource_substitutes(substitution)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/testcase.rb', line 4

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



4
5
6
# File 'lib/testcase.rb', line 4

def raw
  @raw
end

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/testcase.rb', line 4

def request
  @request
end

#response_expectationObject (readonly)

Returns the value of attribute response_expectation.



4
5
6
# File 'lib/testcase.rb', line 4

def response_expectation
  @response_expectation
end

#wait_before_requestObject (readonly)

Returns the value of attribute wait_before_request.



4
5
6
# File 'lib/testcase.rb', line 4

def wait_before_request
  @wait_before_request
end

Class Method Details

.expand_specs(specs, configuration) ⇒ Object

creates an array of spec hashes by calling priorize, partition and explode_iterations to prepare the specs, automagically create the ierting ones and partition them



18
19
20
21
# File 'lib/testcase.rb', line 18

def self.expand_specs(specs, configuration)
  @@configuration = configuration
  objectize(partition(explode_iterations(priorize(specs))))
end

Instance Method Details

#unique_identifierObject

returns an identifier of that testcase that should be unique



24
25
26
# File 'lib/testcase.rb', line 24

def unique_identifier
 Digest::MD5.hexdigest(@name.to_s)[0..9]
end