简体   繁体   中英

How do I force RSpec to call Ruby when using WebPack on Windows?

How do I force RSpec to call ruby bin/webpack instead of just bin/webpack on Windows?

C:\Users\Chloe\workspace\catalyst_research>rspec --format documentation --seed 32246 spec/features/legal_pages_spec.rb:8
Run options: include {:locations=>{"./spec/features/legal_pages_spec.rb"=>[8]}}

Randomized with seed 32246

Legal Pages
C:/ruby24/lib/ruby/gems/2.4.0/gems/webpacker-2.0/lib/tasks/installers.rake:1: warning: already initialized constant INSTALLERS
C:/ruby24/lib/ruby/gems/2.4.0/gems/webpacker-2.0/lib/tasks/installers.rake:1: warning: previous definition of INSTALLERS was here
C:/ruby24/lib/ruby/gems/2.4.0/gems/webpacker-2.0/lib/tasks/webpacker/install.rake:1: warning: already initialized constant WEBPACKER_APP_TEMPLATE_PATH
C:/ruby24/lib/ruby/gems/2.4.0/gems/webpacker-2.0/lib/tasks/webpacker/install.rake:1: warning: previous definition of WEBPACKER_APP_TEMPLATE_PATH was here
C:/Users/Chloe/workspace/catalyst_research/lib/tasks/test.rake:6: warning: already initialized constant DRIVERS
C:/Users/Chloe/workspace/catalyst_research/lib/tasks/test.rake:6: warning: previous definition of DRIVERS was here
Webpacker is installed ?? ??
Using C:/Users/Chloe/workspace/catalyst_research/config/webpacker.yml file for setting up webpack paths
Webpacker is installed ?? ??
Using C:/Users/Chloe/workspace/catalyst_research/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets ??
  Visiting the Privacy Policy (FAILED - 1)

Failures:

  1) Legal Pages Visiting the Privacy Policy
     Failure/Error: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

     ActionView::Template::Error:
       Exec format error - ./bin/webpack
     # ./app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__1587916422_151147480'
     # ./spec/features/legal_pages_spec.rb:9:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Errno::ENOEXEC:
     #   Exec format error - ./bin/webpack
     #   ./app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__1587916422_151147480'

I created a bin/webpack.bat batch file containing the following

ruby %~dp0\webpack

But I wish there was a setting in a Ruby config file.

Reference for batch files: What is the current directory in a batch file?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM