Sha256: 8865cf96747ef3ebb6c097d2c0ac75467903fcb8a689590bd6c8eb02243b8716

Contents?: true

Size: 1.23 KB

Versions: 22

Compression:

Stored size: 1.23 KB

Contents

RSpec.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 { is_expected.to be_a Metasploit::Model::Spec::Error }

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

    context 'with existing Pathname' do
      before(:example) 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
        expect(message).to include("#{pathname} already exists.")
      end

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

Version data entries

22 entries across 22 versions & 1 rubygems

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