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

Use request_to matcher without with option #342

Open
ryz310 opened this issue Oct 27, 2020 · 0 comments
Open

Use request_to matcher without with option #342

ryz310 opened this issue Oct 27, 2020 · 0 comments
Assignees

Comments

@ryz310
Copy link
Owner

ryz310 commented Oct 27, 2020

I want to use request_to matcher without with option. But I've occurred following error:

Failure/Error:
       expect { api_request }.not_to request_to(:post, 'https://example.com/api')

     NoMethodError:
       undefined method `[]' for nil:NilClass
     # /usr/local/bundle/ruby/2.7.0/gems/my_api_client-0.17.0/lib/my_api_client/rspec/matchers/request_to.rb:11:in `block (2 levels) in <top (required)>'

The stack trace shows code that:

match do |api_request|
disable_logging
@expected = {
request_line: request_line(expected_method, expected_url, expected_options[:query]),
body: expected_options[:body],
headers: expected_options[:headers],
}.compact

@ryz310 ryz310 self-assigned this Oct 27, 2020
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

No branches or pull requests

1 participant