Problem is that jasmine-jquery in not loading my fixtures from spec/fixtures folder. Now when I look at jasmine-jquery source code default path for fixtures is spec/javascripts/fixtures. In a version that I have, there is no spec/javascripts/fixtures folder. It seems it is something for Ruby gem. I also tried to create that javascripts folder but still it can't load it. When I place my fixture fragment inside of SpecRunner.html body - it works.
Here is my html fragment:
<ul class="fr">
<li></li>
</ul>
Spec file:
describe("something to describe", function() {
it("should see a DOM element", function() {
loadFixtures("custom.html");
expect($(".fr")).toExist();
});
});
Is that a bug or something with the path ?
Solved: It is a problem with google-chrome. By default it doesn't allow access to other domain by same origin policy. Solution is to run app from local server, or to use firefox.
It indeed has to do with Chrome. This is a security concept called Same-Origin Policy.
Instead of running Firefox or the app from local server, you can still use Chrome with that security check disabled.
Just run Chrome/Chromium with the command-line argument
--allow-file-access-from-files
:Remember! Since this is a security feature, by disabling it you are putting your computer at risk. It is recommended to only use this parameter when testing local websites/apps (via a different shortcut/alias).