#31: update specs for Product model

This commit is contained in:
Vokhmin Alexey V 2013-03-25 18:22:19 +04:00
parent 9a37bb0a8a
commit 7f1990bbb3
3 changed files with 8 additions and 5 deletions

View File

@ -9,8 +9,5 @@ FactoryGirl.define do
params 'ENV=i586' params 'ENV=i586'
time_living 150 time_living 150
project_version 'master' project_version 'master'
# see: before_validation in ProductBuildList model
before(:create) { Arch.find_or_create_by_name('x86_64') }
end end
end end

View File

@ -5,5 +5,8 @@ FactoryGirl.define do
association :platform, :factory => :platform association :platform, :factory => :platform
association :project, :factory => :project_with_commit association :project, :factory => :project_with_commit
time_living 150 time_living 150
# see: before_validation in ProductBuildList model
before(:create) { Arch.find_or_create_by_name('x86_64') }
end end
end end

View File

@ -30,8 +30,10 @@ describe Product do
context 'by autostart_status = once_a_12_hours' do context 'by autostart_status = once_a_12_hours' do
before do before do
product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS) stub_symlink_methods
FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY) 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 end
it 'should be created only one product_build_list' do it 'should be created only one product_build_list' do
@ -39,6 +41,7 @@ describe Product do
end end
it 'product should has product_build_list' do 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 product.product_build_lists.should have(1).item
end end