diff --git a/spec/factories/product_build_lists.rb b/spec/factories/product_build_lists.rb index 978851e86..4c2a12e2b 100644 --- a/spec/factories/product_build_lists.rb +++ b/spec/factories/product_build_lists.rb @@ -9,8 +9,5 @@ FactoryGirl.define do params 'ENV=i586' time_living 150 project_version 'master' - - # see: before_validation in ProductBuildList model - before(:create) { Arch.find_or_create_by_name('x86_64') } end end diff --git a/spec/factories/products.rb b/spec/factories/products.rb index bdb76aedf..9dc367097 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -5,5 +5,8 @@ FactoryGirl.define do association :platform, :factory => :platform association :project, :factory => :project_with_commit time_living 150 + + # see: before_validation in ProductBuildList model + before(:create) { Arch.find_or_create_by_name('x86_64') } end end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index b23aee44d..6034ec74d 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -30,8 +30,10 @@ describe Product do context 'by autostart_status = once_a_12_hours' do before do - product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS) - FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY) + stub_symlink_methods + stub_redis + product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS, :main_script => 'text.sh') + FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY, :main_script => 'text.sh') end it 'should be created only one product_build_list' do @@ -39,6 +41,7 @@ describe Product do end it 'product should has product_build_list' do + Product.autostart_iso_builds Product::ONCE_A_12_HOURS product.product_build_lists.should have(1).item end