Skip to content

Commit

Permalink
Clean up client side redirect tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillplatonov committed Nov 24, 2022
1 parent 3f0b1d6 commit 55072d7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/controllers/concerns/ensure_billing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ def index

get :index

assert_response :success
assert_match "Redirecting", response.body
assert_match(%r{https://totally-real-url}, response.body)
assert_client_side_redirection "https://totally-real-url"

get :index, xhr: true

Expand Down Expand Up @@ -98,9 +96,7 @@ def index

get :index

assert_response :success
assert_match "Redirecting", response.body
assert_match(%r{https://totally-real-url}, response.body)
assert_client_side_redirection "https://totally-real-url"

get :index, xhr: true

Expand Down Expand Up @@ -166,9 +162,7 @@ def index

get :index

assert_response :success
assert_match "Redirecting", response.body
assert_match(%r{https://totally-real-url}, response.body)
assert_client_side_redirection "https://totally-real-url"

get :index, xhr: true

Expand Down Expand Up @@ -213,6 +207,12 @@ def index

private

def assert_client_side_redirection(url)
assert_response :success
assert_match "Redirecting", response.body
assert_match(url, response.body)
end

def stub_graphql_requests(*requests)
requests.each do |request|
stub_request(:post, "https://my-shop.myshopify.com/admin/api/#{@api_version}/graphql.json")
Expand Down

0 comments on commit 55072d7

Please sign in to comment.