Skip to content

Commit

Permalink
Fix mocking/stubbing in CLI spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismear committed Oct 26, 2010
1 parent d088dde commit 87ca98a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions spec/runsshlib/cli_spec.rb
Expand Up @@ -124,14 +124,19 @@ def match_print

# somehow this doesn't work. It shouldn't really run the "shell"
# method so it shouldn't exit.
# it "should correctly initialize SshBackend" do
# mock_ssh_backend = double('SshBackend')
# mock_ssh_backend.should_receive(:shell)
# RunSSHLib::SshBackend.should_receive(:new).
# and_return(mock_ssh_backend)
# cli = RunSSHLib::CLI.new(%W(-f #{TMP_FILE} shell cust2 dc somehost))
# cli.run
# end
it "should correctly initialize SshBackend" do
mock_ssh_backend = double('SshBackend')
mock_ssh_backend.should_receive(:shell)
RunSSHLib::SshBackend.should_receive(:new).
and_return(mock_ssh_backend)

mock_host = double('host')
mock_config_file = double('ConfigFile', :get_host => mock_host)
RunSSHLib::ConfigFile.stub!(:new).and_return(mock_config_file)

cli = RunSSHLib::CLI.new(%W(-f #{TMP_FILE} shell cust2 dc somehost))
cli.run
end
end

describe "add" do
Expand Down

0 comments on commit 87ca98a

Please sign in to comment.