Commit 4355ebde authored by Patrick Bajao's avatar Patrick Bajao

Update CE specific specs to match CE version

The following specs don't match their versions in CE:
- `spec/services/wiki_pages/create_service_spec.rb`
- `spec/services/wiki_pages/destroy_service_spec.rb`
- `spec/services/wiki_pages/update_service_spec.rb`

There's actually no difference in logic as they work
the same way. But there's difference in how they were
written.

To ensure that there'll be no conflicts, the CE version
of the said specs has been copy-pasted to overwrite the
EE version.
parent d6da1b59
...@@ -15,7 +15,7 @@ describe WikiPages::CreateService do ...@@ -15,7 +15,7 @@ describe WikiPages::CreateService do
subject(:service) { described_class.new(project, user, opts) } subject(:service) { described_class.new(project, user, opts) }
before do before do
project.add_maintainer(user) project.add_developer(user)
end end
describe '#execute' do describe '#execute' do
...@@ -23,11 +23,14 @@ describe WikiPages::CreateService do ...@@ -23,11 +23,14 @@ describe WikiPages::CreateService do
page = service.execute page = service.execute
expect(page).to be_valid expect(page).to be_valid
expect(page).to have_attributes(title: opts[:title], content: opts[:content], format: opts[:format].to_sym) expect(page.title).to eq(opts[:title])
expect(page.content).to eq(opts[:content])
expect(page.format).to eq(opts[:format].to_sym)
end end
it 'executes webhooks' do it 'executes webhooks' do
expect(service).to receive(:execute_hooks).once.with(instance_of(WikiPage), 'create') expect(service).to receive(:execute_hooks).once
.with(instance_of(WikiPage), 'create')
service.execute service.execute
end end
......
...@@ -8,12 +8,13 @@ describe WikiPages::DestroyService do ...@@ -8,12 +8,13 @@ describe WikiPages::DestroyService do
subject(:service) { described_class.new(project, user) } subject(:service) { described_class.new(project, user) }
before do before do
project.add_maintainer(user) project.add_developer(user)
end end
describe '#execute' do describe '#execute' do
it 'executes webhooks' do it 'executes webhooks' do
expect(service).to receive(:execute_hooks).once.with(instance_of(WikiPage), 'delete') expect(service).to receive(:execute_hooks).once
.with(instance_of(WikiPage), 'delete')
service.execute(page) service.execute(page)
end end
......
...@@ -17,7 +17,7 @@ describe WikiPages::UpdateService do ...@@ -17,7 +17,7 @@ describe WikiPages::UpdateService do
subject(:service) { described_class.new(project, user, opts) } subject(:service) { described_class.new(project, user, opts) }
before do before do
project.add_maintainer(user) project.add_developer(user)
end end
describe '#execute' do describe '#execute' do
...@@ -25,13 +25,15 @@ describe WikiPages::UpdateService do ...@@ -25,13 +25,15 @@ describe WikiPages::UpdateService do
updated_page = service.execute(page) updated_page = service.execute(page)
expect(updated_page).to be_valid expect(updated_page).to be_valid
expect(updated_page).to have_attributes(message: opts[:message], content: opts[:content], format: opts[:format].to_sym) expect(updated_page.message).to eq(opts[:message])
expect(updated_page.content).to eq(opts[:content])
expect(updated_page.format).to eq(opts[:format].to_sym)
expect(updated_page.title).to eq(opts[:title]) expect(updated_page.title).to eq(opts[:title])
end end
it 'executes webhooks' do it 'executes webhooks' do
expect(service).to receive(:execute_hooks).once.with(instance_of(WikiPage), 'update') expect(service).to receive(:execute_hooks).once
.with(instance_of(WikiPage), 'update')
service.execute(page) service.execute(page)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment