-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #664 from code-corps/590-simplify-subscription-cre…
…ation Simplified subscription creation
- Loading branch information
Showing
33 changed files
with
157 additions
and
117 deletions.
There are no files selected for viewing
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
File renamed without changes.
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,25 @@ | ||
defmodule CodeCorps.ViewCase do | ||
@moduledoc """ | ||
This module defines the test case to be used by | ||
tests for views defined in the application. | ||
""" | ||
|
||
use ExUnit.CaseTemplate | ||
|
||
using do | ||
quote do | ||
import CodeCorps.Factories | ||
import Phoenix.View, only: [render: 3] | ||
end | ||
end | ||
|
||
setup tags do | ||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(CodeCorps.Repo) | ||
|
||
unless tags[:async] do | ||
Ecto.Adapters.SQL.Sandbox.mode(CodeCorps.Repo, {:shared, self()}) | ||
end | ||
|
||
:ok | ||
end | ||
end |
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
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
defmodule CodeCorps.LayoutViewTest do | ||
use CodeCorps.ConnCase, async: true | ||
use CodeCorps.ViewCase | ||
end |
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
defmodule CodeCorps.PageViewTest do | ||
use CodeCorps.ConnCase, async: true | ||
use CodeCorps.ViewCase | ||
end |
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
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
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
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
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
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
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
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
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
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
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,37 @@ | ||
defmodule CodeCorps.StripeConnectSubscriptionViewTest do | ||
use CodeCorps.ViewCase | ||
|
||
test "renders all attributes and relationships properly" do | ||
project = insert(:project) | ||
plan = insert(:stripe_connect_plan, project: project) | ||
user = insert(:user) | ||
subscription = insert(:stripe_connect_subscription, stripe_connect_plan: plan, user: user) | ||
|
||
rendered_json = render(CodeCorps.StripeConnectSubscriptionView, "show.json-api", data: subscription) | ||
|
||
expected_json = %{ | ||
"data" => %{ | ||
"attributes" => %{ | ||
"inserted-at" => subscription.inserted_at, | ||
"quantity" => subscription.quantity, | ||
"updated-at" => subscription.updated_at | ||
}, | ||
"id" => subscription.id |> Integer.to_string, | ||
"relationships" => %{ | ||
"project" => %{ | ||
"data" => %{"id" => project.id |> Integer.to_string, "type" => "project"} | ||
}, | ||
"user" => %{ | ||
"data" => %{"id" => user.id |> Integer.to_string, "type" => "user"} | ||
} | ||
}, | ||
"type" => "stripe-connect-subscription", | ||
}, | ||
"jsonapi" => %{ | ||
"version" => "1.0" | ||
} | ||
} | ||
|
||
assert rendered_json == expected_json | ||
end | ||
end |
Oops, something went wrong.