Apipie / apipie-rails

Ruby on Rails API documentation tool
Apache License 2.0
2.47k stars 463 forks source link

Ruby 3.0 support #705

Closed voxik closed 2 years ago

voxik commented 3 years ago

Test suite fails running against Ruby 3.0. There is very likely needed PR #698, but even then there are errors such as:

  84) UsersController Parameter processing / extraction ignore not described parameters
      Failure/Error: ret = super(*args)
      ArgumentError:
        wrong number of arguments (given 2, expected 1)
      # /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/test_case.rb:460:in `process'
      # ./lib/apipie/extractor/recorder.rb:154:in `process'
      # ./spec/spec_helper.rb:16:in `block in process'
      # ./spec/spec_helper.rb:29:in `compatible_request'
      # ./spec/spec_helper.rb:16:in `process'
      # /usr/share/gems/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/template_assertions.rb:62:in `process'
      # /usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/test_case.rb:403:in `post'
      # /usr/share/gems/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/integration.rb:16:in `block (2 levels) in <module:Integration>'
      # ./spec/controllers/users_controller_spec.rb:743:in `block (3 levels) in <top (required)>'

It seems the crux is in these two methods: https://github.com/Apipie/apipie-rails/blob/cdff4ec654ee70dd222c7d75f64e20b167b44fce/spec/spec_helper.rb#L15-L33 introduced in 8fb9ecb8d078ea99bcdb054b5997955ccd33e08b.

First of all, the method and action parameters are swapped, but since they are swapped consistently, it does not cause any harm.

But secondly, I don't think I can really untangle the compatibility matrix between all rails and ruby version. There should be possibly used everywhere parameters such as *args, **kwargs, but I'm not sure how to convert the current code :confused:

hank-spokeo commented 3 years ago

I opened PR https://github.com/Apipie/apipie-rails/pull/716 which fixes the tests on Ruby 3.0