Sha256: 081526f9a5e63940b66e66b11708d71b8abae6910b3f18d140fb9e78785f169e

Contents?: true

Size: 1.23 KB

Versions: 22

Compression:

Stored size: 1.23 KB

Contents

RSpec.describe Metasploit::Model::File do
  unless RUBY_PLATFORM =~ /java/ && Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('1.7.14')
    it 'aliases ::File' do
      expect(described_class).to equal(::File)
    end
  end

  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(:example) 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/ && Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('1.7.14')
      it 'should be necessary because File.realpath does not resolve symlinks' do
        expect(File.realpath(symlink_pathname.to_path)).not_to eq(real_pathname.to_path)
      end
    end

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-5.0.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-5.0.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.6 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.5 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.4 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.3 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-4.0.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-3.1.4 spec/lib/metasploit/model/file_spec.rb
metasploit-model-3.1.3 spec/lib/metasploit/model/file_spec.rb
metasploit-model-3.1.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-3.1.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-3.1.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-3.0.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-2.0.4 spec/lib/metasploit/model/file_spec.rb
metasploit-model-2.0.3 spec/lib/metasploit/model/file_spec.rb
metasploit-model-2.0.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-2.0.1 spec/lib/metasploit/model/file_spec.rb