summaryrefslogtreecommitdiff
path: root/spec/models/wiki_page_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 12:09:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 12:09:33 +0000
commit652bd073731b0028641672a75355c7918b5ac116 (patch)
treee0239f98153492ac89c6fc374c5dfd1aa270d8bf /spec/models/wiki_page_spec.rb
parent2af90cef2e2e9c776eae4394a43dba3be7f33d1e (diff)
downloadgitlab-ce-652bd073731b0028641672a75355c7918b5ac116.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r--spec/models/wiki_page_spec.rb30
1 files changed, 27 insertions, 3 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 42a7d567613..e8e80a8c7f4 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -606,12 +606,36 @@ describe WikiPage do
expect(subject).to eq(subject)
end
- it 'returns false for updated wiki page' do
+ it 'returns true for updated wiki page' do
subject.update(content: "Updated content")
- updated_page = wiki.find_page('test page')
+ updated_page = wiki.find_page(existing_page.slug)
expect(updated_page).not_to be_nil
- expect(updated_page).not_to eq(subject)
+ expect(updated_page).to eq(subject)
+ end
+
+ it 'returns false for a completely different wiki page' do
+ other_page = create(:wiki_page)
+
+ expect(subject.slug).not_to eq(other_page.slug)
+ expect(subject.project).not_to eq(other_page.project)
+ expect(subject).not_to eq(other_page)
+ end
+
+ it 'returns false for page with different slug on same project' do
+ other_page = create(:wiki_page, project: subject.project)
+
+ expect(subject.slug).not_to eq(other_page.slug)
+ expect(subject.project).to eq(other_page.project)
+ expect(subject).not_to eq(other_page)
+ end
+
+ it 'returns false for page with the same slug on a different project' do
+ other_page = create(:wiki_page, title: existing_page.slug)
+
+ expect(subject.slug).to eq(other_page.slug)
+ expect(subject.project).not_to eq(other_page.project)
+ expect(subject).not_to eq(other_page)
end
end