knapsack
knapsack copied to clipboard
Tests failing with Rails 5.2 RC1
Currently upgrading an app from Rails 5.1 to Rails 5.2 RC1 and have started to run into some issues that don't exist on our primary/production branches. It appears that there are some issues with routes, as several tests are failing with No route matches /whatever although the routes are working fine (when looking at them in development environment), and Rails 5.1 branches pass these tests with no issues.
Something to note, when running the tests locally (they have some basic assert_routing statements) using bin/rails test test_name, they pass, however they fail when the same tests are run using bundle exec ruby -Itest. How is Minitest within Knapsack running the tests? Is there an internal issue with Knapsack and Rails 5.2?
Hoping you can help, thanks!
Hi @paulmthiebauth
Here you can see how minitest is run by knapsack https://github.com/ArturT/knapsack/blob/master/lib/knapsack/runners/minitest_runner.rb Basically just the rake task is invoked.
Here is example rails app https://github.com/KnapsackPro/rails-app-with-knapsack Could you try to upgrade to rails 5.2 and prepare example minitest test file that fails? Or you can prepare a new fresh rails 5.2 app with failing test so we could reproduce the issue.
There is actually rails5 branch here so you could use it https://github.com/KnapsackPro/rails-app-with-knapsack/commits/rails5
@ArturT Thanks for getting back to me, I'll work on this ASAP
@ArturT Im trying to bundle install but need a value for this line...what should I use?
This is in Gemfile
gem 'knapsack', path: ENV['KNAPSACK_REPO_PATH'] || '~/Documents/github/knapsack-pro/knapsack'
Please clone the https://github.com/ArturT/knapsack and use path to the directory with your local copy of knapsack. You can export KNAPSACK_REPO_PATH=/home/yourlogin/Documents/knapsack
I've upgraded rails to 5.2.0.rc1 on master. Feel free to use current master branch to reproduce the problem.
Heya. Did anyone find an explanation for this? I am experiencing the same thing using Rails 6 and Rspec
EDIT: Some time later we discovered that for us, at least, the issue had nothing to do with Knapsack. Some of tests were modifying routes, and not reseting the routes back to default. If you run a single test locally, everything can appear to work, but if you run several tests in sequence locally you can produce an error as one test pollutes the application environment for the subsequent tests (by rewriting the routes)
The example project uses Rails 6 https://github.com/KnapsackPro/rails-app-with-knapsack
@david-fluxster Did you upgrade to Rails 6 recently? Or do you set up the knapsack gem for the first time?