diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-10-13 15:11:53 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-10-16 15:53:48 +0200 |
commit | fa5eeaecfb85d428395ef76999c60f37cf185990 (patch) | |
tree | 07763d8b467cb1103f577c6dfdf67884c79de392 /spec/models/project_wiki_spec.rb | |
parent | d7326003a0317a5abc98a830bfac2f54ad752c08 (diff) | |
download | gitlab-ce-fa5eeaecfb85d428395ef76999c60f37cf185990.tar.gz |
Migrate Gitlab::Git::Wiki#write_page to Gitalyfeature/migrate-wiki-write-page-to-gitaly
Closes gitaly#638
Diffstat (limited to 'spec/models/project_wiki_spec.rb')
-rw-r--r-- | spec/models/project_wiki_spec.rb | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb index 78fb2df884a..f10d9383ae2 100644 --- a/spec/models/project_wiki_spec.rb +++ b/spec/models/project_wiki_spec.rb @@ -180,37 +180,47 @@ describe ProjectWiki do end describe "#create_page" do - after do - destroy_page(subject.pages.first.page) - end + shared_examples 'creating a wiki page' do + after do + destroy_page(subject.pages.first.page) + end - it "creates a new wiki page" do - expect(subject.create_page("test page", "this is content")).not_to eq(false) - expect(subject.pages.count).to eq(1) - end + it "creates a new wiki page" do + expect(subject.create_page("test page", "this is content")).not_to eq(false) + expect(subject.pages.count).to eq(1) + end - it "returns false when a duplicate page exists" do - subject.create_page("test page", "content") - expect(subject.create_page("test page", "content")).to eq(false) - end + it "returns false when a duplicate page exists" do + subject.create_page("test page", "content") + expect(subject.create_page("test page", "content")).to eq(false) + end - it "stores an error message when a duplicate page exists" do - 2.times { subject.create_page("test page", "content") } - expect(subject.error_message).to match(/Duplicate page:/) - end + it "stores an error message when a duplicate page exists" do + 2.times { subject.create_page("test page", "content") } + expect(subject.error_message).to match(/Duplicate page:/) + end - it "sets the correct commit message" do - subject.create_page("test page", "some content", :markdown, "commit message") - expect(subject.pages.first.page.version.message).to eq("commit message") - end + it "sets the correct commit message" do + subject.create_page("test page", "some content", :markdown, "commit message") + expect(subject.pages.first.page.version.message).to eq("commit message") + end - it 'updates project activity' do - subject.create_page('Test Page', 'This is content') + it 'updates project activity' do + subject.create_page('Test Page', 'This is content') - project.reload + project.reload - expect(project.last_activity_at).to be_within(1.minute).of(Time.now) - expect(project.last_repository_updated_at).to be_within(1.minute).of(Time.now) + expect(project.last_activity_at).to be_within(1.minute).of(Time.now) + expect(project.last_repository_updated_at).to be_within(1.minute).of(Time.now) + end + end + + context 'when Gitaly wiki_write_page is enabled' do + it_behaves_like 'creating a wiki page' + end + + context 'when Gitaly wiki_write_page is disabled', :skip_gitaly_mock do + it_behaves_like 'creating a wiki page' end end |