Class: IssueMonitor
- Inherits:
-
Object
- Object
- IssueMonitor
- Defined in:
- lib/ci_helper/issue_monitor.rb
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#ci_procedure ⇒ Object
readonly
Returns the value of attribute ci_procedure.
-
#fail_examples ⇒ Object
readonly
Returns the value of attribute fail_examples.
-
#issue_status ⇒ Object
Returns the value of attribute issue_status.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #content ⇒ Object
- #failures_each ⇒ Object
- #finish_test? ⇒ Boolean
- #goto_monitor_page ⇒ Object
-
#initialize(account, password, match_strategy) ⇒ IssueMonitor
constructor
A new instance of IssueMonitor.
- #success? ⇒ Boolean
Constructor Details
#initialize(account, password, match_strategy) ⇒ IssueMonitor
Returns a new instance of IssueMonitor.
10 11 12 |
# File 'lib/ci_helper/issue_monitor.rb', line 10 def initialize(account, password, match_strategy) @ci_procedure = CiProcedure.new(account, password, match_strategy) end |
Instance Attribute Details
#ci_procedure ⇒ Object (readonly)
Returns the value of attribute ci_procedure.
4 5 6 |
# File 'lib/ci_helper/issue_monitor.rb', line 4 def ci_procedure @ci_procedure end |
#fail_examples ⇒ Object (readonly)
Returns the value of attribute fail_examples.
4 5 6 |
# File 'lib/ci_helper/issue_monitor.rb', line 4 def fail_examples @fail_examples end |
#issue_status ⇒ Object
Returns the value of attribute issue_status.
3 4 5 |
# File 'lib/ci_helper/issue_monitor.rb', line 3 def issue_status @issue_status end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/ci_helper/issue_monitor.rb', line 4 def result @result end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/ci_helper/issue_monitor.rb', line 4 def status @status end |
Instance Method Details
#content ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/ci_helper/issue_monitor.rb', line 46 def content Result.new(success?, fail_examples, "#{ci_procedure.console_page.uri.host}/#{ci_procedure.console_page.uri.request_uri}", ci_procedure.issue_number, ci_procedure.branch_name, ci_procedure.commit_hash) end |
#failures_each ⇒ Object
42 43 44 |
# File 'lib/ci_helper/issue_monitor.rb', line 42 def failures_each fail_examples.each { |failed_example| yield(failed_example) } end |
#finish_test? ⇒ Boolean
32 33 34 35 36 37 38 39 40 |
# File 'lib/ci_helper/issue_monitor.rb', line 32 def finish_test? begin output = ci_procedure.re_get_console_output output.empty? ? false : true rescue CiHelper::Exceptions::IssueNotFound => e puts "#{e.message} #{ci_procedure.matching_strategy}" false end end |
#goto_monitor_page ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ci_helper/issue_monitor.rb', line 14 def goto_monitor_page begin ci_procedure.run if finish_test? parse_output(ci_procedure.get_console_output) end true rescue CiHelper::Exceptions::IssueNotFound => e puts "#{e.message} #{ci_procedure.matching_strategy}" false end end |
#success? ⇒ Boolean
27 28 29 30 |
# File 'lib/ci_helper/issue_monitor.rb', line 27 def success? parse_output(ci_procedure.get_console_output) finish_test? ? status[0].match('success') : false end |