-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for object expansion (#393)
Add support for object expansion
- Loading branch information
Showing
11 changed files
with
141 additions
and
11 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
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,30 @@ | ||
defmodule Stripe.RequestTest do | ||
use ExUnit.Case | ||
|
||
alias Stripe.Request | ||
|
||
describe "object expansion" do | ||
test "prefix_expansions/2 should apply the given prefix to the expansion values" do | ||
opts = [expand: ["balance_transaction"]] | ||
request = Request.prefix_expansions(%Request{opts: opts}, "data") | ||
expansions = Keyword.get(request.opts, :expand) | ||
|
||
assert expansions == ["data.balance_transaction"] | ||
end | ||
|
||
test "prefix_expansions/2 should apply the given prefix to multiple expansion values" do | ||
opts = [expand: ["balance_transaction", "customer"]] | ||
request = Request.prefix_expansions(%Request{opts: opts}, "data") | ||
expansions = Keyword.get(request.opts, :expand) | ||
|
||
assert expansions == ["data.balance_transaction", "data.customer"] | ||
end | ||
|
||
test "prefix_expansions/2 should return the original opts if no expansions specified" do | ||
opts = [] | ||
request = Request.prefix_expansions(%Request{opts: opts}, "data") | ||
|
||
assert request.opts == opts | ||
end | ||
end | ||
end |