Sha256: 33bcb5f52d4dc10a29550fdd71c9e8a0a2102953c48e9ecf6dfcbafece71d370

Contents?: true

Size: 1.9 KB

Versions: 145

Compression:

Stored size: 1.9 KB

Contents

require 'common'

class ResponseTest < Net::SFTP::TestCase
  def test_code_should_default_to_FX_OK
    response = Net::SFTP::Response.new(mock("response"))
    assert_equal Net::SFTP::Response::FX_OK, response.code
  end

  def test_brackets_should_symbolize_key
    response = Net::SFTP::Response.new(mock("response"), :handle => "foo")
    assert_equal "foo", response['handle']
  end

  def test_to_s_with_nil_message_should_show_default_message
    response = Net::SFTP::Response.new(mock("response"), :code => 14)
    assert_equal "no space on filesystem (14)", response.to_s
  end

  def test_to_s_with_empty_message_should_show_default_message
    response = Net::SFTP::Response.new(mock("response"), :code => 14, :message => "")
    assert_equal "no space on filesystem (14)", response.to_s
  end

  def test_to_s_with_default_message_should_show_default_message
    response = Net::SFTP::Response.new(mock("response"), :code => 14, :message => "no space on filesystem")
    assert_equal "no space on filesystem (14)", response.to_s
  end

  def test_to_s_with_explicit_message_should_show_explicit_message
    response = Net::SFTP::Response.new(mock("response"), :code => 14, :message => "out of space")
    assert_equal "out of space (no space on filesystem, 14)", response.to_s
  end

  def test_ok_should_be_true_when_code_is_FX_OK
    response = Net::SFTP::Response.new(mock("response"))
    assert_equal true, response.ok?
  end

  def test_ok_should_be_false_when_code_is_not_FX_OK
    response = Net::SFTP::Response.new(mock("response"), :code => 14)
    assert_equal false, response.ok?
  end

  def test_eof_should_be_true_when_code_is_FX_EOF
    response = Net::SFTP::Response.new(mock("response"), :code => 1)
    assert_equal true, response.eof?
  end

  def test_eof_should_be_false_when_code_is_not_FX_EOF
    response = Net::SFTP::Response.new(mock("response"), :code => 14)
    assert_equal false, response.eof?
  end
end

Version data entries

145 entries across 108 versions & 9 rubygems

Version Path
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/test_response.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/test_response.rb