#403: added specs for AbfWorkerService::PlatformMetadata

This commit is contained in:
Vokhmin Alexey V 2014-06-20 00:44:56 +04:00
parent 9d40bfc291
commit 96f8ea33a5
2 changed files with 24 additions and 2 deletions

View File

@ -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",

View File

@ -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