webmock Questions

4

Octokit responses are of type Sawyer::Response They look like this: {:name=>"code.py", :content => "some content"} I am trying to stub my request like so reponse_body = {:content => "...
Domiciliate asked 3/6, 2016 at 19:9

6

Solved

I'm getting this error (details below) when a capybara selector is malformed or can't find. Why is it happening, and how can I prevent the error? This is new, I think, since our recent upgrade to t...
Harding asked 7/1, 2020 at 16:23

1

I have a webscraper in ruby that analyses certificates by using this: http = Net::HTTP.new(http_endpoint.host, http_endpoint.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE h...
Subsidize asked 15/2, 2017 at 17:26

2

Solved

I am trying to simulate unexpected behaviour from a web api, such as not finding the server and timeouts, using webmock. What would be the best way to do this? All I can think of is to do somethin...
Cymbal asked 28/8, 2014 at 15:9

1

Solved

I have an api-only RoR app with a user model. Users are authenticated via Twilio/Authy (using this gem). Each user has_one authy_user model for storing authy info, with dependent: :destroy. The a...
Abject asked 31/7, 2018 at 11:23

2

Solved

I'm trying to block URLs in my specs, achieving something like I had when using capybara_webkit: Capybara::Webkit.configure do |config| config.block_url("*google*") config.allow_url('*my_website...
Vaporetto asked 26/7, 2018 at 10:47

3

I have been trying for a while to stub multipart requests using webmock and have not found a satisfying solution. Ideally, I would like to stub the request as follow: stub_request(:post, 'http://...
Sanjay asked 13/3, 2013 at 2:15

1

Solved

In my rails project, one of the initialisers requests and fetches certain data from S3. S3.buckets[CONFIG['aws']['cdn_bucket']].objects['object_name'].read This breaks the rspec test suite which...
Neck asked 14/4, 2016 at 15:20

1

Solved

I have some code that looks like this: while response.droplet.status != env["user_droplet_desired_state"] do sleep 2 response = ocean.droplet.show env["droplet_id"] say ".", nil, false end Th...
Stacistacia asked 18/10, 2015 at 4:41

1

Solved

I am trying to write a WebMock based test case to mimic calling a http API. To do so I included webmock/rspec in my spec_helper.rb file and also added WebMock.disable_net_connect!(allow_localhost: ...
Canister asked 9/7, 2015 at 18:52

2

Solved

How to use Webmock to stub request with any body and header? I tried to use regex WebMock.stub_request(:post, 'api.quickblox.com/').with(:body => /.*?/, :headers => /.*?/).to_return(:status...
Warford asked 18/4, 2014 at 18:3

2

Solved

Ruby 1.9.3, RSpec 2.13.0, WebMock 1.17.4, Rails 3 I am writing tests for a company app. The controller in question displays a table of a customer's placed calls, and allows for sort/filter options...
Carrizales asked 26/12, 2014 at 21:58

3

Solved

How to match a URL like: http://www.example.com/foo/:id/bar http://www.example.com/foo/1/bar http://www.example.com/foo/999/bar stub_request(:post, "www.example.com")
New asked 8/12, 2012 at 2:35

1

Solved

I'm working on a Ruby on Rails gem and I'm trying webmock because I need to interact (and test) an external API not under my control. So, here is the snippet which is in before(:each) because I wa...
Graduate asked 7/2, 2014 at 2:22

3

Solved

Situation: testing a rails application using Rspec, FactoryGirl and VCR. Every time a User is created, an associated Stripe customer is created through Stripe's API. While testing, it doesn't real...
Tabasco asked 14/5, 2013 at 1:57
1

© 2022 - 2024 — McMap. All rights reserved.