Sha256: 3140b7b38b08ca1f0c91b50fdc45eb405b67706a7633fe2770ab56820d2306cd

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require 'test/unit'
require 'helper'
require 'tmpdir'
require 'capsaicin/files'
require 'capsaicin/files/local'

class TestLocalFiles < Test::Unit::TestCase

  def setup
    @local = CapistranoMock.new
    @local.extend Capsaicin::Files::Local
  end
  
  def test_exists
    assert @local.exists?(__FILE__)
    assert_equal "test -e #{__FILE__}", @local.logbuf.string.strip
  end
  
  def test_not_exists
    assert ! @local.exists?(__FILE__+'/nope')
  end
  
  def test_readable
    assert @local.readable?(__FILE__)
    assert_equal "test -r #{__FILE__}", @local.logbuf.string.strip
  end
  
  def test_not_readable
    assert ! @local.readable?(__FILE__+'/nope')
  end
  
  def test_writable
    assert @local.writable?(Dir.tmpdir)
    assert_equal "test -w #{Dir.tmpdir}", @local.logbuf.string.strip
  end
  
  def test_not_writable
    assert ! @local.writable?(__FILE__+'/nope')
  end
  
  def test_file
    assert @local.file?(__FILE__)
    assert_equal "test -f #{__FILE__}", @local.logbuf.string.strip
  end
  
  def test_not_file
    assert ! @local.file?(__FILE__+'/nope')
  end
  
  def test_directory
    assert @local.directory?(File.dirname(__FILE__))
    assert_equal "test -d #{File.dirname __FILE__}", @local.logbuf.string.strip
  end
  
  def test_not_directory
    assert ! @local.directory?(__FILE__)
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
joekhoobyar-capsaicin-0.1.6 test/test_local_files.rb
joekhoobyar-capsaicin-0.1.7 test/test_local_files.rb
capsaicin-0.1.8 test/test_local_files.rb
capsaicin-0.1.6 test/test_local_files.rb
capsaicin-0.1.7 test/test_local_files.rb