From 96f8ea33a5c700e2b1dd53e5cf99a7ad5e48ccc8 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 20 Jun 2014 00:44:56 +0400 Subject: [PATCH] #403: added specs for AbfWorkerService::PlatformMetadata --- .../abf_worker_service/platform_metadata.rb | 4 ++-- .../platform_metadata_spec.rb | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 spec/services/abf_worker_service/platform_metadata_spec.rb diff --git a/app/services/abf_worker_service/platform_metadata.rb b/app/services/abf_worker_service/platform_metadata.rb index 9fe6efe52..d59757d7f 100644 --- a/app/services/abf_worker_service/platform_metadata.rb +++ b/app/services/abf_worker_service/platform_metadata.rb @@ -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", diff --git a/spec/services/abf_worker_service/platform_metadata_spec.rb b/spec/services/abf_worker_service/platform_metadata_spec.rb new file mode 100644 index 000000000..bd589afc5 --- /dev/null +++ b/spec/services/abf_worker_service/platform_metadata_spec.rb @@ -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