Skip to content

Commit

Permalink
Add test for valid app_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
bdaase committed Mar 22, 2019
1 parent 85a78f5 commit 1ce6a74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/factories/app_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FactoryBot.define do
factory :app_setting do
singleton_guard { 1 }
singleton_guard { 0 }
vsphere_server_ip { '127.0.0.1' }
vsphere_server_user { 'user@domain.tld' }
vsphere_server_password { 'verySecure' }
Expand Down
9 changes: 8 additions & 1 deletion spec/models/app_setting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
# We should add some tests here, which test that the validation is correct
RSpec.describe AppSetting, type: :model do
describe 'validation tests' do
let(:app_setting) { FactoryBot.build :app_setting }
let(:app_setting) {FactoryBot.build :app_setting}

context 'when settings are invalid' do
it 'is invalid with if it is not the first setting' do
app_setting.singleton_guard = 2
expect(app_setting).to be_invalid
end
end

context 'when settings are valid' do
it 'is valid with valid attributes' do
expect(app_setting).to be_valid
end
end

end
end

0 comments on commit 1ce6a74

Please sign in to comment.