Closed archferns closed 6 years ago
Thanks for this @archferns . Note that this is broken in general, not just in Rails 5.1.
> rails -v
Rails 4.2.4
> rails generate versionist:new_api_version v2 V2 --header=name:Accept value:"application/vnd.mycompany.com; version=2"Running via Spring preloader in process 16987
route api_version(:module => "V2", :header => {:name => "Accept", :value => "application/vnd.mycompany.com; version=2"}) do
end
exist app/controllers/v2
identical app/controllers/v2/base_controller.rb
/Users/bploetz/.rvm/gems/ruby-2.2.2@versionist-test/gems/versionist-1.6.0/lib/generators/versionist/new_api_version/new_api_version_generator.rb:67:in `block in add_controller_base_tests': undefined local variable or method `test_path' for #<Versionist::NewApiVersionGenerator:0x007ffc84ecdc30> (NameError)
> rails -v
Rails 5.1.4
ails generate versionist:new_api_version v1 V1 --header=name:Accept value:"application/vnd.mycompany.com; version=1"
Running via Spring preloader in process 48302
route api_version(:module => "V1", :header => {:name => "Accept", :value => "application/vnd.mycompany.com; version=1"}) do
end
create app/controllers/v1
create app/controllers/v1/base_controller.rb
/Users/bploetz/.rvm/gems/ruby-2.2.5@versionist-test-rails51/gems/versionist-1.6.0/lib/generators/versionist/new_api_version/new_api_version_generator.rb:67:in `block in add_controller_base_tests': undefined local variable or method `test_path' for #<Versionist::NewApiVersionGenerator:0x007fdafd8097f8> (NameError)
versionist 1.6.1 has been released with this fix.
Cheers.
Thanks, that's great news!
The generators were failing in Rails 5.1 due to the implicit calls to
test_path
andolder_than_rails_5?
This commit fixes the generators by making explicit calls toVersionist.test_path
andVersionist.older_than_rails_5?