Sha256: f7ae3a5f07a259e6cab8e1ee5fd6989c7ca1601eed66647c158662b045e6afec

Contents?: true

Size: 1.54 KB

Versions: 18

Compression:

Stored size: 1.54 KB

Contents

RSpec.describe MetasploitDataModels::AutomaticExploitation::MatchSet, type: :model do
  describe "database" do
    describe "foreign_keys" do
      it { is_expected.to have_db_column(:workspace_id).of_type(:integer) }
      it { is_expected.to have_db_column(:user_id).of_type(:integer) }
    end

    describe "indices" do
      it { is_expected.to have_db_index(:user_id) }
      it { is_expected.to have_db_index(:workspace_id) }
    end
  end

  describe "associations" do
    it { is_expected.to have_many(:matches).class_name('MetasploitDataModels::AutomaticExploitation::Match') }
    it { is_expected.to have_many(:matches).inverse_of(:match_set) }
    it { is_expected.to have_many(:runs).class_name('MetasploitDataModels::AutomaticExploitation::Run') }
    it { is_expected.to have_many(:runs).inverse_of(:match_set) }
    it { is_expected.to belong_to(:user).class_name('Mdm::User') }
    it { is_expected.to belong_to(:user).inverse_of(:automatic_exploitation_match_sets) }
    it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
    it { is_expected.to belong_to(:workspace).inverse_of(:automatic_exploitation_match_sets) }
  end

  describe "validations" do
    subject(:match_set){ FactoryGirl.build(:automatic_exploitation_match_set)}

    describe "missing user" do
      before(:each) do
        match_set.user = nil
      end

      it{ is_expected.to be_invalid }
    end

    describe "missing workspace" do
      before(:each) do
        match_set.workspace = nil
      end

      it{ is_expected.to be_invalid }
    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/match_set_spec.rb
metasploit_data_models-1.2.9 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.8 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.7 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.6 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.5 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.4 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.3 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.2 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.24.4 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.1 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.2.0 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.1.0 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.0.1 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.0.0 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.24.3 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.24.2 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.24.1.pre.rspec.pre.3.pre.1 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb