-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding tests to CheckoutSessionController. #1
- Loading branch information
1 parent
4b62332
commit 5f9d1cf
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
test/app_web/controllers/checkout_session_controller_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defmodule AppWeb.CheckoutSessionControllerTest do | ||
use AppWeb.ConnCase | ||
import App.ConnFixtures | ||
|
||
import Mock | ||
|
||
test "get redirection to stripe checkout session with loggedin user", %{conn: conn} do | ||
conn = setup_conn_with_user(conn) | ||
url_to_be_redirected_to = "www.session_url.com" | ||
|
||
with_mock Stripe.Session, [create: fn(_params) -> {:ok, %{url: url_to_be_redirected_to}} end] do | ||
|
||
conn = post(conn, ~p"/purchase/checkout-session", %{}) | ||
|
||
assert redirected_to(conn, 303) == url_to_be_redirected_to | ||
end | ||
end | ||
end |