Sha256: 4fbe1e919a72679906dc9d72dc670617406e5e7b8aac8d98584dd56f51a83e2f

Contents?: true

Size: 1.23 KB

Versions: 14

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

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
        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

14 entries across 14 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.30.0-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.29.2 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.29.2-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.29.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.29.0-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.28.0 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.28.0-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.4 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.4-java spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.3 spec/lib/metasploit/model/file_spec.rb
metasploit-model-0.27.3-java spec/lib/metasploit/model/file_spec.rb