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

unable to log tests when we use rspec_api_documentation #161

Open
zsan opened this issue Apr 9, 2024 · 3 comments
Open

unable to log tests when we use rspec_api_documentation #161

zsan opened this issue Apr 9, 2024 · 3 comments

Comments

@zsan
Copy link

zsan commented Apr 9, 2024

Hello,

Its more to question rather than an issue.

Is there any way for this gem to integrate with the rspec_api_documentation gem?
I believe that in its current state, this gem may not be able to log tests written in the rspec_api_documentation style.

@tuwilof
Copy link
Owner

tuwilof commented Apr 9, 2024

Hello, fitting need Open API or API Bluerprint documentations to work

Your case will be solved if you can get this documentation from rspec_api_documentation

@zsan
Copy link
Author

zsan commented Apr 10, 2024

Hello, fitting need Open API or API Bluerprint documentations to work

Your case will be solved if you can get this documentation from rspec_api_documentation

I ran rake doc:generate to perform tests and generate documentation (including open API JSON) with rspec_api_documentation.

There should have been a log in fitting.log when I did the above, and then I could rake fitting:validate.
However, in reality, there is no log in fitting.log, which is why when I execute fitting:validate, I get this:

examples, 0 failure, 0 pending
Coverage: 0.0%

This might have happened because rspec_api_documentation does not expose the response object to the public (zipmark/rspec_api_documentation#289).

By the way, actually, I might not need fitting:validate if I'm using rspec_api_documentation.

@tuwilof
Copy link
Owner

tuwilof commented Apr 10, 2024

You're right. Currently, only two types are used: request and controller. For your case, you also need to allow the rspec_api_documentation type.

https://github.com/tuwilof/fitting/blob/master/lib/fitting.rb#L31

        config.after(:each, type: :request) do |example|
          begin
            request = Fitting::Records::Tested::Request.new(response, example)
            responses += "FITTING incoming request #{request.to_spherical.to_json}\n"
          rescue NoMethodError
          end
        end

        config.after(:each, type: :controller) do |example|
          begin
            request = Fitting::Records::Tested::Request.new(response, example)
            responses += "FITTING incoming request #{request.to_spherical.to_json}\n"
          rescue NoMethodError
          end
        end

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

2 participants