summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-02-23 21:24:11 +0100
committerAndreas Brandl <abrandl@gitlab.com>2018-03-06 12:53:13 +0100
commit870109833d1038631c18cf341e254d43b5a7f748 (patch)
treea39ee5231654b80f86304058caf9df21b7649f61 /spec/models
parentd4d0740e24315e7071f90b3744377b3ca3b5816a (diff)
downloadgitlab-ce-870109833d1038631c18cf341e254d43b5a7f748.tar.gz
Treat special cases accordingly.
* Event without project * Fail early on unexpectedly missing author
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/user_contributed_projects_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/user_contributed_projects_spec.rb b/spec/models/user_contributed_projects_spec.rb
index b0a10ca59ab..776f36675d8 100644
--- a/spec/models/user_contributed_projects_spec.rb
+++ b/spec/models/user_contributed_projects_spec.rb
@@ -31,6 +31,14 @@ describe UserContributedProjects do
described_class.track(event)
end.to change { UserContributedProjects.count }.from(0).to(1)
end
+
+ describe 'with an event without a project' do
+ let(:event) { build(:event, project: nil) }
+
+ it 'ignores the event' do
+ expect { subject }.not_to change { UserContributedProjects.count }
+ end
+ end
end
it { is_expected.to validate_presence_of(:project) }