class XmlMiniTest::RenameKeyTest

Public Instance Methods

test_rename_key_camelizes_with_camelize_true() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 24
def test_rename_key_camelizes_with_camelize_true
  assert_equal "MyKey", ActiveSupport::XmlMini.rename_key("my_key", camelize: true)
end
test_rename_key_dasherizes_by_default() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 12
def test_rename_key_dasherizes_by_default
  assert_equal "my-key", ActiveSupport::XmlMini.rename_key("my_key")
end
test_rename_key_dasherizes_with_dasherize_true() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 16
def test_rename_key_dasherizes_with_dasherize_true
  assert_equal "my-key", ActiveSupport::XmlMini.rename_key("my_key", dasherize: true)
end
test_rename_key_does_not_dasherize_leading_underscores() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 36
def test_rename_key_does_not_dasherize_leading_underscores
  assert_equal "_id", ActiveSupport::XmlMini.rename_key("_id")
end
test_rename_key_does_not_dasherize_multiple_leading_underscores() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 52
def test_rename_key_does_not_dasherize_multiple_leading_underscores
  assert_equal "__id", ActiveSupport::XmlMini.rename_key("__id")
end
test_rename_key_does_not_dasherize_multiple_trailing_underscores() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 56
def test_rename_key_does_not_dasherize_multiple_trailing_underscores
  assert_equal "id__", ActiveSupport::XmlMini.rename_key("id__")
end
test_rename_key_does_not_dasherize_trailing_underscores() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 44
def test_rename_key_does_not_dasherize_trailing_underscores
  assert_equal "id_", ActiveSupport::XmlMini.rename_key("id_")
end
test_rename_key_does_nothing_with_dasherize_false() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 20
def test_rename_key_does_nothing_with_dasherize_false
  assert_equal "my_key", ActiveSupport::XmlMini.rename_key("my_key", dasherize: false)
end
test_rename_key_lower_camelizes_with_camelize_lower() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 28
def test_rename_key_lower_camelizes_with_camelize_lower
  assert_equal "myKey", ActiveSupport::XmlMini.rename_key("my_key", camelize: :lower)
end
test_rename_key_lower_camelizes_with_camelize_upper() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 32
def test_rename_key_lower_camelizes_with_camelize_upper
  assert_equal "MyKey", ActiveSupport::XmlMini.rename_key("my_key", camelize: :upper)
end
test_rename_key_with_leading_underscore_dasherizes_interior_underscores() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 40
def test_rename_key_with_leading_underscore_dasherizes_interior_underscores
  assert_equal "_my-key", ActiveSupport::XmlMini.rename_key("_my_key")
end
test_rename_key_with_trailing_underscore_dasherizes_interior_underscores() click to toggle source
# File activesupport/test/xml_mini_test.rb, line 48
def test_rename_key_with_trailing_underscore_dasherizes_interior_underscores
  assert_equal "my-key_", ActiveSupport::XmlMini.rename_key("my_key_")
end