summaryrefslogtreecommitdiff
path: root/spec/models/wiki_page_spec.rb
diff options
context:
space:
mode:
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