When I ran the
rails test command in Listing 3.15 in the Rails Tutorial (https://railstutorial.jp/chapters/static_pages?version=6.0#sec-our_first_test), I got the following error ①:
D:\Programming\RubyOnRails\sample_app2>rails test Run options: --seed 42827 # Running: E Error: StaticPagesControllerTest#test_should_get_home: ActionView::Template::Error: Permission denied @ rb_file_s_rename - (D:/Programming/RubyOnRails/sample_app2/tmp/cache/assets/sprockets/v4.0.0/6p/6p5srKo-CqopTzauMxsxGBdnpUciiPghSY6oKN4-uVY.cache.15640.1380.291914, D:/Programming/RubyOnRails/sample_app2/tmp/cache/assets/sprockets/v4.0.0/6p/6p5srKo-CqopTzauMxsxGBdnpUciiPghSY6oKN4-uVY.cache) app/views/layouts/application.html.erb:9 test/controllers/static_pages_controller_test.rb:5:in `block in <class:StaticPagesControllerTest>' rails test test/controllers/static_pages_controller_test.rb:4 . Finished in 0.148240s, 13.4916 runs/s, 6.7458 assertions/s. 2 runs, 1 assertions, 0 failures, 1 errors, 0 skips
Change the relevant part in
parallelize (workers: 1).
class ActiveSupport::TestCase # Run tests in parallel with specified workers parallelize(workers: 1) #here
I tried the command by referring to "Ruby on Rails Tutorial Troublesome Notes on Implementation on Windows" found by searching for error messages, but the
rails assets: precompile command is as follows. I got an error ②.
D:\Programming\RubyOnRails\sample_app2>rails assets:precompile rails aborted! Errno::ENOEXEC: Exec format error - D:/Programming/RubyOnRails/sample_app2/bin/yarn --version Tasks: TOP => assets:precompile => yarn:install (See full trace by running task with --trace)
I tried executing the
rails yarn: install command and checking it for a long time, but it seems that I can not handle it, so I decided to give up on solving this error ② for the time being. (Caused by trying to execute a command with
I thought that it should be given access rights because it is
Permission denied, so I allowed all users (groups) to have full control under the
tmp folder from Explorer, but error ① was still not fixed.
Similar to the above, if there is a problem with access rights, I thought that I should execute the command with administrator privileges, and I searched for keywords such as "Run as Ruby administrator" and found "Permission denied when gem install with Ruby" "Solution when it appears", I ran the Ruby command prompt as an administrator and typed the
rails test command, but error ① was not fixed.
Notice that one of the two
should get help) is
assertions, comment out
should get help in
static_pages_controller_test.rb and just
should get home I tested it and found no errors. ** In other words, I notice that I am getting an error only when I do two
tests at the same time. ** **
When I was researching various things in 1., I remembered that I saw a description that Rails tests are done in parallel to shorten the test time by default, so I searched for keywords such as "Rails test parallel". I found "Rails Testing Guide". When I changed the relevant part in
parallelize (workers: 1)with reference to 3.1 here, error ① disappeared.