Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
knowmalaria
stripe-ruby-mock
Commits
6fd681e6
Commit
6fd681e6
authored
Apr 15, 2016
by
Alexander Mamonchik
Browse files
Merge pull request #322 from lucas-aragno/master
Avoid to require an api key to get the instance working
parents
3b2a7dde
0da90e24
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/stripe_mock/instance.rb
View file @
6fd681e6
...
...
@@ -4,6 +4,8 @@ module StripeMock
include
StripeMock
::
RequestHandlers
::
Helpers
include
StripeMock
::
RequestHandlers
::
ParamValidators
DUMMY_API_KEY
=
(
0
...
32
).
map
{
(
65
+
rand
(
26
)).
chr
}.
join
.
downcase
# Handlers are ordered by priority
@@handlers
=
[]
...
...
@@ -71,7 +73,7 @@ module StripeMock
def
mock_request
(
method
,
url
,
api_key
,
params
=
{},
headers
=
{},
api_base_url
=
nil
)
return
{}
if
method
==
:xtest
api_key
||=
Stripe
.
api_key
api_key
||=
(
Stripe
.
api_key
||
DUMMY_API_KEY
)
# Ensure params hash has symbols as keys
params
=
Stripe
::
Util
.
symbolize_names
(
params
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment