spec/models/metasploit/credential/origin/service_spec.rb in metasploit-credential-0.14.5 vs spec/models/metasploit/credential/origin/service_spec.rb in metasploit-credential-0.14.6
- old
+ new
@@ -1,50 +1,48 @@
-require 'spec_helper'
-
-describe Metasploit::Credential::Origin::Service do
+RSpec.describe Metasploit::Credential::Origin::Service, type: :model do
include_context 'Mdm::Workspace'
subject(:service_origin) do
FactoryGirl.build(:metasploit_credential_origin_service)
end
it_should_behave_like 'Metasploit::Concern.run'
context 'associations' do
- it { should have_many(:cores).class_name('Metasploit::Credential::Core').dependent(:destroy) }
- it { should belong_to(:service).class_name('Mdm::Service') }
+ it { is_expected.to have_many(:cores).class_name('Metasploit::Credential::Core').dependent(:destroy) }
+ it { is_expected.to belong_to(:service).class_name('Mdm::Service') }
end
context 'database' do
context 'columns' do
it_should_behave_like 'timestamp database columns'
- it { should have_db_column(:module_full_name).of_type(:text).with_options(null: false) }
+ it { is_expected.to have_db_column(:module_full_name).of_type(:text).with_options(null: false) }
context 'foreign keys' do
- it { should have_db_column(:service_id).of_type(:integer).with_options(null: false) }
+ it { is_expected.to have_db_column(:service_id).of_type(:integer).with_options(null: false) }
end
end
context 'indices' do
- it { should have_db_index([:service_id, :module_full_name]).unique(true) }
+ it { is_expected.to have_db_index([:service_id, :module_full_name]).unique(true) }
end
end
context 'factories' do
context 'metasploit_credential_origin_service' do
subject(:metasploit_credential_origin_service) do
FactoryGirl.build(:metasploit_credential_origin_service)
end
- it { should be_valid }
+ it { is_expected.to be_valid }
end
end
context 'mass assignment security' do
it { should_not allow_mass_assignment_of :created_at }
- it { should allow_mass_assignment_of :module_full_name }
+ it { is_expected.to allow_mass_assignment_of :module_full_name }
it { should_not allow_mass_assignment_of :service }
it { should_not allow_mass_assignment_of :service_id }
it { should_not allow_mass_assignment_of :updated_at }
end
@@ -162,12 +160,12 @@
# example to sample for service_id
before(:each) do
FactoryGirl.create(:metasploit_credential_origin_service)
end
- it { should validate_uniqueness_of(:module_full_name).scoped_to(:service_id) }
+ it { is_expected.to validate_uniqueness_of(:module_full_name).scoped_to(:service_id) }
end
end
- it { should validate_presence_of :service }
+ it { is_expected.to validate_presence_of :service }
end
end