Sha256: 64a3e4468d45cc32c3261f6e6096f9b5ac096c27ced749e97fd1b997494ae1be

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe MetasploitDataModels::AutomaticExploitation::MatchSet do
  describe "database" do
    describe "foreign_keys" do
      it { should have_db_column(:workspace_id).of_type(:integer) }
      it { should have_db_column(:user_id).of_type(:integer) }
    end

    describe "indices" do
      it { should have_db_index(:user_id) }
      it { should have_db_index(:workspace_id) }
    end
  end

  describe "associations" do
    it { should have_many(:matches).class_name('MetasploitDataModels::AutomaticExploitation::Match') }
    it { should have_many(:matches).inverse_of(:match_set) }
    it { should have_many(:runs).class_name('MetasploitDataModels::AutomaticExploitation::Run') }
    it { should have_many(:runs).inverse_of(:match_set) }
    it { should belong_to(:user).class_name('Mdm::User') }
    it { should belong_to(:user).inverse_of(:automatic_exploitation_match_sets) }
    it { should belong_to(:workspace).class_name('Mdm::Workspace') }
    it { should 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

8 entries across 8 versions & 1 rubygems

Version Path
metasploit_data_models-0.24.5 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.24.1 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0b spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0a spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.24.0 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.23.3.pre.autoload spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.23.2 spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb
metasploit_data_models-0.23.2-java spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb