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/services/design_management/save_designs_service_spec.rb')
-rw-r--r--spec/services/design_management/save_designs_service_spec.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/services/design_management/save_designs_service_spec.rb b/spec/services/design_management/save_designs_service_spec.rb
index 013d5473860..3be3ac9daca 100644
--- a/spec/services/design_management/save_designs_service_spec.rb
+++ b/spec/services/design_management/save_designs_service_spec.rb
@@ -65,6 +65,10 @@ describe DesignManagement::SaveDesignsService do
end
it_behaves_like 'a service error'
+
+ it 'does not create an event in the activity stream' do
+ expect { run_service }.not_to change { Event.count }
+ end
end
context 'when the feature is available' do
@@ -89,6 +93,12 @@ describe DesignManagement::SaveDesignsService do
expect { run_service }.to change { counter.read(:create) }.by(1)
end
+ it 'creates an event in the activity stream' do
+ expect { run_service }
+ .to change { Event.count }.by(1)
+ .and change { Event.for_design.created_action.count }.by(1)
+ end
+
it 'creates a commit in the repository' do
run_service
@@ -166,9 +176,12 @@ describe DesignManagement::SaveDesignsService do
expect(updated_designs.first.versions.size).to eq(2)
end
- it 'increments the update counter' do
+ it 'records the correct events' do
counter = Gitlab::UsageDataCounters::DesignsCounter
- expect { run_service }.to change { counter.read(:update) }.by 1
+ expect { run_service }
+ .to change { counter.read(:update) }.by(1)
+ .and change { Event.count }.by(1)
+ .and change { Event.for_design.updated_action.count }.by(1)
end
context 'when uploading a new design' do
@@ -217,6 +230,14 @@ describe DesignManagement::SaveDesignsService do
.and change { counter.read(:update) }.by(1)
end
+ it 'creates the correct activity stream events' do
+ expect { run_service }
+ .to change { Event.count }.by(2)
+ .and change { Event.for_design.count }.by(2)
+ .and change { Event.created_action.count }.by(1)
+ .and change { Event.updated_action.count }.by(1)
+ end
+
it 'creates a single commit' do
commit_count = -> do
design_repository.expire_all_method_caches