Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/user_interacted_project_spec.rb')
-rw-r--r--spec/models/user_interacted_project_spec.rb52
1 files changed, 0 insertions, 52 deletions
diff --git a/spec/models/user_interacted_project_spec.rb b/spec/models/user_interacted_project_spec.rb
deleted file mode 100644
index aa038b06d8d..00000000000
--- a/spec/models/user_interacted_project_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe UserInteractedProject do
- let_it_be(:project) { create(:project) }
- let_it_be(:author) { project.creator }
-
- describe '.track' do
- subject { described_class.track(event) }
-
- let(:event) { build(:event, project: project, author: author) }
-
- Event.actions.each_key do |action|
- context "for all actions (event types)" do
- let(:event) { build(:event, project: project, author: author, action: action) }
-
- it 'creates a record' do
- expect { subject }.to change { described_class.count }.from(0).to(1)
- end
- end
- end
-
- it 'sets project accordingly' do
- subject
- expect(described_class.first.project).to eq(event.project)
- end
-
- it 'sets user accordingly' do
- subject
- expect(described_class.first.user).to eq(event.author)
- end
-
- it 'only creates a record once per user/project' do
- expect do
- subject
- described_class.track(event)
- end.to change { described_class.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 { described_class.count }
- end
- end
- end
-
- it { is_expected.to validate_presence_of(:project_id) }
- it { is_expected.to validate_presence_of(:user_id) }
-end