spec/lib/taketo/commands/ssh_command_spec.rb in taketo-0.0.6 vs spec/lib/taketo/commands/ssh_command_spec.rb in taketo-0.0.7

- old
+ new

@@ -1,38 +1,28 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require 'spec_helper' require 'taketo/commands/ssh_command' include Taketo::Commands describe "SSH Command" do - let(:environment) { stub(:Environment, :name => :staging) } let(:server) do stub(:Server, :name => :s1, :host => "1.2.3.4", :port => 22, :username => "deployer", :default_location => "/var/app", :identity_file => "/home/gor/.ssh/qqq", - :environment => environment, :environment_variables => {}) end - let(:command) { mock(:Command, :render => "the_command") } - let(:ssh_command) { SSHCommand.new(server) } + subject(:ssh_command) { SSHCommand.new(server) } - it "should compose command based on provided server object" do + it "composes command based on provided server object" do ssh_command.render("foobar").should == %q[ssh -t -p 22 -i /home/gor/.ssh/qqq deployer@1.2.3.4 "foobar"] end - it "should ignore absent parts" do - server.stub(:port => nil) - server.stub(:username => nil) - server.stub(:identity_file => nil) + it "ignores absent parts if they are not required" do + server.stub(:port => nil, :username => nil, :identity_file => nil) ssh_command.render("foobar").should == %q[ssh -t 1.2.3.4 "foobar"] - end - - it "should require host" do - server.stub(:host => nil) - expect { ssh_command.render("bash") }.to raise_error ArgumentError, /host/ end end