Sha256: e6233712d5f9c5b010d91f424a49b575a0cfda399e09ca9721652db6a7c70149

Contents?: true

Size: 1.53 KB

Versions: 24

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

describe Mdm::VulnAttempt do

  context 'association' do
    it { should belong_to(:vuln).class_name('Mdm::Vuln') }
  end

  context 'database' do

    context 'timestamps'do
      it { should have_db_column(:attempted_at).of_type(:datetime) }
    end

    context 'columns' do
      it { should have_db_column(:vuln_id).of_type(:integer) }
      it { should have_db_column(:exploited).of_type(:boolean) }
      it { should have_db_column(:fail_reason).of_type(:string) }
      it { should have_db_column(:username).of_type(:string) }
      it { should have_db_column(:module).of_type(:text) }
      it { should have_db_column(:session_id).of_type(:integer) }
      it { should have_db_column(:loot_id).of_type(:integer) }
      it { should have_db_column(:fail_detail).of_type(:text) }
    end
  end

  context 'validations' do
    it 'should require a vuln_id' do
      orphan_detail = FactoryGirl.build(:mdm_vuln_detail, :vuln => nil)
      orphan_detail.should_not be_valid
      orphan_detail.errors[:vuln_id].should include("can't be blank")
    end
  end

  context 'factory' do
    it 'should be valid' do
      vuln_attempt = FactoryGirl.build(:mdm_vuln_attempt)
      vuln_attempt.should be_valid
    end
  end

  context '#destroy' do
    it 'should successfully destroy the object' do
      vuln_attempt = FactoryGirl.create(:mdm_vuln_attempt)
      expect {
        vuln_attempt.destroy
      }.to_not raise_error
      expect {
        vuln_attempt.reload
      }.to raise_error(ActiveRecord::RecordNotFound)
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
metasploit_data_models-0.17.2-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.17.2 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.17.2.pre.metasploit.pre.data.pre.models.pre.search spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.17.1-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.17.1 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.17.0-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.17.0 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.9 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.9-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.8 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.8-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.7-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.7 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.6-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.6 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.5-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.5 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.4-java spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.4 spec/app/models/mdm/vuln_attempt_spec.rb
metasploit_data_models-0.16.3-java spec/app/models/mdm/vuln_attempt_spec.rb