Code Monkey home page Code Monkey logo

Comments (7)

samwgoldman avatar samwgoldman commented on June 15, 2024

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.

samwgoldman avatar samwgoldman commented on June 15, 2024

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.

jakehow avatar jakehow commented on June 15, 2024

@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.

samwgoldman avatar samwgoldman commented on June 15, 2024

@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.

romikoops avatar romikoops commented on June 15, 2024

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.

oestrich avatar oestrich commented on June 15, 2024

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.

oestrich avatar oestrich commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.