Class: Autotestforphp::Result
- Inherits:
-
Object
- Object
- Autotestforphp::Result
- Includes:
- REXML
- Defined in:
- lib/autotestforphp/result.rb
Instance Attribute Summary collapse
-
#num_assertions ⇒ Object
readonly
Returns the value of attribute num_assertions.
-
#num_errors ⇒ Object
readonly
Returns the value of attribute num_errors.
-
#num_failures ⇒ Object
readonly
Returns the value of attribute num_failures.
-
#num_tests ⇒ Object
readonly
Returns the value of attribute num_tests.
Class Method Summary collapse
Instance Method Summary collapse
- #image ⇒ Object
-
#initialize(num_tests, num_assertions, num_errors, num_failures) ⇒ Result
constructor
A new instance of Result.
- #message ⇒ Object
Constructor Details
#initialize(num_tests, num_assertions, num_errors, num_failures) ⇒ Result
Returns a new instance of Result.
10 11 12 13 14 15 |
# File 'lib/autotestforphp/result.rb', line 10 def initialize(num_tests, num_assertions, num_errors, num_failures) @num_tests = num_tests @num_assertions = num_assertions @num_errors = num_errors @num_failures = num_failures end |
Instance Attribute Details
#num_assertions ⇒ Object (readonly)
Returns the value of attribute num_assertions.
5 6 7 |
# File 'lib/autotestforphp/result.rb', line 5 def num_assertions @num_assertions end |
#num_errors ⇒ Object (readonly)
Returns the value of attribute num_errors.
5 6 7 |
# File 'lib/autotestforphp/result.rb', line 5 def num_errors @num_errors end |
#num_failures ⇒ Object (readonly)
Returns the value of attribute num_failures.
5 6 7 |
# File 'lib/autotestforphp/result.rb', line 5 def num_failures @num_failures end |
#num_tests ⇒ Object (readonly)
Returns the value of attribute num_tests.
5 6 7 |
# File 'lib/autotestforphp/result.rb', line 5 def num_tests @num_tests end |
Class Method Details
.build_from_xml(xml) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/autotestforphp/result.rb', line 30 def self.build_from_xml(xml) unless xml.is_a?(Document) xml = Document.new(xml) end results = XPath.first(xml, '//testsuite') num_tests = results.attributes["tests"].to_i num_failures = results.attributes["failures"].to_i num_errors = results.attributes["errors"].to_i num_assertions = results.attributes["assertions"].to_i new(num_tests, num_assertions, num_errors, num_failures) end |
Instance Method Details
#image ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/autotestforphp/result.rb', line 21 def image config = Autotestforphp::Notification::Config if num_failures == 0 and num_errors == 0 config.success_image else config.fail_image end end |
#message ⇒ Object
17 18 19 |
# File 'lib/autotestforphp/result.rb', line 17 def "#{num_tests} tests, #{num_assertions} assertions, #{num_failures} failures, #{num_errors} errors" end |