Class: Jaribio::Record
- Inherits:
-
Object
- Object
- Jaribio::Record
- Defined in:
- lib/jaribio/record.rb
Constant Summary collapse
- PASS =
1- FAIL =
2
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#error ⇒ Object
Returns the value of attribute error.
-
#key ⇒ Object
Returns the value of attribute key.
-
#output ⇒ Object
Returns the value of attribute output.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(args = {}) ⇒ Record
constructor
A new instance of Record.
- #save(plans = []) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Record
12 13 14 15 16 17 18 |
# File 'lib/jaribio/record.rb', line 12 def initialize(args = {}) self.key = args[:key] self.description = args[:description] self.state = args[:state] self.error = args[:error] self.output = args[:output] || $stdout end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
10 11 12 |
# File 'lib/jaribio/record.rb', line 10 def description @description end |
#error ⇒ Object
Returns the value of attribute error.
10 11 12 |
# File 'lib/jaribio/record.rb', line 10 def error @error end |
#key ⇒ Object
Returns the value of attribute key.
10 11 12 |
# File 'lib/jaribio/record.rb', line 10 def key @key end |
#output ⇒ Object
Returns the value of attribute output.
10 11 12 |
# File 'lib/jaribio/record.rb', line 10 def output @output end |
#state ⇒ Object
Returns the value of attribute state.
10 11 12 |
# File 'lib/jaribio/record.rb', line 10 def state @state end |
Instance Method Details
#==(other) ⇒ Object
24 25 26 27 28 |
# File 'lib/jaribio/record.rb', line 24 def ==(other) (self.key == other.key and self.description == other.description and self.state == other.state) end |
#eql?(other) ⇒ Boolean
30 31 32 |
# File 'lib/jaribio/record.rb', line 30 def eql?(other) self == other end |
#failed? ⇒ Boolean
20 21 22 |
# File 'lib/jaribio/record.rb', line 20 def failed? self.state != PASS end |
#save(plans = []) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/jaribio/record.rb', line 34 def save(plans = []) begin test_case = Jaribio::TestCase.find(CGI::escape(self.key)) rescue ActiveResource::ResourceNotFound output.puts "# Test case #{self.key} not found" return end if (test_case.nil?) output.puts "# Test case #{self.key} not found" return end return unless test_case.attributes.has_key?(:plans) plan_ids = Hash[ test_case.plans.map { |x| [x.id, 1] } ] # Configured plans in this block plans.each do |plan| # verify test case is part of this plan next unless plan_ids.has_key?(plan.id) # create execution create_execution(test_case, plan) end # No configured plans, try to update any open plan for each test case if (plans.size == 0) test_case.plans.each do |plan| create_execution(test_case, plan) end end end |