Permalink
Browse files

Merge pull request #476 from adkron/issue-426

Requires gem names to have at least one alpha character
  • Loading branch information...
cmeiklejohn committed Nov 5, 2012
2 parents 56505e6 + ae7e35e commit 16ab2f316f3884d723ce0469502d7f49acc8884a
Showing with 2 additions and 1 deletion.
  1. +1 −1 app/models/rubygem.rb
  2. +1 −0 test/unit/rubygem_test.rb
View
@@ -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"
@@ -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")

0 comments on commit 16ab2f3

Please sign in to comment.