#403: added specs for AbfWorkerService::PlatformMetadata
This commit is contained in:
parent
9d40bfc291
commit
96f8ea33a5
|
@ -8,14 +8,14 @@ module AbfWorkerService
|
||||||
end
|
end
|
||||||
|
|
||||||
def regenerate!
|
def regenerate!
|
||||||
return unless can_regenerate?(platform)
|
return unless can_regenerate?
|
||||||
|
|
||||||
Resque.push(
|
Resque.push(
|
||||||
'publish_worker_default',
|
'publish_worker_default',
|
||||||
'class' => 'AbfWorker::PublishWorkerDefault',
|
'class' => 'AbfWorker::PublishWorkerDefault',
|
||||||
'args' => [{
|
'args' => [{
|
||||||
id: Time.now.to_i,
|
id: Time.now.to_i,
|
||||||
cmd_params: cmd_params(platform),
|
cmd_params: cmd_params,
|
||||||
main_script: 'regenerate_platform_metadata.sh',
|
main_script: 'regenerate_platform_metadata.sh',
|
||||||
platform: {
|
platform: {
|
||||||
platform_path: "#{platform.path}/repository",
|
platform_path: "#{platform.path}/repository",
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe AbfWorkerService::PlatformMetadata do
|
||||||
|
let(:platform) { FactoryGirl.build(:platform, id: 123) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_symlink_methods
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { AbfWorkerService::PlatformMetadata.new(platform) }
|
||||||
|
|
||||||
|
context '#regenerate!' do
|
||||||
|
|
||||||
|
it 'creates task' do
|
||||||
|
expect(platform).to receive(:start_regeneration).and_return(true)
|
||||||
|
expect(Resque).to receive(:push)
|
||||||
|
subject.regenerate!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue