forked from e621ng/e621ng
added tests for user.find_name
This commit is contained in:
parent
4724f39951
commit
305f4d4607
@ -14,8 +14,25 @@ class UserTest < ActiveSupport::TestCase
|
|||||||
assert(!User.authenticate_hash(@user.name, "xxxx"), "Authentication should not have succeeded")
|
assert(!User.authenticate_hash(@user.name, "xxxx"), "Authentication should not have succeeded")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "name" do
|
||||||
|
should "be #{Danbooru.config.default_guest_name} given an invalid user id" do
|
||||||
|
assert_equal(Danbooru.config.default_guest_name, User.find_name(-1))
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be fetched given a user id" do
|
||||||
|
@user = Factory.create(:user)
|
||||||
|
assert_equal(@user.name, User.find_name(@user.id))
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be updated" do
|
||||||
|
@user = Factory.create(:user)
|
||||||
|
@user.update_attribute(:name, "danzig")
|
||||||
|
assert_equal("danzig", User.find_name(@user.id))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "password" do
|
context "password" do
|
||||||
should "confirm its password" do
|
should "match the confirmation" do
|
||||||
@user = Factory.create(:user)
|
@user = Factory.create(:user)
|
||||||
@user.password = "zugzug5"
|
@user.password = "zugzug5"
|
||||||
@user.password_confirmation = "zugzug5"
|
@user.password_confirmation = "zugzug5"
|
||||||
@ -24,7 +41,7 @@ class UserTest < ActiveSupport::TestCase
|
|||||||
assert(User.authenticate(@user.name, "zugzug5"), "Authentication should have succeeded")
|
assert(User.authenticate(@user.name, "zugzug5"), "Authentication should have succeeded")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "must match the confirmation" do
|
should "match the confirmation" do
|
||||||
@user = Factory.create(:user)
|
@user = Factory.create(:user)
|
||||||
@user.password = "zugzug6"
|
@user.password = "zugzug6"
|
||||||
@user.password_confirmation = "zugzug5"
|
@user.password_confirmation = "zugzug5"
|
||||||
|
Loading…
Reference in New Issue
Block a user