class TestString

Public Instance Methods

test_blank?() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 10
def test_blank?
  assert_equal true, ''.respond_to?(:"blank?")
  assert_equal true, ''.blank?
  assert_equal true, ' '.blank?
  assert_equal false, 'test'.blank?
end
test_camelize() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 43
def test_camelize
  assert_equal true, ''.respond_to?(:"camelize")
  assert_equal 'TestModel', 'test_model'.camelize
  assert_equal 'testModel', 'test_model'.camelize(:lowercase_first_letter)
end
test_it_has_each() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 70
def test_it_has_each
  assert_equal true, ''.respond_to?(:each)
end
test_pluralize() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 23
def test_pluralize
  assert_equal true, ''.respond_to?(:"pluralize")
  assert_equal 'instances', 'instance'.pluralize
  assert_equal 'properties', 'property'.pluralize
  assert_equal 'addresses', 'address'.pluralize
end
test_singularize() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 30
def test_singularize
  assert_equal true, ''.respond_to?(:"singularize")
  assert_equal 'instance', 'instances'.singularize
  assert_equal 'property', 'properties'.singularize
  assert_equal 'address', 'addresses'.singularize
end
test_titlecase() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 17
def test_titlecase
  assert_equal true, ''.respond_to?(:"titlecase")
  assert_equal "This Is A String", 'this is a string'.titlecase
  assert_equal 'This', 'this'.titlecase
end
test_truncate() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 62
def test_truncate
  assert_equal true, ''.respond_to?(:"truncate")
  assert_equal 'ThisIs...cated', 'ThisIsALogStringThatNeedsToBeTruncated'.truncate
  assert_equal 'Thi...ed', 'ThisIsALogStringThatNeedsToBeTruncated'.truncate(5)
  assert_equal 'T...', 'ThisIsALogStringThatNeedsToBeTruncated'.truncate(1)
  assert_equal 'This', 'This'.truncate(10)
end
test_uncapitalize() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 49
def test_uncapitalize
  assert_equal true, ''.respond_to?(:"uncapitalize")
  assert_equal 'testModel', 'TestModel'.uncapitalize
  assert_equal 'test', 'Test'.uncapitalize
end
test_underscore() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 37
def test_underscore
  assert_equal true, ''.respond_to?(:"underscore")
  assert_equal 'test_model', 'TestModel'.underscore
  assert_equal 'test/model', 'Test::Model'.underscore
end
test_upcase_first() click to toggle source
# File tests/helpers/core_ext/string_test.rb, line 55
def test_upcase_first
  assert_equal true, ''.respond_to?(:"upcase_first")
  assert_equal 'Test', 'test'.upcase_first
  assert_equal 'Test', 'Test'.upcase_first
  assert_equal 'TestModel', 'testModel'.upcase_first
end