Class: RspecWeb::Formatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec_web/formatter.rb

Instance Method Summary collapse

Instance Method Details

#closeObject



50
51
52
53
54
55
# File 'lib/rspec_web/formatter.rb', line 50

def close
  puts "Specs finished!.. "
  message = { receiver: "server", method: "disconnect", arguments: ["rspec"] }
  @socket.send(message.to_json)
  @socket.close
end

#dump_failed(example) ⇒ Object



43
# File 'lib/rspec_web/formatter.rb', line 43

def dump_failed(example); end

#dump_failuresObject



46
# File 'lib/rspec_web/formatter.rb', line 46

def dump_failures; end

#dump_pendingObject



47
# File 'lib/rspec_web/formatter.rb', line 47

def dump_pending; end

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object



44
# File 'lib/rspec_web/formatter.rb', line 44

def dump_summary(duration, example_count, failure_count, pending_count); end

#example_failed(example) ⇒ Object



36
37
38
39
40
# File 'lib/rspec_web/formatter.rb', line 36

def example_failed(example)
  data = example_to_hash(example)
  message = { receiver: "web", method: "addToFailing", arguments: [@timestamp, data] }
  @socket.send(message.to_json)
end

#example_group_finished(example_group) ⇒ Object



21
# File 'lib/rspec_web/formatter.rb', line 21

def example_group_finished(example_group); end

#example_group_started(example_group) ⇒ Object



20
# File 'lib/rspec_web/formatter.rb', line 20

def example_group_started(example_group); end

#example_passed(example) ⇒ Object



24
25
26
27
28
# File 'lib/rspec_web/formatter.rb', line 24

def example_passed(example)
  data = example_to_hash(example)
  message = { receiver: "web", method: "addToPassing", arguments: [@timestamp, data] }
  @socket.send(message.to_json)
end

#example_pending(example) ⇒ Object



30
31
32
33
34
# File 'lib/rspec_web/formatter.rb', line 30

def example_pending(example)
  data = example_to_hash(example)
  message = { receiver: "web", method: "addToPending", arguments: [@timestamp, data] }
  @socket.send(message.to_json)
end

#example_started(example) ⇒ Object



22
# File 'lib/rspec_web/formatter.rb', line 22

def example_started(example); end

#format_backtrace(backtrace, example) ⇒ Object



48
# File 'lib/rspec_web/formatter.rb', line 48

def format_backtrace(backtrace, example); end

#message(message) ⇒ Object



45
# File 'lib/rspec_web/formatter.rb', line 45

def message(message); end

#start(example_count) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rspec_web/formatter.rb', line 9

def start(example_count)
  @timestamp = Time.now.to_i
  @socket = WebSocket.new("ws://localhost:10081")
  
  message = { receiver: "server", method: "identify", arguments: ["rspec"] }
  @socket.send(message.to_json)
  
  message = { receiver: "web", method: "startNewIteration", arguments: [@timestamp, example_count] }
  @socket.send(message.to_json)
end

#start_dumpObject



42
# File 'lib/rspec_web/formatter.rb', line 42

def start_dump; end