Sha256: 298849879001edf360a56bd505c23f5ffe4d37c9eb7bf119235a32401770e8b6

Contents?: true

Size: 1.54 KB

Versions: 18

Compression:

Stored size: 1.54 KB

Contents

RSpec.describe MetasploitDataModels::AutomaticExploitation::Run, type: :model do
  subject(:run) { FactoryGirl.create(:automatic_exploitation_run) }


  describe "database" do
    describe "columns" do
      it { is_expected.to have_db_column(:workspace_id).of_type(:integer) }
      it { is_expected.to have_db_index(:workspace_id) }
      it { is_expected.to have_db_column(:user_id).of_type(:integer) }
      it { is_expected.to have_db_index(:user_id) }
    end
  end

  describe "associations" do
    it { is_expected.to belong_to(:match_set).class_name('MetasploitDataModels::AutomaticExploitation::MatchSet') }
    it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
    it { is_expected.to belong_to(:workspace).inverse_of(:automatic_exploitation_runs) }
    it { is_expected.to belong_to(:user).class_name('Mdm::User') }
    it { is_expected.to belong_to(:user).inverse_of(:automatic_exploitation_runs) }
    it { is_expected.to have_many(:match_results) }
  end

  describe "destroying" do
    describe "associated MatchResults" do
      before(:each) do
        match_set = FactoryGirl.create(:automatic_exploitation_match_set)
        match = FactoryGirl.create(:automatic_exploitation_match, match_set: match_set)
        run.match_set = match_set
        FactoryGirl.create(:automatic_exploitation_match_result, match: match, run: run)
      end

      it 'should happen when you delete the Run' do
        expect { run.destroy }.to change { MetasploitDataModels::AutomaticExploitation::MatchResult.count }.by(-1)
      end
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
metasploit_data_models-1.2.10 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.9 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.8 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.7 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.6 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.5 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.4 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.3 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.2 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-0.24.4 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.1 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.2.0 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.1.0 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.0.1 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-1.0.0 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-0.24.3 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-0.24.2 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb
metasploit_data_models-0.24.1.pre.rspec.pre.3.pre.1 spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb