summaryrefslogtreecommitdiff
path: root/spec/models/wiki_page_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-08-07 16:37:44 +0000
committerRobert Speicher <robert@gitlab.com>2017-08-07 16:37:44 +0000
commitf8d34ab5abc049e42573992c9fa05246b323cd20 (patch)
tree7bb8dcde4ecbf2f2746c0a9d78afdd32537369ac /spec/models/wiki_page_spec.rb
parent7caa37a5531d96484ee5ba4e95369ba37b193753 (diff)
parent29be4e0f58622aea146aa8c362eb30c08b082839 (diff)
downloadgitlab-ce-f8d34ab5abc049e42573992c9fa05246b323cd20.tar.gz
Merge branch 'wiki_title' into 'master'
add feature rename wiki title Closes #27800 See merge request !10069
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r--spec/models/wiki_page_spec.rb35
1 files changed, 24 insertions, 11 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index b7eb412a8de..40a222be24d 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -178,12 +178,12 @@ describe WikiPage do
end
it "updates the content of the page" do
- @page.update("new content")
+ @page.update(content: "new content")
@page = wiki.find_page(title)
end
it "returns true" do
- expect(@page.update("more content")).to be_truthy
+ expect(@page.update(content: "more content")).to be_truthy
end
end
end
@@ -195,29 +195,42 @@ describe WikiPage do
end
after do
- destroy_page("Update")
+ destroy_page(@page.title)
end
context "with valid attributes" do
it "updates the content of the page" do
- @page.update("new content")
+ new_content = "new content"
+
+ @page.update(content: new_content)
@page = wiki.find_page("Update")
+
+ expect(@page.content).to eq("new content")
+ end
+
+ it "updates the title of the page" do
+ new_title = "Index v.1.2.4"
+
+ @page.update(title: new_title)
+ @page = wiki.find_page(new_title)
+
+ expect(@page.title).to eq(new_title)
end
it "returns true" do
- expect(@page.update("more content")).to be_truthy
+ expect(@page.update(content: "more content")).to be_truthy
end
end
context 'with same last commit sha' do
it 'returns true' do
- expect(@page.update('more content', last_commit_sha: @page.last_commit_sha)).to be_truthy
+ expect(@page.update(content: 'more content', last_commit_sha: @page.last_commit_sha)).to be_truthy
end
end
context 'with different last commit sha' do
it 'raises exception' do
- expect { @page.update('more content', last_commit_sha: 'xxx') }.to raise_error(WikiPage::PageChangedError)
+ expect { @page.update(content: 'more content', last_commit_sha: 'xxx') }.to raise_error(WikiPage::PageChangedError)
end
end
end
@@ -249,7 +262,7 @@ describe WikiPage do
end
it "returns an array of all commits for the page" do
- 3.times { |i| @page.update("content #{i}") }
+ 3.times { |i| @page.update(content: "content #{i}") }
expect(@page.versions.count).to eq(4)
end
end
@@ -294,7 +307,7 @@ describe WikiPage do
before do
create_page('Update', 'content')
@page = wiki.find_page('Update')
- 3.times { |i| @page.update("content #{i}") }
+ 3.times { |i| @page.update(content: "content #{i}") }
end
after do
@@ -338,7 +351,7 @@ describe WikiPage do
end
it 'returns false for updated wiki page' do
- updated_wiki_page = original_wiki_page.update("Updated content")
+ updated_wiki_page = original_wiki_page.update(content: "Updated content")
expect(original_wiki_page).not_to eq(updated_wiki_page)
end
end
@@ -360,7 +373,7 @@ describe WikiPage do
it 'is changed after page updated' do
last_commit_sha_before_update = @page.last_commit_sha
- @page.update("new content")
+ @page.update(content: "new content")
@page = wiki.find_page("Update")
expect(@page.last_commit_sha).not_to eq last_commit_sha_before_update