Requires gem names to have at least one alpha character #476

Merged
merged 1 commit into from Nov 5, 2012
View
2 app/models/rubygem.rb
@@ -250,7 +250,7 @@ def first_built_date
def ensure_name_format
if name.class != String
errors.add :name, "must be a String"
- elsif name =~ /\A[\d]+\Z/
+ elsif name !~ /[a-zA-Z]+/
errors.add :name, "must include at least one letter"
elsif name !~ NAME_PATTERN
errors.add :name, "can only include letters, numbers, dashes, and underscores"
View
1 test/unit/rubygem_test.rb
@@ -20,6 +20,7 @@ class RubygemTest < ActiveSupport::TestCase
should allow_value("rack-test").for(:name)
should allow_value("perftools.rb").for(:name)
should_not allow_value("\342\230\203").for(:name)
+ should_not allow_value("2.2").for(:name)
should "reorder versions with platforms properly" do
version3_ruby = create(:version, :rubygem => @rubygem, :number => "3.0.0", :platform => "ruby")