Comments (7)
This is definitely a problem. We define client
and depend on it to make requests to the API under test. We should make this more clear in some form of documentation at least.
I am not sure what a good solution would be to work around this, but I'm definitely open to a PR that allows users to let(:client)
without colliding.
from rspec_api_documentation.
We could hang client off RspecApiDocumentation or RspecApiDocumentation.configuration instead. This would cause problems for people who have nested contexts and a different client in an inner context. Also would be a breaking change for all existing usage.
from rspec_api_documentation.
@samwgoldman personally I am a fan of making everything more explicit. Defining the client should be required, and then you would have to call client.do_request instead of having it be a magic part of the DSL
from rspec_api_documentation.
@jakehow I agree! Right now we inject example
into the client, so I think we could take this opportunity to simplify the client api as well, since users will be expected to construct clients. I think we should consider using the client API available in smartlogic/http_spec.
from rspec_api_documentation.
It was my case, because I also used let(:client){...} in my code. I spent about hour to identify problem, because It was my first test with the gem. The problem was found only with debugger.
The issue is still actual, especially for newbies like me.
from rspec_api_documentation.
Unfortunately the issue of client
being pretty hard wired into the gem still stands. A PR will gladly be accepted if it can fix this issue. Until then I updated the README to include a 'Gotchas' section that mentions this.
https://github.com/zipmark/rspec_api_documentation#gotchas
from rspec_api_documentation.
I have finally fixed this. Sorry it took so long. You can now do this to redefine what method rspec_api_documentation will call for the client.
Certainly an interesting fix for it, and if someone else can think up a nicer way I'm all for it. 001d5b9
from rspec_api_documentation.
Related Issues (20)
- Document multiple examples for the same endpoint
- Request headers missing when using :open_api
- Docs generation fails if upload multiple files in a test case HOT 2
- Get `NoMethodError` when there is an example that expect an api to raise 500 error HOT 5
- Can't name parameter "pending" HOT 1
- Rails 5.2 update fixture changes
- Maintenance status HOT 23
- Can we please opt-in to Hacktoberfest? 🙏🏻 HOT 4
- No ability to generate a nullable option on response fields
- Add support for context blocks in HTML index HOT 3
- Open api: Ability to add description for scope
- Sample linked in README is not working HOT 1
- Bug in OpenApi formatter with multiple examples for same HTTP action? HOT 2
- Example site is offline HOT 1
- How To: Run tests in parallel and generate documentation HOT 2
- Allow to use short example definition
- Support for the latest version of Ruby
- EOFError on trying to test upload apis without file
- Support for OAS 3.1?
- Support ruby 3.2, DEPRECATED File.exists? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec_api_documentation.