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-1.0.0.pre.rails.pre.4.0 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.30.0 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.30.0-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.29.2 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.29.2-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.29.0 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.29.0-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.28.0 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.28.0-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.4 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.4-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.3 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.3-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.2 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.2-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.1 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.1-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.0 spec/lib/metasploit/model/spec/pathname_collision_spec.rb
metasploit-model-0.27.0-java spec/lib/metasploit/model/spec/pathname_collision_spec.rb