diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-21 15:21:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-21 15:21:10 +0000 |
commit | e33f87ac0fabaab468ce4b457996cc0f1b1bb648 (patch) | |
tree | 8bf0de72a9acac014cfdaddab7d463b208294af2 /spec/models/resource_milestone_event_spec.rb | |
parent | 5baf990db20a75078684702782c24399ef9eb0fa (diff) | |
download | gitlab-ce-e33f87ac0fabaab468ce4b457996cc0f1b1bb648.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/resource_milestone_event_spec.rb')
-rw-r--r-- | spec/models/resource_milestone_event_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/resource_milestone_event_spec.rb b/spec/models/resource_milestone_event_spec.rb index 1b0181e3fd2..bf8672f95c9 100644 --- a/spec/models/resource_milestone_event_spec.rb +++ b/spec/models/resource_milestone_event_spec.rb @@ -52,4 +52,30 @@ describe ResourceMilestoneEvent, type: :model do end end end + + shared_examples 'a milestone action queryable resource event' do |expected_results_for_actions| + [Issue, MergeRequest].each do |klass| + expected_results_for_actions.each do |action, expected_result| + it "is #{expected_result} for action #{action} on #{klass.name.underscore}" do + model = create(klass.name.underscore) + key = model.class.name.underscore + event = build(described_class.name.underscore.to_sym, key => model, action: action) + + expect(event.send(query_method)).to eq(expected_result) + end + end + end + end + + describe '#added?' do + it_behaves_like 'a milestone action queryable resource event', { add: true, remove: false } do + let(:query_method) { :add? } + end + end + + describe '#removed?' do + it_behaves_like 'a milestone action queryable resource event', { add: false, remove: true } do + let(:query_method) { :remove? } + end + end end |