Defect #1095 ยป extend-project-homepage-length.patch
| app/models/project.rb | ||
|---|---|---|
|
validates_associated :custom_values, :on => :update
|
||
|
validates_associated :repository, :wiki
|
||
|
validates_length_of :name, :maximum => 30
|
||
|
validates_length_of :homepage, :maximum => 60
|
||
|
validates_length_of :homepage, :maximum => 254
|
||
|
validates_length_of :identifier, :in => 3..20
|
||
|
validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
|
||
|
|
||
| db/migrate/094_extend_project_homepage_url.rb | ||
|---|---|---|
|
class ExtendProjectHomepageUrl < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
change_column :projects, :homepage, :string, :limit => 255, :default => ""
|
||
|
end
|
||
|
def self.down
|
||
|
change_column :projects, :homepage, :string, :limit => 60, :default => ""
|
||
|
end
|
||
|
end
|
||
| test/unit/project_test.rb | ||
|---|---|---|
|
assert_equal "activerecord_error_blank", @ecookbook.errors.on(:name)
|
||
|
end
|
||
|
|
||
|
def test_long_homepage
|
||
|
@ecookbook.homepage = 'a' * 250
|
||
|
assert @ecookbook.save
|
||
|
assert_equal 0, @ecookbook.errors.count
|
||
|
assert_not_equal "activerecord_error_too_long", @ecookbook.errors.on(:homepage)
|
||
|
end
|
||
|
|
||
|
def test_public_projects
|
||
|
public_projects = Project.find(:all, :conditions => ["is_public=?", true])
|
||
|
assert_equal 3, public_projects.length
|
||