Skip to content

Commit

Permalink
Removed unnecessary failed spec helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
mloughran committed Oct 17, 2011
1 parent 1ae70bb commit 0e102b4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
5 changes: 0 additions & 5 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ def close_connection
end
end

def failed
EventMachine.stop
fail
end

def format_request(r)
data = "#{r[:method]} #{r[:path]} HTTP/1.1\r\n"
header_lines = r[:headers].map { |k,v| "#{k}: #{v}" }
Expand Down
8 changes: 4 additions & 4 deletions spec/integration/common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('http://127.0.0.1:12345/').get :timeout => 0
http.errback { done }
http.callback { failed }
http.callback { fail }
end

EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) {}
Expand All @@ -22,7 +22,7 @@
em {
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
http.errback { failed }
http.errback { fail }
http.callback {
http.response_header.status.should == 101
http.close_connection
Expand Down Expand Up @@ -51,7 +51,7 @@
em {
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get(:query => {'foo' => 'bar', 'baz' => 'qux'}, :timeout => 0)
http.errback { failed }
http.errback { fail }
http.callback {
http.response_header.status.should == 101
http.close_connection
Expand Down Expand Up @@ -79,7 +79,7 @@
em {
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get(:timeout => 0)
http.errback { failed }
http.errback { fail }
http.callback {
http.response_header.status.should == 101
http.close_connection
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/draft06_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def start_client
done
}
server.onerror {
failed
fail
}
}

Expand Down
10 changes: 5 additions & 5 deletions spec/integration/draft75_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def start_client
MSG = "Hello World!"
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
http.errback { failed }
http.errback { fail }
http.callback { http.response_header.status.should == 101 }

http.stream { |msg|
Expand All @@ -51,7 +51,7 @@ def start_client

EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
http.errback { failed }
http.errback { fail }
http.stream {|msg|}
http.callback {
http.response_header.status.should == 101
Expand All @@ -77,7 +77,7 @@ def start_client
em {
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
http.errback { failed }
http.errback { fail }
http.callback {
http.response_header.status.should == 101
http.close_connection
Expand All @@ -100,11 +100,11 @@ def start_client
EventMachine.add_timer(0.1) do
http = EventMachine::HttpRequest.new('http://127.0.0.1:12345/').get :timeout => 0
http.errback { http.response_header.status.should == 0 }
http.callback { failed }
http.callback { fail }
end

EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) do |ws|
ws.onopen { failed }
ws.onopen { fail }
ws.onclose { EventMachine.stop }
ws.onerror {|e|
e.should be_an_instance_of EventMachine::WebSocket::HandshakeError
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/draft76_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def start_client
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
# Fail if foobar message is received
ws.onmessage { |msg|
failed
fail
}
}

Expand Down

0 comments on commit 0e102b4

Please sign in to comment.