Class: Jaribio::RSpecFormatter
- Inherits:
-
Object
- Object
- Jaribio::RSpecFormatter
- Defined in:
- lib/jaribio/rspec_formatter.rb
Instance Attribute Summary collapse
-
#example_group ⇒ Object
readonly
Returns the value of attribute example_group.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#close ⇒ Object
Update Jaribio - configured to update pass/fail? - configured to output a report (for the purpose of updating your specs) - configured to generate plan/suite/test case?.
- #dump_failures ⇒ Object
- #dump_pending ⇒ Object
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
-
#example_failed(example) ⇒ Object
Mark example as failed via unique key.
- #example_group_finished(example_group) ⇒ Object
- #example_group_started(example_group) ⇒ Object
-
#example_passed(example) ⇒ Object
Mark example as passed via unique key.
- #example_pending(example) ⇒ Object
- #example_started(example) ⇒ Object
-
#initialize(output) ⇒ RSpecFormatter
constructor
A new instance of RSpecFormatter.
- #message(message) ⇒ Object
-
#seed(seed) ⇒ Object
no-op.
- #start(example_count) ⇒ Object
- #start_dump ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(output) ⇒ RSpecFormatter
Returns a new instance of RSpecFormatter.
12 13 14 15 |
# File 'lib/jaribio/rspec_formatter.rb', line 12 def initialize(output) @output = output || StringIO.new @results = {} end |
Instance Attribute Details
#example_group ⇒ Object (readonly)
Returns the value of attribute example_group.
10 11 12 |
# File 'lib/jaribio/rspec_formatter.rb', line 10 def example_group @example_group end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/jaribio/rspec_formatter.rb', line 10 def output @output end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
10 11 12 |
# File 'lib/jaribio/rspec_formatter.rb', line 10 def results @results end |
Instance Method Details
#close ⇒ Object
Update Jaribio
-
configured to update pass/fail?
-
configured to output a report (for the purpose of updating your specs)
-
configured to generate plan/suite/test case?
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/jaribio/rspec_formatter.rb', line 82 def close() Jaribio::RemoteObject.configure(configuration) # create missing test cases, the new test cases are not automatically # added to any plan if RSpec.configuration.jaribio_auto_create results.values.each do |record| begin test_case = Jaribio::TestCase.find(CGI::escape(record.key)) rescue ActiveResource::ResourceNotFound end if (test_case.nil?) test_case = Jaribio::TestCase.new( :name => record.description, :unique_key => record.key, :automated => true ) begin test_case.save output.puts "# Created test case with unique key #{record.key}" rescue Exception => e output.puts "# Error creating test case #{record.key}: #{e.}" output.puts e.backtrace end end end end plans = [] # create executions for specific plans only if RSpec.configuration.jaribio_plans.size > 0 RSpec.configuration.jaribio_plans.each do |plan_id| begin plan = Jaribio::Plan.find(plan_id) if plan.open? plans << plan else output.puts "# RSpec configuration includes closed plan #{plan_id}" end rescue ActiveResource::ResourceNotFound output.puts "# RSpec configuration of jaribio_plans includes unknown plan_id #{plan_id}" end end end results.each_value do |record| record.save(plans) end end |
#dump_failures ⇒ Object
59 60 |
# File 'lib/jaribio/rspec_formatter.rb', line 59 def dump_failures() end |
#dump_pending ⇒ Object
56 57 |
# File 'lib/jaribio/rspec_formatter.rb', line 56 def dump_pending() end |
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/jaribio/rspec_formatter.rb', line 62 def dump_summary(duration, example_count, failure_count, pending_count) output.puts "1..#{results.size}" results.each_with_index do |data, index| result = data[1] status = (result.failed?) ? "not ok" : "ok" count = index + 1 output.puts "#{status} #{count} - (#{result.key}) #{result.description}" end end |
#example_failed(example) ⇒ Object
Mark example as failed via unique key
43 44 45 |
# File 'lib/jaribio/rspec_formatter.rb', line 43 def example_failed(example) record_result(example, true) end |
#example_group_finished(example_group) ⇒ Object
24 25 |
# File 'lib/jaribio/rspec_formatter.rb', line 24 def example_group_finished(example_group) end |
#example_group_started(example_group) ⇒ Object
20 21 22 |
# File 'lib/jaribio/rspec_formatter.rb', line 20 def example_group_started(example_group) @example_group = example_group end |
#example_passed(example) ⇒ Object
Mark example as passed via unique key
33 34 35 |
# File 'lib/jaribio/rspec_formatter.rb', line 33 def example_passed(example) record_result(example) end |
#example_pending(example) ⇒ Object
37 38 |
# File 'lib/jaribio/rspec_formatter.rb', line 37 def example_pending(example) end |
#example_started(example) ⇒ Object
27 28 |
# File 'lib/jaribio/rspec_formatter.rb', line 27 def example_started(example) end |
#message(message) ⇒ Object
47 48 |
# File 'lib/jaribio/rspec_formatter.rb', line 47 def () end |
#seed(seed) ⇒ Object
no-op
73 74 |
# File 'lib/jaribio/rspec_formatter.rb', line 73 def seed(seed) end |
#start(example_count) ⇒ Object
17 18 |
# File 'lib/jaribio/rspec_formatter.rb', line 17 def start(example_count) end |
#start_dump ⇒ Object
53 54 |
# File 'lib/jaribio/rspec_formatter.rb', line 53 def start_dump() end |
#stop ⇒ Object
50 51 |
# File 'lib/jaribio/rspec_formatter.rb', line 50 def stop end |