inertiajs / inertia-rails

The Rails adapter for Inertia.js.
https://inertiajs.com
MIT License
529 stars 43 forks source link

Error when trying to run the specs #55

Closed christoomey closed 3 years ago

christoomey commented 3 years ago

Hey inertia-rails team, first of all, thanks for the great work on this project 👋!

I unfortunately was unable to get the tests running locally as I'm hitting the following error:

Error output when running `bundle exec rake` ``` An error occurred while loading rails_helper. Failure/Error: 'Cache-Control' => "public, max-age=#{1.hour.to_i}" NoMethodError: undefined method `hour' for 1:Integer # ./spec/dummy/config/environments/test.rb:19:in `block in ' # ./spec/dummy/config/environments/test.rb:6:in `' # ./spec/dummy/config/environment.rb:5:in `' # ./spec/rails_helper.rb:4:in `require' # ./spec/rails_helper.rb:4:in `' No examples found. No examples found. ```

I'm guessing there's some setup step needed in the spec/dummy app or similar, but not sure what it is. I'd be more than happy to document or add to bin/setup if you point me in the right direction.

ledermann commented 3 years ago

It seems this is caused by Rails 6.1, which requires this line to be added on top of spec/dummy/config/environments/test.rb:

require 'active_support/core_ext/integer/time'

See http://railsdiff.org/6.0.3.4/6.1.0

BrandonShar commented 3 years ago

Thanks @christoomey and @ledermann! Great issue info and solution.