I am using the jasmine-rails gem to try and get our jasmine test suite working.
In my routes right at the top I have defined the following;
mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
And that seems to work, I can browse to /specs and the title of the page is Jasmine Specs .
The issue is that none of the assets that Jasmine needs are being loaded, including the specs. In my console I am seeing;
GET http://acme.lvh.me:8081/specs/assets/jasmine-specs.css 404 (Not Found) specs:21
GET http://acme.lvh.me:8081/specs/assets/jasmine.js 404 (Not Found) specs:22
GET http://acme.lvh.me:8081/specs/assets/jasmine.css 404 (Not Found) specs:20
GET http://acme.lvh.me:8081/specs/assets/jasmine-html.js 404 (Not Found) specs:23
GET http://acme.lvh.me:8081/specs/assets/boot.js 404 (Not Found) specs:25
GET http://acme.lvh.me:8081/specs/assets/json2.js 404 (Not Found) specs:24
GET http://acme.lvh.me:8081/specs/assets/jasmine-specs.js 404 (Not Found)
I am not quite sure why /specs/ is in that path?
My jasmine.yml is;
spec_files:
- "**/*[Ss]pec.{js,coffee}"
Any help would be greatly appreciated.
I was able to fix this by created a custom template
app/views/layouts/jasmine_rails/spec_runner.html.erb
And manually looping and creating the CSS/JS includes;
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
<title>Jasmine Specs</title>
<% jasmine_css_files.each do |css_file| %>
<link href="/assets/<%= css_file %>" media="screen" rel="stylesheet" />
<% end %>
<% jasmine_js_files.each do |js_file| %>
<script src="/assets/<%= js_file %>"></script>
<% end %>
</head>
<body>
<div id="jasmine_content"></div>
<%= yield %>
</body>
</html>
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.