diff options
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r-- | spec/models/issue_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 2e7d78d77a8..9c58d307c4c 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -7,6 +7,10 @@ describe Issue do describe "Associations" do it { is_expected.to belong_to(:milestone) } + it { is_expected.to belong_to(:project) } + it { is_expected.to belong_to(:moved_to).class_name('Issue') } + it { is_expected.to belong_to(:duplicated_to).class_name('Issue') } + it { is_expected.to belong_to(:closed_by).class_name('User') } it { is_expected.to have_many(:assignees) } end @@ -310,6 +314,22 @@ describe Issue do end end + describe '#duplicated?' do + let(:issue) { create(:issue) } + subject { issue.duplicated? } + + context 'issue not duplicated' do + it { is_expected.to eq false } + end + + context 'issue already duplicated' do + let(:duplicated_to_issue) { create(:issue) } + let(:issue) { create(:issue, duplicated_to: duplicated_to_issue) } + + it { is_expected.to eq true } + end + end + describe '#suggested_branch_name' do let(:repository) { double } |