Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add session req_opts #44

Merged
merged 3 commits into from
Aug 9, 2018
Merged

Add session req_opts #44

merged 3 commits into from
Aug 9, 2018

Conversation

nsweeting
Copy link
Owner

No description provided.

@nsweeting
Copy link
Owner Author

Closes #39

@@ -2,6 +2,7 @@ defmodule Shopify.Session do
@moduledoc false

alias Shopify.Config
alias Shopify.Session
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Do you prefer this
alias Shopify.Config
alias Shopify.Session

# over this?
alias Shopify.{Config, Session}

Was this an intentional choice? I usually prefer the {} notation, but I am willing to change my habbits 😃

Copy link
Owner Author

@nsweeting nsweeting Aug 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍 - just missed that

@@ -82,5 +86,7 @@ defmodule Shopify do
iex> with %Shopify.Session{} <- Shopify.session, do: :passed
:passed
"""
def session, do: Shopify.Session.new()
def session do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you prefer this version over the one line version? Personal preferences?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More of a personal preference. I generally like the consistency of the multi-line function.

@@ -91,7 +91,12 @@ defmodule Shopify.Customer do
@doc false
def send_invite(session, id, %CustomerInvite{} = custom_invite) do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are already touching this method in this PR, we should rename the variable to customer_invite

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. A few items were touched from the formatter.

assert {:error, %Error{} = error} = HTTP.get(request)
assert error.source == :httpoison
assert error.reason == :timeout

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test absolutely does the job, but it raises a few questions.

The test is very tightly coupled to the implementation, i wonder if it would make sense to mock httpoison here and just test if it receives the opts.

The test title says it should use the opts, but it is actually testing if the opts are passed to httpoison. Should we change the test title here?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - wasnt super keen on it either, but I just wanted to make sure that it actually worked. I updated the test with a mock receiver. Still not a huge fan of it, but it will work.

@nsweeting nsweeting merged commit 8ce3ddc into master Aug 9, 2018
@nsweeting nsweeting deleted the request-options branch August 9, 2018 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants