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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-14 15:08:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-14 15:08:21 +0300
commit674e7e2c3d295704bdf504dd0caa2e5a2d9b5cd2 (patch)
tree7454890d4f7aa8644c9e89954a978466e4416815 /spec/services
parentc7ad2610df033b370845995ac3bbe269a191d9bb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/snippets/update_service_spec.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/services/snippets/update_service_spec.rb b/spec/services/snippets/update_service_spec.rb
index 9f0cb0df474..2d94cc87295 100644
--- a/spec/services/snippets/update_service_spec.rb
+++ b/spec/services/snippets/update_service_spec.rb
@@ -196,14 +196,24 @@ describe Snippets::UpdateService do
end
end
- it 'rolls back any snippet modifications' do
- option_keys = options.stringify_keys.keys
- orig_attrs = snippet.attributes.select { |k, v| k.in?(option_keys) }
+ context 'with snippet modifications' do
+ let(:option_keys) { options.stringify_keys.keys }
- subject
+ it 'rolls back any snippet modifications' do
+ orig_attrs = snippet.attributes.select { |k, v| k.in?(option_keys) }
+
+ subject
+
+ persisted_attrs = snippet.reload.attributes.select { |k, v| k.in?(option_keys) }
+ expect(orig_attrs).to eq persisted_attrs
+ end
+
+ it 'keeps any snippet modifications' do
+ subject
- current_attrs = snippet.attributes.select { |k, v| k.in?(option_keys) }
- expect(orig_attrs).to eq current_attrs
+ instance_attrs = snippet.attributes.select { |k, v| k.in?(option_keys) }
+ expect(options.stringify_keys).to eq instance_attrs
+ end
end
end