jasmine rails
https://github.com/searls/jasmine-rails
railsでjasmine使うためのgem。
coffeeでも書ける。
# Gemfile
gem 'jasmine-rails'
で、bundle install
# config/routes.rb
mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)
# spec/javascripts/support/jasmine.yml
# path to parent directory of src_files
# relative path from Rails.root
# defaults to app/assets/javascripts
src_dir: "app/assets/javascripts"
# list of file expressions to include as source files
# relative path from scr_dir
src_files:
- "application.{js,coffee}"
# path to parent directory of spec_files
# relative path from Rails.root
# defaults to spec/javascripts
spec_dir: spec/javascripts
# list of file expressions to include as helpers into spec runner
# relative path from spec_dir
helpers:
- "helpers/**/*.{js,coffee}"
# list of file expressions to include as specs into spec runner
# relative path from spec_dir
spec_files:
- "**/*[Ss]pec.{js,coffee}"
RAILS_ENV=test bundle exec rake spec:javascript
Jasmine runner at '/specs' returned a 404 error: Not Found
と言われる
config/routes.rbで、rootの後ろにjasmineのspecs置くと駄目らしいので注意。