Sha256: fc92029e6b5527cb695ba6c7ca161389055b6b2c813e0641ce16778fe81f58a9

Contents?: true

Size: 1.23 KB

Versions: 8

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(: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/ && 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

8 entries across 8 versions & 1 rubygems

Version Path
metasploit-model-1.0.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-1.0.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-1.0.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.2-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.1 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.1-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.1.pre.rspec.pre.3.pre.1 spec/lib/metasploit/model/file_spec.rb