diff options
Diffstat (limited to 'spec/models/projects')
-rw-r--r-- | spec/models/projects/project_topic_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/projects/topic_spec.rb | 22 |
2 files changed, 38 insertions, 0 deletions
diff --git a/spec/models/projects/project_topic_spec.rb b/spec/models/projects/project_topic_spec.rb new file mode 100644 index 00000000000..c7a989040c7 --- /dev/null +++ b/spec/models/projects/project_topic_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Projects::ProjectTopic do + let_it_be(:project_topic, reload: true) { create(:project_topic) } + + subject { project_topic } + + it { expect(subject).to be_valid } + + describe 'associations' do + it { is_expected.to belong_to(:project) } + it { is_expected.to belong_to(:topic) } + end +end diff --git a/spec/models/projects/topic_spec.rb b/spec/models/projects/topic_spec.rb new file mode 100644 index 00000000000..409dc932709 --- /dev/null +++ b/spec/models/projects/topic_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Projects::Topic do + let_it_be(:topic, reload: true) { create(:topic) } + + subject { topic } + + it { expect(subject).to be_valid } + + describe 'associations' do + it { is_expected.to have_many(:project_topics) } + it { is_expected.to have_many(:projects) } + end + + describe 'validations' do + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_uniqueness_of(:name) } + it { is_expected.to validate_length_of(:name).is_at_most(255) } + end +end |