Skip to content

Commit

Permalink
Improved test
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 24, 2024
1 parent 7540cc9 commit ad4d445
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,17 @@ def test_attributes_not_loaded
skip if mongoid?

User.create!(email: "[email protected]")
user = User.select("id").last
user = User.select("id", "phone_ciphertext").last
assert_nil user.attributes["email"]
assert !user.has_attribute?("name")
assert !user.has_attribute?(:name)

assert_equal ["id"], user.attributes.keys
assert_equal ["id"], user.attribute_names
assert_equal ["id", "phone_ciphertext", "phone"], user.attributes.keys
assert_equal ["id", "phone_ciphertext", "phone"], user.attribute_names
assert user.has_attribute?("phone_ciphertext")
assert user.has_attribute?(:phone_ciphertext)
assert user.has_attribute?("phone")
assert user.has_attribute?(:phone)
assert !user.has_attribute?("email")
assert !user.has_attribute?(:email)

Expand Down

0 comments on commit ad4d445

Please sign in to comment.