Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when running rails g magic_test:install command #87

Open
drozdowskimateusz opened this issue Feb 24, 2023 · 2 comments
Open

Issue when running rails g magic_test:install command #87

drozdowskimateusz opened this issue Feb 24, 2023 · 2 comments

Comments

@drozdowskimateusz
Copy link

drozdowskimateusz commented Feb 24, 2023

Prerequisites:

  • Rails 6.1.7.2
  • ruby 3.0.3p157
  • macbook pro m1

Issue:

After successful bundle install, when running rails g magic_test:install command I'm receiving error as shown below:

mateuszdrozdowski@Mateuszs-MacBook-Pro frontoffice % rails g magic_test:install
    generate  system_test
       rails  generate system_test basic
        gsub  test/system/basics_test.rb
/Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/actions/file_manipulation.rb:274:in `binread': No such file or directory @ rb_sysopen - /Users/mateuszdrozdowski/Documents/projects/frontoffice/test/system/basics_test.rb (Errno::ENOENT)
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/actions/file_manipulation.rb:274:in `gsub_file'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/magic_test-0.0.9/lib/generators/magic_test/install_generator.rb:18:in `install'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `block in invoke_all'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `each'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `map'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `invoke_all'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/group.rb:232:in `dispatch'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-6.1.7.2/lib/rails/generators.rb:275:in `invoke'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-6.1.7.2/lib/rails/commands/generate/generate_command.rb:26:in `perform'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-6.1.7.2/lib/rails/command/base.rb:69:in `perform'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-6.1.7.2/lib/rails/command.rb:48:in `invoke'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-6.1.7.2/lib/rails/commands.rb:18:in `<main>'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from /Users/mateuszdrozdowski/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from bin/rails:9:in `<main>'
@paulodeon
Copy link

Your problem may be that require "rails/test_unit/railtie" is commented out in application.rb and/or system_tests or test_framework is set to nil on config.generators

@osjjames
Copy link

osjjames commented Oct 26, 2023

I had the same issue and the above solution worked for me. For clarification, the issue was that I didn't have test_unit loaded during config. I use RSpec which is why test_unit was disabled.

To fix, open config/application.rb and:

  1. add require 'rails/test_unit/railtie' to the top of the file
  2. In the config.generators do |g| block, add this line: generate.system_tests = :test_unit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants