rosa-build/spec/models/product_spec.rb

38 lines
958 B
Ruby
Raw Normal View History

2012-01-30 20:39:34 +00:00
# -*- encoding : utf-8 -*-
require 'spec_helper'
describe Product do
before(:all) do
stub_symlink_methods
Platform.delete_all
User.delete_all
Product.delete_all
2012-12-13 19:23:34 +00:00
init_test_root
# 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) }
it { should ensure_length_of(:main_script).is_at_most(255) }
it { should ensure_length_of(:params).is_at_most(255) }
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) }
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
end
end