Class: Webspicy::Tester::Result
- Inherits:
-
Object
- Object
- Webspicy::Tester::Result
- Extended by:
- Forwardable
- Defined in:
- lib/webspicy/tester/result.rb,
lib/webspicy/tester/result/check.rb,
lib/webspicy/tester/result/assert_met.rb,
lib/webspicy/tester/result/errcondition_met.rb,
lib/webspicy/tester/result/error_schema_met.rb,
lib/webspicy/tester/result/output_schema_met.rb,
lib/webspicy/tester/result/postcondition_met.rb,
lib/webspicy/tester/result/response_header_met.rb,
lib/webspicy/tester/result/response_status_met.rb,
lib/webspicy/tester/result/invocation_succeeded.rb
Defined Under Namespace
Classes: AssertMet, Check, ErrconditionMet, ErrorSchemaMet, InvocationSuceeded, OutputSchemaMet, PostconditionMet, ResponseHeaderMet, ResponseStatusMet
Instance Attribute Summary collapse
-
#assertions ⇒ Object
readonly
Returns the value of attribute assertions.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#invocation ⇒ Object
readonly
Returns the value of attribute invocation.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#specification ⇒ Object
readonly
Returns the value of attribute specification.
-
#test_case ⇒ Object
readonly
Returns the value of attribute test_case.
-
#tester ⇒ Object
readonly
Returns the value of attribute tester.
Class Method Summary collapse
Instance Method Summary collapse
- #assertions_count ⇒ Object
- #error? ⇒ Boolean
- #errors_count ⇒ Object
- #failure? ⇒ Boolean
- #failures_count ⇒ Object
-
#initialize(tester) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(tester) ⇒ Result
Returns a new instance of Result.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/webspicy/tester/result.rb', line 6 def initialize(tester) @tester = tester @scope = tester.scope @client = tester.client @specification = tester.specification @service = tester.service @test_case = tester.test_case @invocation = tester.invocation @assertions = [] @failures = [] @errors = [] if @invocation check! else @errors << [InvocationSuceeded.new(self), tester.invocation_error] reporter.check_error(*errors.first) end end |
Instance Attribute Details
#assertions ⇒ Object (readonly)
Returns the value of attribute assertions.
26 27 28 |
# File 'lib/webspicy/tester/result.rb', line 26 def assertions @assertions end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
24 25 26 |
# File 'lib/webspicy/tester/result.rb', line 24 def client @client end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
26 27 28 |
# File 'lib/webspicy/tester/result.rb', line 26 def errors @errors end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
26 27 28 |
# File 'lib/webspicy/tester/result.rb', line 26 def failures @failures end |
#invocation ⇒ Object (readonly)
Returns the value of attribute invocation.
25 26 27 |
# File 'lib/webspicy/tester/result.rb', line 25 def invocation @invocation end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
24 25 26 |
# File 'lib/webspicy/tester/result.rb', line 24 def scope @scope end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
25 26 27 |
# File 'lib/webspicy/tester/result.rb', line 25 def service @service end |
#specification ⇒ Object (readonly)
Returns the value of attribute specification.
25 26 27 |
# File 'lib/webspicy/tester/result.rb', line 25 def specification @specification end |
#test_case ⇒ Object (readonly)
Returns the value of attribute test_case.
25 26 27 |
# File 'lib/webspicy/tester/result.rb', line 25 def test_case @test_case end |
#tester ⇒ Object (readonly)
Returns the value of attribute tester.
24 25 26 |
# File 'lib/webspicy/tester/result.rb', line 24 def tester @tester end |
Class Method Details
.from(tester) ⇒ Object
33 34 35 |
# File 'lib/webspicy/tester/result.rb', line 33 def self.from(tester) new(tester) end |
Instance Method Details
#assertions_count ⇒ Object
49 50 51 |
# File 'lib/webspicy/tester/result.rb', line 49 def assertions_count assertions.size end |
#error? ⇒ Boolean
45 46 47 |
# File 'lib/webspicy/tester/result.rb', line 45 def error? !errors.empty? end |
#errors_count ⇒ Object
57 58 59 |
# File 'lib/webspicy/tester/result.rb', line 57 def errors_count errors.size end |
#failure? ⇒ Boolean
41 42 43 |
# File 'lib/webspicy/tester/result.rb', line 41 def failure? errors.empty? && !failures.empty? end |
#failures_count ⇒ Object
53 54 55 |
# File 'lib/webspicy/tester/result.rb', line 53 def failures_count failures.size end |
#success? ⇒ Boolean
37 38 39 |
# File 'lib/webspicy/tester/result.rb', line 37 def success? failures.empty? && errors.empty? end |