gitlab-org--gitlab-foss/spec/services/wiki_pages/create_service_spec.rb
Zeger-Jan van de Weg 92482e01b4
Bump Gitaly to 0.98.0
Hooks were run for wikis, but given the internal API wasn't responding
failures happended, as seen on:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18693
2018-05-07 14:10:04 +02:00

38 lines
847 B
Ruby

require 'spec_helper'
describe WikiPages::CreateService do
let(:project) { create(:project, :wiki_repo) }
let(:user) { create(:user) }
let(:opts) do
{
title: 'Title',
content: 'Content for wiki page',
format: 'markdown'
}
end
subject(:service) { described_class.new(project, user, opts) }
before do
project.add_developer(user)
end
describe '#execute' do
it 'creates wiki page with valid attributes' do
page = service.execute
expect(page).to be_valid
expect(page.title).to eq(opts[:title])
expect(page.content).to eq(opts[:content])
expect(page.format).to eq(opts[:format].to_sym)
end
it 'executes webhooks' do
expect(service).to receive(:execute_hooks).once
.with(instance_of(WikiPage), 'create')
service.execute
end
end
end