assert user.errors[:email].any?
assert user.errors[:pass_crypt].any?
assert user.errors[:display_name].any?
assert user.errors[:email].any?
assert user.errors[:email].any?
assert user.errors[:pass_crypt].any?
assert user.errors[:display_name].any?
assert user.errors[:email].any?
- assert !user.errors[:home_lat].any?
- assert !user.errors[:home_lon].any?
- assert !user.errors[:home_zoom].any?
+ assert user.errors[:home_lat].none?
+ assert user.errors[:home_lon].none?
+ assert user.errors[:home_zoom].none?
- ok = %w(a@s.com test@shaunmcdonald.me.uk hello_local@ping-d.ng
- test_local@openstreetmap.org test-local@example.com)
- bad = %w(hi ht@ n@ @.com help@.me.uk help"hi.me.uk も対@応します
- 輕觸搖晃的遊戲@ah.com も対応します@s.name)
+ ok = %w[a@s.com test@shaunmcdonald.me.uk hello_local@ping-d.ng
+ test_local@openstreetmap.org test-local@example.com]
+ bad = %w[hi ht@ n@ @.com help@.me.uk help"hi.me.uk も対@応します
+ 輕觸搖晃的遊戲@ah.com も対応します@s.name]
- # Don't understand why it isn't allowing a nil value,
- # when the validates statements specifically allow it
- # It appears the database does not allow null values
- assert !user.valid?
+ assert_not user.valid?, "should not allow nil value"
# expact are allowed
# However, would they affect the xml planet dumps?
ok = ["Name", "'me", "he\"", "<hr>", "*ho", "\"help\"@",
# expact are allowed
# However, would they affect the xml planet dumps?
ok = ["Name", "'me", "he\"", "<hr>", "*ho", "\"help\"@",
# These need to be 3 chars in length, otherwise the length test above
# should be used.
bad = ["<hr/>", "test@example.com", "s/f", "aa/", "aa;", "aa.",
"aa,", "aa?", "/;.,?", "も対応します/", "#ping",
"foo\x1fbar", "foo\x7fbar", "foo\ufffebar", "foo\uffffbar",
"new", "terms", "save", "confirm", "confirm-email",
# These need to be 3 chars in length, otherwise the length test above
# should be used.
bad = ["<hr/>", "test@example.com", "s/f", "aa/", "aa;", "aa.",
"aa,", "aa?", "/;.,?", "も対応します/", "#ping",
"foo\x1fbar", "foo\x7fbar", "foo\ufffebar", "foo\uffffbar",
"new", "terms", "save", "confirm", "confirm-email",
- "go_public", "reset-password", "forgot-password", "suspended"]
+ "go_public", "reset-password", "forgot-password", "suspended",
+ "trailing whitespace ", " leading whitespace"]
alice = create(:user, :active)
bob = create(:user, :active)
charlie = create(:user, :active)
alice = create(:user, :active)
bob = create(:user, :active)
charlie = create(:user, :active)
- assert !alice.is_friends_with?(charlie)
- assert !bob.is_friends_with?(alice)
- assert !bob.is_friends_with?(charlie)
- assert !charlie.is_friends_with?(bob)
- assert !charlie.is_friends_with?(alice)
+ assert_not alice.is_friends_with?(charlie)
+ assert_not bob.is_friends_with?(alice)
+ assert_not bob.is_friends_with?(charlie)
+ assert_not charlie.is_friends_with?(bob)
+ assert_not charlie.is_friends_with?(alice)
norm = create(:user, :active)
sec = create(:user, :active)
norm = create(:user, :active)
sec = create(:user, :active)
- assert_equal [sec], norm.friend_users
- assert_equal 1, norm.friend_users.size
+ assert_equal [sec], norm.friends
+ assert_equal 1, norm.friends.size
- assert_equal [], sec.friend_users
- assert_equal 0, sec.friend_users.size
+ assert_equal [], sec.friends
+ assert_equal 0, sec.friends.size
user = create(:user, :languages => ["en"])
assert_equal ["en"], user.languages
user = create(:user, :languages => ["en"])
assert_equal ["en"], user.languages
- user.languages = %w(de fr en)
- assert_equal %w(de fr en), user.languages
- user.languages = %w(fr de sl)
+ user.languages = %w[de fr en]
+ assert_equal %w[de fr en], user.languages
+ user.languages = %w[fr de sl]
- assert_equal %w(fr de sl), user.preferred_languages.map(&:to_s)
- user = create(:user, :languages => %w(en de))
- assert_equal %w(en de), user.languages
+ assert_equal %w[fr de sl], user.preferred_languages.map(&:to_s)
+ user = create(:user, :languages => %w[en de])
+ assert_equal %w[en de], user.languages
- assert_equal true, build(:user, :pending).visible?
- assert_equal true, build(:user, :active).visible?
- assert_equal true, build(:user, :confirmed).visible?
- assert_equal false, build(:user, :suspended).visible?
- assert_equal false, build(:user, :deleted).visible?
+ assert build(:user, :pending).visible?
+ assert build(:user, :active).visible?
+ assert build(:user, :confirmed).visible?
+ assert_not build(:user, :suspended).visible?
+ assert_not build(:user, :deleted).visible?
- assert_equal false, build(:user, :pending).active?
- assert_equal true, build(:user, :active).active?
- assert_equal true, build(:user, :confirmed).active?
- assert_equal false, build(:user, :suspended).active?
- assert_equal false, build(:user, :deleted).active?
+ assert_not build(:user, :pending).active?
+ assert build(:user, :active).active?
+ assert build(:user, :confirmed).active?
+ assert_not build(:user, :suspended).active?
+ assert_not build(:user, :deleted).active?
- assert_equal false, create(:user).moderator?
- assert_equal true, create(:moderator_user).moderator?
+ assert_not create(:user).moderator?
+ assert create(:moderator_user).moderator?
- assert_equal false, create(:user).administrator?
- assert_equal true, create(:administrator_user).administrator?
+ assert_not create(:user).administrator?
+ assert create(:administrator_user).administrator?
- assert_equal false, create(:user).has_role?("administrator")
- assert_equal false, create(:user).has_role?("moderator")
- assert_equal true, create(:administrator_user).has_role?("administrator")
- assert_equal true, create(:moderator_user).has_role?("moderator")
+ assert_not create(:user).has_role?("administrator")
+ assert_not create(:user).has_role?("moderator")
+ assert create(:administrator_user).has_role?("administrator")
+ assert create(:moderator_user).has_role?("moderator")
- assert_equal false, user.visible?
- assert_equal false, user.active?
+ assert_not user.visible?
+ assert_not user.active?