Skip to content

Commit

Permalink
Allow passing query parameters to request stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
zorbash committed Mar 27, 2015
1 parent 5d1b8b5 commit 211c61a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@
end

[:get, :head, :patch, :post, :put, :delete].each do |verb|
Object.send :define_method, "stub_#{verb}" do |path|
stub_api_call(verb, path)
Object.send :define_method, "stub_#{verb}" do |path, params = {}|
stub_api_call(verb, path, params)
end
end

def stub_api_call(verb, path)
stub_request(verb, "#{Skroutz::Default.to_hash[:api_endpoint]}/#{path}")
def stub_api_call(verb, path, params = {})
stub_request(verb, "#{Skroutz::Default.to_hash[:api_endpoint]}/#{path}").
with(query: params)
end

def fixture_path
Expand Down

0 comments on commit 211c61a

Please sign in to comment.