debian-mirror-gitlab/spec/services/projects/update_pages_configuration_service_spec.rb

43 lines
998 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
2017-09-10 17:25:29 +05:30
describe Projects::UpdatePagesConfigurationService do
let(:project) { create(:project) }
2019-03-02 22:35:43 +05:30
let(:service) { described_class.new(project) }
2017-08-17 22:00:37 +05:30
describe "#update" do
let(:file) { Tempfile.new('pages-test') }
2019-03-02 22:35:43 +05:30
subject { service.execute }
2017-08-17 22:00:37 +05:30
after do
file.close
file.unlink
end
2019-03-02 22:35:43 +05:30
before do
allow(service).to receive(:pages_config_file).and_return(file.path)
end
context 'when configuration changes' do
it 'updates the .update file' do
expect(service).to receive(:reload_daemon).and_call_original
expect(subject).to include(status: :success, reload: true)
end
end
context 'when configuration does not change' do
before do
# we set the configuration
service.execute
end
it 'does not update the .update file' do
expect(service).not_to receive(:reload_daemon)
2017-08-17 22:00:37 +05:30
2019-03-02 22:35:43 +05:30
expect(subject).to include(status: :success, reload: false)
end
2017-08-17 22:00:37 +05:30
end
end
end