diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-31 14:35:57 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-31 14:35:57 +0000 |
commit | bd33a8290a34048b90818280edeb4e597de8a6ed (patch) | |
tree | 5f9a7c06dba263c4520cb235d0825f8e8ae9f0e5 /spec/models | |
parent | 568508c7d549a3f498a72db824c9d97f4ba0e098 (diff) | |
parent | b3a0166203e4b187de8956a14b40957f7d967e32 (diff) | |
download | gitlab-ce-bd33a8290a34048b90818280edeb4e597de8a6ed.tar.gz |
Merge branch 'feature/migrate-wiki-delete-page-to-gitaly' into 'master'
Migrate Gitlab::Git::Wiki#delete_page to Gitaly
Closes gitaly#673
See merge request gitlab-org/gitlab-ce!14910
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_wiki_spec.rb | 38 | ||||
-rw-r--r-- | spec/models/wiki_page_spec.rb | 2 |
2 files changed, 25 insertions, 15 deletions
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb index f10d9383ae2..95d58b96f33 100644 --- a/spec/models/project_wiki_spec.rb +++ b/spec/models/project_wiki_spec.rb @@ -265,23 +265,33 @@ describe ProjectWiki do end describe "#delete_page" do - before do - create_page("index", "some content") - @page = subject.wiki.page(title: "index") - end + shared_examples 'deleting a wiki page' do + before do + create_page("index", "some content") + @page = subject.wiki.page(title: "index") + end - it "deletes the page" do - subject.delete_page(@page) - expect(subject.pages.count).to eq(0) - end + it "deletes the page" do + subject.delete_page(@page) + expect(subject.pages.count).to eq(0) + end - it 'updates project activity' do - subject.delete_page(@page) + it 'updates project activity' do + subject.delete_page(@page) - 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_delete_page is enabled' do + it_behaves_like 'deleting a wiki page' + end + + context 'when Gitaly wiki_delete_page is disabled', :skip_gitaly_mock do + it_behaves_like 'deleting a wiki page' end end @@ -343,6 +353,6 @@ describe ProjectWiki do end def destroy_page(page) - subject.delete_page(page, commit_details) + subject.delete_page(page, "test commit") end end diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 1f14d06997e..a7227b38850 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -402,7 +402,7 @@ describe WikiPage do def destroy_page(title) page = wiki.wiki.page(title: title) - wiki.delete_page(page, commit_details) + wiki.delete_page(page, "test commit") end def get_slugs(page_or_dir) |