Closed thisiscab closed 7 years ago
@braidn @DanielWright @bryanmtl :D Thank you!
I am unsure how to deal with default values, so that the specs can at least run on locally and on Travis.
Since Shopify doesn't allow a "test" shop we have to use our own credential.
As part of the test setup, can you generate an initializer?
Then we would have to explicitly ask the gem user to enter its credential somewhere, there is an extra layer of overhead that we need to have, I am just unsure of the best way to put it.
Imagine yourself integrating this extension into an app (and try to forget you've built the extension yourself). What would be the most compassionate way to capture their credentials? I think a good first step would be to generate an initializer that demonstrates how one might configure the extension. Think how Devise creates an initializer with sensible defaults. Does that make sense?
Have you looked at the PR, isn't it what we are already doing?
I see your point that for the gem itself, we should generate an initializer which I agree. My counter-argument is that there are no "sensible defaults" the user of this extension will still have to enter their Shopify API key and Token in order to run the specs.
Ah! I misunderstood your question, which is a shame cos it's a really really good one. Hmm.
I don't really like the way solidus_gateway
provides its own credentials, because I've actually run into a bug because of it (the API version those credentials run is out-of-date, which confounded me for days).
I think we have to pull them from ENV
for the specs. We can't guarantee any credentials we hard-code will remain functional. So, what do you think about depending on ENV vars, but with a human-friendly error-message if they're not found?
Something like:
begin
ENV.fetch('SHOPIFY_API_KEY')
rescue KeyError
puts "You must set the following environment variables: ... Please see <a href>the documentation</a> for ways to accomplish this."
end
What do you think of the changes? @DanielWright
Also @cabouffard you never pinged me here for a CR. Did you read my post from yesterday morning?
Also, it would be super nice to move #39 due to it's conversation into here when creating the PR, unless you don't think that transition makes sense. Helps keep context in one thread IMHO.
This would resolve https://github.com/glossier/solidus_retail/issues/39
I felt like that there was a need to create a configuration object that would be configured in the host app from an initializer.