Commit 8ef929eb5a9b9bc0787f966d1677f928a76ce97c
1 parent
abdd2edc
Exists in
colab
and in
4 other branches
Added validations for both Project and KalibroConfiguration Attributes
Showing
4 changed files
with
14 additions
and
1 deletions
Show diff stats
app/models/kalibro_configuration_attributes.rb
app/models/project_attributes.rb
spec/models/kalibro_configuration_attributes_spec.rb
| 1 | 1 | require 'rails_helper' |
| 2 | 2 | |
| 3 | 3 | describe KalibroConfigurationAttributes, :type => :model do |
| 4 | + describe 'validations' do | |
| 5 | + it { is_expected.to validate_presence_of(:kalibro_configuration_id) } | |
| 6 | + it { is_expected.to validate_presence_of(:user) } | |
| 7 | + end | |
| 8 | + | |
| 4 | 9 | describe 'associations' do |
| 5 | 10 | it { is_expected.to belong_to(:user) } |
| 6 | 11 | end | ... | ... |
spec/models/project_attributes_spec.rb
| ... | ... | @@ -5,6 +5,11 @@ RSpec.describe ProjectAttributes, type: :model do |
| 5 | 5 | it { is_expected.to belong_to(:user) } |
| 6 | 6 | end |
| 7 | 7 | |
| 8 | + describe 'validations' do | |
| 9 | + it { is_expected.to validate_presence_of(:project_id) } | |
| 10 | + it { is_expected.to validate_presence_of(:user) } | |
| 11 | + end | |
| 12 | + | |
| 8 | 13 | describe 'methods' do |
| 9 | 14 | describe 'project' do |
| 10 | 15 | subject { FactoryGirl.build(:project_attributes) } | ... | ... |