Project

General

Profile

Defect #1095 ยป extend-project-homepage-length.patch

Eric Davis, 2008-05-07 02:38

View differences:

app/models/project.rb
57 57
  validates_associated :custom_values, :on => :update
58 58
  validates_associated :repository, :wiki
59 59
  validates_length_of :name, :maximum => 30
60
  validates_length_of :homepage, :maximum => 60
60
  validates_length_of :homepage, :maximum => 254
61 61
  validates_length_of :identifier, :in => 3..20
62 62
  validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
63 63
  
db/migrate/094_extend_project_homepage_url.rb
1
class ExtendProjectHomepageUrl < ActiveRecord::Migration
2
  def self.up
3
    change_column :projects, :homepage, :string, :limit => 255, :default => ""
4
  end
5

  
6
  def self.down
7
    change_column :projects, :homepage, :string, :limit => 60, :default => ""
8
  end
9
end
test/unit/project_test.rb
45 45
    assert_equal "activerecord_error_blank", @ecookbook.errors.on(:name)
46 46
  end
47 47
  
48
  def test_long_homepage
49
    @ecookbook.homepage = 'a' * 250
50
    assert @ecookbook.save
51
    assert_equal 0, @ecookbook.errors.count
52
    assert_not_equal "activerecord_error_too_long", @ecookbook.errors.on(:homepage)
53
  end
54
  
48 55
  def test_public_projects
49 56
    public_projects = Project.find(:all, :conditions => ["is_public=?", true])
50 57
    assert_equal 3, public_projects.length
    (1-1/1)