Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Replaced mock with double in specs.
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Malm <emalm@pivotallabs.com>
  • Loading branch information
Tim Labeeuw authored and emalm committed Nov 26, 2013
1 parent 411c56f commit 97492fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions em-warden-client/spec/fiber_aware_client_spec.rb
Expand Up @@ -66,7 +66,7 @@
request = Warden::Protocol::EchoRequest.new(:message => "hello")
expected_response = Warden::Protocol::EchoResponse.new(:message => "world")

handler = mock()
handler = double()
handler.should_receive(request.class.type_underscored).and_return(expected_response)
server = MockWardenServer.new(handler, socket_path)
actual_response = nil
Expand All @@ -88,7 +88,7 @@
request = Warden::Protocol::EchoRequest.new(:message => "hello world")
expected_response = MockWardenServer::Error.new("test error")

handler = mock()
handler = double()
handler.should_receive(request.class.type_underscored).and_raise(expected_response)
server = MockWardenServer.new(handler, socket_path)

Expand Down Expand Up @@ -123,7 +123,7 @@
request = Warden::Protocol::EchoRequest.new(:message => "hello")
response = Warden::Protocol::EchoResponse.new(:message => "world")

handler = mock()
handler = double()
handler.should_receive(request.class.type_underscored).and_return(response)
server = MockWardenServer.new(handler, socket_path)
actual_response = nil
Expand All @@ -145,7 +145,7 @@
request = Warden::Protocol::EchoRequest.new(:message => "hello")
response = MockWardenServer::Error.new("test error")

handler = mock()
handler = double()
handler.should_receive(request.class.type_underscored).and_raise(response)
server = MockWardenServer.new(handler, socket_path)

Expand Down
2 changes: 1 addition & 1 deletion em-warden-client/spec/support/mock_warden_server.rb
Expand Up @@ -99,7 +99,7 @@ def connection_args
end

def create_mock_handler(request, response = nil)
handler = mock()
handler = double()
mock_cont = handler.should_receive(request.class.type_underscored)
mock_cont = mock_cont.with(request)

Expand Down
10 changes: 5 additions & 5 deletions warden/spec/repl/repl_v2_spec.rb
Expand Up @@ -11,7 +11,7 @@
Readline.should_receive(:completion_append_character=).once
Readline.should_receive(:completion_proc=).once

@client = mock("warden client")
@client = double("warden client")
end

context "connect to the server" do
Expand Down Expand Up @@ -143,7 +143,7 @@
Readline.should_receive(:readline).once.with('warden> ', true)
.and_return("simple_test --field field", nil)

history = mock("history")
history = double("history")
Readline::HISTORY.should_receive(:to_a).and_return(history)
history.should_receive(:to_json).once.and_return('"["test"]"')

Expand All @@ -152,7 +152,7 @@
.and_return({:result => "result"})
@repl.should_receive(:restore_history).and_return(nil)

file = mock("history file")
file = double("history file")
file.should_receive(:write).once.with('"["test"]"')

@repl.should_receive(:open).once.with("history_path", "w+")
Expand Down Expand Up @@ -183,7 +183,7 @@
Readline::HISTORY.should_receive(:push).once.with("test")
.and_return(nil)

file = mock("history file")
file = double("history file")
file.should_receive(:read).once.and_return('["test"]')

@repl.should_receive(:open).once.with("history_path", "r")
Expand All @@ -195,7 +195,7 @@

describe "#process_line" do
before :each do
@client = mock("warden client")
@client = double("warden client")
Warden::Client.should_receive(:new).once.with("/tmp/warden.sock")
.and_return(@client)
end
Expand Down

0 comments on commit 97492fb

Please sign in to comment.