Class: Rutema::ActiveRecord::Run
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Rutema::ActiveRecord::Run
- Defined in:
- lib/rutema_web/activerecord/model.rb
Overview
Extensions of Rutema::ActiveRecord::Run to accomodate specific view requirements for rutema_web
Class Method Summary collapse
-
.find_on_page(page_num, page_size, conditions = nil) ⇒ Object
The view wants to display runs grouped into pages, where each page shows page_size runs at a time.
Instance Method Summary collapse
-
#config_file ⇒ Object
the number of the configuration file used to run the test.
-
#number_of_failed ⇒ Object
number of unsuccessful scenarios (does not count setup or teardown scripts).
-
#number_of_not_executed ⇒ Object
number of scenarios that did not run (does not count setup or teardown scripts).
-
#number_of_tests ⇒ Object
returns the number of actual tests (so, don’t take into account setup or teardown tests).
- #status ⇒ Object
Class Method Details
.find_on_page(page_num, page_size, conditions = nil) ⇒ Object
The view wants to display runs grouped into pages, where each page shows page_size runs at a time. This method returns the runs on page page_num (starting at zero).
14 15 16 17 18 19 20 |
# File 'lib/rutema_web/activerecord/model.rb', line 14 def self.find_on_page(page_num, page_size,conditions=nil) find(:all, :order => "id DESC", :limit => page_size, :conditions=>conditions, :offset => page_num*page_size) end |
Instance Method Details
#config_file ⇒ Object
the number of the configuration file used to run the test
52 53 54 55 |
# File 'lib/rutema_web/activerecord/model.rb', line 52 def config_file return nil if self.context.is_a?(OpenStruct) return context[:config_file] end |
#number_of_failed ⇒ Object
number of unsuccessful scenarios (does not count setup or teardown scripts)
38 39 40 41 |
# File 'lib/rutema_web/activerecord/model.rb', line 38 def number_of_failed #self.scenarios.select{|sc| !sc.success? && !sc.not_executed? && sc.is_test? }.size Rutema::ActiveRecord::Scenario.count(:conditions=>"run_id=#{self.id} AND status = 'error' AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'") end |
#number_of_not_executed ⇒ Object
number of scenarios that did not run (does not count setup or teardown scripts)
43 44 45 46 |
# File 'lib/rutema_web/activerecord/model.rb', line 43 def number_of_not_executed #self.scenarios.select{|sc| sc.not_executed? && sc.is_test? }.size Rutema::ActiveRecord::Scenario.count(:conditions=>"run_id=#{self.id} AND status = 'not_executed' AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'") end |
#number_of_tests ⇒ Object
returns the number of actual tests (so, don’t take into account setup or teardown tests)
48 49 50 |
# File 'lib/rutema_web/activerecord/model.rb', line 48 def number_of_tests Rutema::ActiveRecord::Scenario.count(:conditions=>"run_id=#{self.id} AND name NOT LIKE '%_teardown' AND name NOT LIKE '%_setup'") end |
#status ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rutema_web/activerecord/model.rb', line 22 def status st=:success st=:warning if scenarios.empty? self.scenarios.each do |sc| case sc.status when "warning" || "not_executed" st=:warning unless st==:error break when "error" st=:error break end end return st end |