Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test for allowing an existing gem to be saved with CAPS in the na…

…me - #421
  • Loading branch information...
commit f1ed5040309a8a67af019085076b91baf66cd820 1 parent 738e1fa
Matt Simpson authored
Showing with 20 additions and 1 deletion.
  1. +20 −1 test/unit/rubygem_test.rb
21 test/unit/rubygem_test.rb
View
@@ -141,7 +141,7 @@ class RubygemTest < ActiveSupport::TestCase
end
end
- context "with a rubygem" do
+ context "with a new rubygem" do
setup do
@rubygem = build(:rubygem, :linkset => nil)
end
@@ -153,6 +153,25 @@ class RubygemTest < ActiveSupport::TestCase
assert_match(/Name/, @rubygem.all_errors)
end
end
+ end
+
+ context "with an existing rubygem" do
+ setup do
+ @rubygem = create(:rubygem, :linkset => nil)
+ end
+
+ should "accept rAils as a name" do
+ @rubygem.name = 'rAils'
+ assert @rubygem.valid?
+ end
+
+ ['1337', 'Snakes!', ['zomg']].each do |bad_name|
+ should "not accept #{bad_name.inspect} as a name" do
+ @rubygem.name = bad_name
+ assert ! @rubygem.valid?
+ assert_match(/Name/, @rubygem.all_errors)
+ end
+ end
should "return linkset errors in #all_errors" do
@specification = gem_specification_from_gem_fixture('test-0.0.0')
Please sign in to comment.
Something went wrong with that request. Please try again.