Commit 20c619f8 authored by minibikini's avatar minibikini
Browse files

replace `Repo.get_by(User, nickname: nickname)` with `User.get_by_nickname(nickname)` in tests

parent 9a59c266
......@@ -1021,7 +1021,7 @@ test "it creates a new user", %{conn: conn} do
user = json_response(conn, 200)
fetched_user = Repo.get_by(User, nickname: "lain")
fetched_user = User.get_by_nickname("lain")
assert user == UserView.render("show.json", %{user: fetched_user})
end
......
......@@ -275,7 +275,7 @@ test "it registers a new user and returns the user." do
{:ok, user} = TwitterAPI.register_user(data)
fetched_user = Repo.get_by(User, nickname: "lain")
fetched_user = User.get_by_nickname("lain")
assert UserView.render("show.json", %{user: user}) ==
UserView.render("show.json", %{user: fetched_user})
......@@ -293,7 +293,7 @@ test "it registers a new user with empty string in bio and returns the user." do
{:ok, user} = TwitterAPI.register_user(data)
fetched_user = Repo.get_by(User, nickname: "lain")
fetched_user = User.get_by_nickname("lain")
assert UserView.render("show.json", %{user: user}) ==
UserView.render("show.json", %{user: fetched_user})
......@@ -369,7 +369,7 @@ test "it registers a new user via invite token and returns the user." do
{:ok, user} = TwitterAPI.register_user(data)
fetched_user = Repo.get_by(User, nickname: "vinny")
fetched_user = User.get_by_nickname("vinny")
token = Repo.get_by(UserInviteToken, token: token.token)
assert token.used == true
......@@ -393,7 +393,7 @@ test "it returns an error if invalid token submitted" do
{:error, msg} = TwitterAPI.register_user(data)
assert msg == "Invalid token"
refute Repo.get_by(User, nickname: "GrimReaper")
refute User.get_by_nickname("GrimReaper")
end
@moduletag skip: "needs 'registrations_open: false' in config"
......@@ -414,7 +414,7 @@ test "it returns an error if expired token submitted" do
{:error, msg} = TwitterAPI.register_user(data)
assert msg == "Expired token"
refute Repo.get_by(User, nickname: "GrimReaper")
refute User.get_by_nickname("GrimReaper")
end
test "it returns the error on registration problems" do
......@@ -429,7 +429,7 @@ test "it returns the error on registration problems" do
{:error, error_object} = TwitterAPI.register_user(data)
assert is_binary(error_object[:error])
refute Repo.get_by(User, nickname: "lain")
refute User.get_by_nickname("lain")
end
test "it assigns an integer conversation_id" do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment