Sha256: 2013acbe513b6807064fcd4b5c1a63e8a4a9c67adf7be87c5f9a295784be9871

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

#--
# =============================================================================
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
# All rights reserved.
#
# This source file is distributed as part of the Net::SFTP Secure FTP Client
# library for Ruby. This file (and the library as a whole) may be used only as
# allowed by either the BSD license, or the Ruby license (or, by association
# with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
# distribution for the texts of these licenses.
# -----------------------------------------------------------------------------
# net-sftp website: http://net-ssh.rubyforge.org/sftp
# project website : http://rubyforge.org/projects/net-ssh
# =============================================================================
#++

$:.unshift "../../lib"

require 'test/unit'
require 'net/sftp/operations/realpath'
require 'flexmock'

class TC_Operations_Realpath < Test::Unit::TestCase

  def setup
    @log = FlexMock.new
    @session = FlexMock.new
    @driver = FlexMock.new
    @operation = Net::SFTP::Operations::Realpath.new( @log, @session, @driver )
  end

  def test_perform
    id = path = nil
    @driver.mock_handle( :realpath ) { |i,p| id, path = i, p; 10 }
    assert_equal 10, @operation.perform( "foo" )
    assert_nil id
    assert_equal "foo", path
  end

  def test_do_name
    @session.mock_handle( :loop )
    @session.mock_handle( :status= )
    @session.mock_handle( :register )
    @driver.mock_handle( :realpath )
    @log.mock_handle( :debug? )
    @log.mock_handle( :debug )

    called = false
    @operation.execute( "foo" ) { |s,v| called = v }
    @operation.do_name( [ :a, :b ] )
    assert_equal :a, called
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
net-sftp-1.0.0 test/operations/tc_realpath.rb
net-sftp-1.0.1 test/operations/tc_realpath.rb
net-sftp-0.9.0 test/operations/tc_realpath.rb
net-sftp-0.5.0 test/operations/tc_realpath.rb