Permalink
Browse files

Requires gem names to have at least one alpha character

  • Loading branch information...
1 parent d3c1879 commit ae7e35e33617bab68e3d6fd0506bb65cb59ac600 @adkron committed Nov 4, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −1 app/models/rubygem.rb
  2. +1 −0 test/unit/rubygem_test.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"
@@ -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 ae7e35e

Please sign in to comment.