diff --git a/test/stripe/subscriptions/plan_test.exs b/test/stripe/subscriptions/plan_test.exs index ff6bee46..918e844b 100644 --- a/test/stripe/subscriptions/plan_test.exs +++ b/test/stripe/subscriptions/plan_test.exs @@ -1,37 +1,46 @@ defmodule Stripe.PlanTest do use Stripe.StripeCase, async: true - test "is listable" do - assert {:ok, %Stripe.List{data: plans}} = Stripe.Plan.list() - assert_stripe_requested :get, "/v1/plans" - assert is_list(plans) - assert %Stripe.Plan{} = hd(plans) + describe "create/2" do + test "creates a Plan for a customer" do + assert {:ok, %Stripe.Plan{}} = Stripe.Plan.create(%{ + amount: 5000, + interval: "month", + name: "Sapphire elite", + currency: "usd", + id: "sapphire-elite"}) + assert_stripe_requested :post, "/v1/plans" + end end - test "is retrievable" do - assert {:ok, %Stripe.Plan{}} = Stripe.Plan.retrieve("sapphire-elite") - assert_stripe_requested :get, "/v1/plans/sapphire-elite" + describe "retrieve/2" do + test "retrieves a Plan" do + assert {:ok, %Stripe.Plan{}} = Stripe.Plan.retrieve("sapphire-elite") + assert_stripe_requested :get, "/v1/plans/sapphire-elite" + end end - test "is creatable" do - assert {:ok, %Stripe.Plan{}} = Stripe.Plan.create(%{ - amount: 5000, - interval: "month", - name: "Sapphire elite", - currency: "usd", - id: "sapphire-elite" - }) - assert_stripe_requested :post, "/v1/plans" + describe "update/2" do + test "updates a Plan" do + assert {:ok, plan} = Stripe.Plan.update("sapphire-elite", %{metadata: %{foo: "bar"}}) + assert_stripe_requested :post, "/v1/plans/#{plan.id}" + end end - test "is updateable" do - assert {:ok, plan} = Stripe.Plan.update("sapphire-elite", %{metadata: %{foo: "bar"}}) - assert_stripe_requested :post, "/v1/plans/#{plan.id}" + describe "delete/2" do + test "deletes a Plan" do + {:ok, plan} = Stripe.Plan.retrieve("sapphire-elite") + assert {:ok, %Stripe.Plan{}} = Stripe.Plan.delete(plan) + assert_stripe_requested :delete, "/v1/plans/#{plan.id}" + end end - test "is deletable" do - {:ok, plan} = Stripe.Plan.retrieve("sapphire-elite") - assert {:ok, %Stripe.Plan{}} = Stripe.Plan.delete(plan) - assert_stripe_requested :delete, "/v1/plans/#{plan.id}" + describe "list/2" do + test "lists all Plans" do + assert {:ok, %Stripe.List{data: plans}} = Stripe.Plan.list() + assert_stripe_requested :get, "/v1/plans" + assert is_list(plans) + assert %Stripe.Plan{} = hd(plans) + end end -end +end \ No newline at end of file