Class: RspecWeb::Formatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- RspecWeb::Formatter
- Defined in:
- lib/rspec_web/formatter.rb
Instance Method Summary collapse
- #close ⇒ Object
- #dump_failed(example) ⇒ Object
- #dump_failures ⇒ Object
- #dump_pending ⇒ Object
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(example) ⇒ Object
- #example_group_finished(example_group) ⇒ Object
- #example_group_started(example_group) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
- #example_started(example) ⇒ Object
- #format_backtrace(backtrace, example) ⇒ Object
- #message(message) ⇒ Object
- #start(example_count) ⇒ Object
- #start_dump ⇒ Object
Instance Method Details
#close ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/rspec_web/formatter.rb', line 124 def close # puts "#{__method__} -----------------------" puts "Specs finished!.. " = { receiver: "server", method: "disconnect", arguments: ["rspec"] } @socket.send(.to_json) @socket.close end |
#dump_failed(example) ⇒ Object
92 93 94 95 |
# File 'lib/rspec_web/formatter.rb', line 92 def dump_failed(example) # puts "#{__method__} -----------------------" # puts "example => #{example.inspect}" end |
#dump_failures ⇒ Object
110 111 112 |
# File 'lib/rspec_web/formatter.rb', line 110 def dump_failures # puts "#{__method__} -----------------------" end |
#dump_pending ⇒ Object
114 115 116 |
# File 'lib/rspec_web/formatter.rb', line 114 def dump_pending # puts "#{__method__} -----------------------" end |
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/rspec_web/formatter.rb', line 97 def dump_summary(duration, example_count, failure_count, pending_count) # puts "#{__method__} -----------------------" # puts "duration => #{duration.inspect}" # puts "example_count => #{example_count.inspect}" # puts "failure_count => #{failure_count.inspect}" # puts "pending_count => #{pending_count.inspect}" end |
#example_failed(example) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rspec_web/formatter.rb', line 72 def example_failed(example) # puts "#{__method__} -----------------------" data = { :started_at => example.[:execution_result][:started_at].to_i, :finished_at => example.[:execution_result][:started_at].to_i, :run_time => example.[:execution_result][:run_time], :file_path => example.[:file_path], :line_number => example.[:line_number], :description => example.[:full_description] } = { receiver: "web", method: "addToFailing", arguments: [@timestamp, data] } @socket.send(.to_json) end |
#example_group_finished(example_group) ⇒ Object
30 31 32 33 |
# File 'lib/rspec_web/formatter.rb', line 30 def example_group_finished(example_group) # puts "#{__method__} -----------------------" # # puts "example_group => #{example_group.inspect}" end |
#example_group_started(example_group) ⇒ Object
26 27 28 |
# File 'lib/rspec_web/formatter.rb', line 26 def example_group_started(example_group) # puts "#{__method__} -----------------------" end |
#example_passed(example) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rspec_web/formatter.rb', line 40 def example_passed(example) # puts "#{__method__} -----------------------" data = { :started_at => example.[:execution_result][:started_at].to_i, :finished_at => example.[:execution_result][:started_at].to_i, :run_time => example.[:execution_result][:run_time], :file_path => example.[:file_path], :line_number => example.[:line_number], :description => example.[:full_description] } = { receiver: "web", method: "addToPassing", arguments: [@timestamp, data] } @socket.send(.to_json) end |
#example_pending(example) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rspec_web/formatter.rb', line 56 def example_pending(example) # puts "#{__method__} -----------------------" data = { :started_at => example.[:execution_result][:started_at].to_i, :finished_at => example.[:execution_result][:started_at].to_i, :run_time => example.[:execution_result][:run_time], :file_path => example.[:file_path], :line_number => example.[:line_number], :description => example.[:full_description] } = { receiver: "web", method: "addToPending", arguments: [@timestamp, data] } @socket.send(.to_json) end |
#example_started(example) ⇒ Object
35 36 37 38 |
# File 'lib/rspec_web/formatter.rb', line 35 def example_started(example) # puts "#{__method__} -----------------------" # # puts "example => #{example.inspect}" end |
#format_backtrace(backtrace, example) ⇒ Object
118 119 120 121 122 |
# File 'lib/rspec_web/formatter.rb', line 118 def format_backtrace(backtrace, example) # puts "#{__method__} -----------------------" # puts "backtrace => #{backtrace.inspect}" # # puts "example => #{example.inspect}" end |
#message(message) ⇒ Object
105 106 107 108 |
# File 'lib/rspec_web/formatter.rb', line 105 def () # puts "#{__method__} -----------------------" # puts "message => #{message.inspect}" end |
#start(example_count) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec_web/formatter.rb', line 9 def start(example_count) # puts "#{__method__} -----------------------" # puts "example_count => #{example_count.inspect}" puts "Starting specs.. " puts "View at http://0.0.0.0:4567" @timestamp = Time.now.to_i @socket = WebSocket.new("ws://localhost:10081") = { receiver: "server", method: "identify", arguments: ["rspec"] } @socket.send(.to_json) = { receiver: "web", method: "startNewIteration", arguments: [@timestamp, example_count] } @socket.send(.to_json) end |
#start_dump ⇒ Object
88 89 90 |
# File 'lib/rspec_web/formatter.rb', line 88 def start_dump # puts "#{__method__} -----------------------" end |