Sha256: 997ca4700c0b50a2dcddcf36dace7b42a510789d26321a36f5fe4c80fb6a4861

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

RSpec.describe Mdm::Module::Author, type: :model do

  it_should_behave_like 'Metasploit::Concern.run'

  context 'associations' do
    it { is_expected.to belong_to(:detail).class_name('Mdm::Module::Detail') }
  end

  context 'database' do
    context 'columns' do
      it { is_expected.to have_db_column(:detail_id).of_type(:integer) }
      it { is_expected.to have_db_column(:name).of_type(:text) }
      it { is_expected.to have_db_column(:email).of_type(:text) }
    end

    context 'indices' do
      it { is_expected.to have_db_index(:detail_id) }
    end
  end

  context 'factories' do
    context 'full_mdm_module_author' do
      subject(:full_mdm_module_author) do
        FactoryGirl.build :full_mdm_module_author
      end

      it { is_expected.to be_valid }

      context 'email' do
        subject(:email) {
          full_mdm_module_author.email
        }

        it { is_expected.not_to be_nil }
      end
    end

    context 'mdm_module_author' do
      subject(:mdm_module_author) do
        FactoryGirl.build :mdm_module_author
      end

      it { is_expected.to be_valid }
    end
  end

  context 'mass assignment security' do
    it { is_expected.not_to allow_mass_assignment_of(:detail_id) }
    it { is_expected.to allow_mass_assignment_of(:email) }
    it { is_expected.to allow_mass_assignment_of(:name) }
  end

  context 'validations' do
    it { is_expected.to validate_presence_of(:detail) }
    it { is_expected.not_to validate_presence_of(:email) }
    it { is_expected.to validate_presence_of(:name) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metasploit_data_models-0.24.4 spec/app/models/mdm/module/author_spec.rb
metasploit_data_models-0.24.3 spec/app/models/mdm/module/author_spec.rb
metasploit_data_models-0.24.2 spec/app/models/mdm/module/author_spec.rb
metasploit_data_models-0.24.1.pre.rspec.pre.3.pre.1 spec/app/models/mdm/module/author_spec.rb