Sha256: 0e18fa3cdd2387d5dfa82ae524235e0288fdcbc0abbed3fd3ee13eb4f29a1d0e

Contents?: true

Size: 1.23 KB

Versions: 38

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Metasploit::Model::Spec::PathnameCollision do
  let(:pathname) do
    Metasploit::Model::Spec.temporary_pathname.join('pathname')
  end

  subject(:pathname_collision) do
    described_class.new(pathname)
  end

  it { should be_a Metasploit::Model::Spec::Error }

  context 'check!' do
    subject(:check!) do
      described_class.check!(pathname)
    end

    context 'with existing Pathname' do
      before(:each) do
        pathname.mkpath
      end

      it 'should raise Metasploit::Model::Spec::PathnameCollision' do
        expect {
          check!
        }.to raise_error(described_class)
      end
    end

    context 'without existing Pathname' do
      it 'should not raise error' do
        expect {
          check!
        }.to_not raise_error
      end
    end
  end

  context '#initialize' do
    context '#message' do
      subject(:message) do
        pathname_collision.message
      end

      it 'should include pathname' do
        message.should include("#{pathname} already exists.")
      end

      it 'should include potential cause' do
        message.should include('Metasploit::Model::Spec.remove_temporary_pathname was not called after the previous spec.')
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
metasploit-model-0.27.0.pre.dep.pre.railties spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.26.1-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.26.1 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.7 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.7-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.6 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.6-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.3 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.3-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.2 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.2-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.1 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.25.1-java spec/lib/metasploit/model/spec/pathname_collision_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/spec/pathname_collision_spec.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.24.1-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.24.1 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 spec/lib/metasploit/model/spec/pathname_collision_spec.rb