aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/attributes_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/test/cases/attributes_test.rb')
-rw-r--r--activemodel/test/cases/attributes_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activemodel/test/cases/attributes_test.rb b/activemodel/test/cases/attributes_test.rb
index 5483fb101d..af0ddcb92f 100644
--- a/activemodel/test/cases/attributes_test.rb
+++ b/activemodel/test/cases/attributes_test.rb
@@ -67,6 +67,20 @@ module ActiveModel
assert_equal expected_attributes, data.attributes
end
+ test "reading attribute names" do
+ names = [
+ "integer_field",
+ "string_field",
+ "decimal_field",
+ "string_with_default",
+ "date_field",
+ "boolean_field"
+ ]
+
+ assert_equal names, ModelForAttributesTest.attribute_names
+ assert_equal names, ModelForAttributesTest.new.attribute_names
+ end
+
test "nonexistent attribute" do
assert_raise ActiveModel::UnknownAttributeError do
ModelForAttributesTest.new(nonexistent: "nonexistent")