2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-04-11 09:35:08 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Product do
|
2012-04-03 13:21:39 +01:00
|
|
|
before(:all) do
|
2012-05-16 16:29:28 +01:00
|
|
|
stub_symlink_methods
|
2012-04-03 13:21:39 +01:00
|
|
|
Platform.delete_all
|
|
|
|
User.delete_all
|
|
|
|
Product.delete_all
|
2012-12-13 19:23:34 +00:00
|
|
|
init_test_root
|
2012-04-03 13:21:39 +01:00
|
|
|
# Need for validate_uniqueness_of check
|
|
|
|
FactoryGirl.create(:product)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should belong_to(:platform) }
|
|
|
|
it { should have_many(:product_build_lists)}
|
|
|
|
|
|
|
|
it { should validate_presence_of(:name)}
|
|
|
|
it { should validate_uniqueness_of(:name).scoped_to(:platform_id) }
|
|
|
|
|
2013-02-15 16:20:06 +00:00
|
|
|
it { should ensure_length_of(:main_script).is_at_most(255) }
|
|
|
|
it { should ensure_length_of(:params).is_at_most(255) }
|
|
|
|
|
2012-04-03 13:21:39 +01:00
|
|
|
it { should have_readonly_attribute(:platform_id) }
|
|
|
|
|
|
|
|
it { should_not allow_mass_assignment_of(:platform) }
|
2013-02-04 16:24:06 +00:00
|
|
|
#it { should_not allow_mass_assignment_of(:platform_id) }
|
2012-04-03 13:21:39 +01:00
|
|
|
it { should_not allow_mass_assignment_of(:product_build_lists) }
|
|
|
|
|
|
|
|
after(:all) do
|
|
|
|
Platform.delete_all
|
|
|
|
User.delete_all
|
|
|
|
Product.delete_all
|
2012-12-13 19:23:34 +00:00
|
|
|
clear_test_root
|
2012-04-03 13:21:39 +01:00
|
|
|
end
|
|
|
|
|
2012-04-04 22:43:06 +01:00
|
|
|
end
|