#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
def regenerate!
return unless can_regenerate?(platform)
return unless can_regenerate?
Resque.push(
'publish_worker_default',
'class' => 'AbfWorker::PublishWorkerDefault',
'args' => [{
id: Time.now.to_i,
cmd_params: cmd_params(platform),
cmd_params: cmd_params,
main_script: 'regenerate_platform_metadata.sh',
platform: {
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