lundi 29 juin 2015

JSONFixture could not be loaded - 404 Jasmine, Rails

We have specs in Jasmine using jasmine-rails and jasmine-jquery-rails gems.

routes.rb has:

mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)

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 src_dir
src_files:
 - "application.js"

# 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,js,coffee}"

# list of file expressions to include as specs into spec runner
# relative path from spec_dir
spec_files:
  - "fixtures/json/*.js"
  - "fixtures/json/cso_fee_coupons.js"
  - "spec_helper.js.coffee"
  - "**/*[Ss]pec.{js.coffee,js,coffee}"

# path to directory of temporary files
# (spec runner and asset cache)
# defaults to tmp/jasmine
tmp_dir: "tmp/jasmine"

spec/javascripts/fixtures/json holds all the fixtures with js extension.

Due to some legacy reasons - the Gemfile is pointing at fixed versions of these gems which are quite old:

  gem "jasmine-rails", "= 0.5.6"
  gem "jasmine-jquery-rails", "= 1.5.9"

The spec suite runs perfectly on other laptops. It appears to be a problem local to my machine, security settings or something. I've enabled local file system config in Firefox as directed by an SO post because XHR requests are blocked by default due to security reasons. I've checked file permissions, I've checked permissions on running the application, the specs fail from the command line or from the browser (rake spec:javascript or running at localhost:3000/specs). No matter what I try the error message below is reported for EVERY fixture file that we have. My co-worker's laptop - no errors. They are identical MBPs ordered exactly the same time. They run the same version of FF. We compared directories and don't see any differences beyond the username.

I am really stuck on what could be the difference on just my machine. CircleCI runs spec:javascript as well and it passes....

    Failing 1 spec1 spec | 1 failing
App.ApplicationDetailsBasicInfo encountered a declaration exception.
Error: JSONFixture could not be loaded: spec/javascripts/fixtures/json/application_details_response.json (status: error, message: undefined) in http://localhost:3001/assets/jasmine-jquery.js?body=1 (line 240)
jasmine.JSONFixtures.prototype.loadFixtureIntoCache_/<.error@http://localhost:3001/assets/jasmine-jquery.js?body=1:240:15
jQuery.Callbacks/fire@http://localhost:3001/assets/jquery.js?body=1:975:10
jQuery.Callbacks/self.fireWith@http://localhost:3001/assets/jquery.js?body=1:1085:7
done@http://localhost:3001/assets/jquery.js?body=1:7806:1
.send/callback@http://localhost:3001/assets/jquery.js?body=1:8519:8
.send@http://localhost:3001/assets/jquery.js?body=1:8525:7
.ajax@http://localhost:3001/assets/jquery.js?body=1:7987:5
jasmine.JSONFixtures.prototype.loadFixtureIntoCache_@http://localhost:3001/assets/jasmine-jquery.js?body=1:231:1
jasmine.JSONFixtures.prototype.getFixtureData_@http://localhost:3001/assets/jasmine-jquery.js?body=1:223:5
jasmine.JSONFixtures.prototype.read@http://localhost:3001/assets/jasmine-jquery.js?body=1:212:7
jasmine.JSONFixtures.prototype.proxyCallTo_@http://localhost:3001/assets/jasmine-jquery.js?body=1:246:12
global.getJSONFixture@http://localhost:3001/assets/jasmine-jquery.js?body=1:704:12
@http://localhost:3001/assets/generated/ApplicationDetailsBasicInfo_spec.js?body=1:4:29
jasmine.Env.prototype.describe@http://localhost:3001/assets/jasmine.js?body=1:819:5
describe@http://localhost:3001/assets/jasmine.js?body=1:603:10
@http://localhost:3001/assets/generated/ApplicationDetailsBasicInfo_spec.js?body=1:2:3
@http://localhost:3001/assets/generated/ApplicationDetailsBasicInfo_spec.js?body=1:1:1

Aucun commentaire:

Enregistrer un commentaire