Skip to content

Commit

Permalink
feat: Adding tests to CheckoutSessionController. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Dec 28, 2022
1 parent 4b62332 commit 5f9d1cf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/app_web/controllers/checkout_session_controller_test.exs
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

0 comments on commit 5f9d1cf

Please sign in to comment.