#935: add validation for "main_script" and "params" fields, specs
This commit is contained in:
parent
9829b4fa4a
commit
f9845b27ac
|
@ -8,6 +8,7 @@ class Product < ActiveRecord::Base
|
|||
|
||||
validates :name, :presence => true, :uniqueness => {:scope => :platform_id}
|
||||
validates :project_id, :presence => true
|
||||
validates :main_script, :params, :length => { :maximum => 255 }
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ class ProductBuildList < ActiveRecord::Base
|
|||
:main_script,
|
||||
:arch_id, :presence => true
|
||||
validates :status, :inclusion => { :in => STATUSES }
|
||||
validates :main_script, :params, :length => { :maximum => 255 }
|
||||
|
||||
attr_accessor :base_url
|
||||
attr_accessible :status,
|
||||
|
|
|
@ -8,6 +8,9 @@ describe ProductBuildList do
|
|||
|
||||
it { should belong_to(:product) }
|
||||
|
||||
it { should ensure_length_of(:main_script).is_at_most(255) }
|
||||
it { should ensure_length_of(:params).is_at_most(255) }
|
||||
|
||||
it { should validate_presence_of(:product_id)}
|
||||
it { should validate_presence_of(:status)}
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ describe Product do
|
|||
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) }
|
||||
|
|
Loading…
Reference in New Issue