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:
authorHiroyuki Sato <h-sato@ruby-dev.jp>2017-03-04 17:03:14 +0300
committerHiroyuki Sato <sathiroyuki@gmail.com>2017-03-08 12:42:50 +0300
commita5521bad4012a9eea21cb067271c8ec1810c6d8c (patch)
tree3544226812c93e9abfcaceafd939fc4a168ecd61 /spec/models/wiki_page_spec.rb
parente78a366925553a1268f8dc6e0d57342053a3240a (diff)
Prevent concurrent editing wiki
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r--spec/models/wiki_page_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 753dc938c52..d76d94c3186 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -208,6 +208,20 @@ describe WikiPage, models: true do
expect(@page.update("more content")).to be_truthy
end
end
+
+ context "with same last commit sha" do
+ it "returns true" do
+ last_commit_sha = @page.commit.sha
+ expect(@page.update("more content", :markdown, nil, last_commit_sha)).to be_truthy
+ end
+ end
+
+ context "with different last commit sha" do
+ it "raises exception" do
+ last_commit_sha = "xxx"
+ expect { @page.update("more content", :markdown, nil, last_commit_sha) }.to raise_error(WikiPage::PageChangedError)
+ end
+ end
end
describe "#destroy" do