Sha256: f63322bec95d2aecabae3f19d60029113968b2d865429de1d2a5178061ebe403

Contents?: true

Size: 1012 Bytes

Versions: 24

Compression:

Stored size: 1012 Bytes

Contents

require 'spec_helper'

describe Metasploit::Model::File do
  context 'realpath' do
    let(:real_basename) do
      'real'
    end

    let(:real_pathname) do
      Metasploit::Model::Spec.temporary_pathname.join(real_basename)
    end

    let(:symlink_basename) do
      'symlink'
    end

    let(:symlink_pathname) do
      Metasploit::Model::Spec.temporary_pathname.join(symlink_basename)
    end

    before(:each) do
      real_pathname.mkpath

      Dir.chdir(Metasploit::Model::Spec.temporary_pathname.to_path) do
        File.symlink(real_basename, 'symlink')
      end
    end

    def realpath
      described_class.realpath(symlink_pathname.to_path)
    end

    if RUBY_PLATFORM =~ /java/
      it 'should be necessary because File.realpath does not resolve symlinks' do
        File.realpath(symlink_pathname.to_path).should_not == real_pathname.to_path
      end
    end

    it 'should resolve symlink to real (canonical) path' do
      realpath.should == real_pathname.to_path
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
metasploit-model-0.27.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.2-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.1-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.0-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.0.pre.dep.pre.railties spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.26.1-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.26.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.7 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.7-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.6 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.6-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.3 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.3-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.2-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.1-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups-java spec/lib/metasploit/model/file_spec.rb