<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Jasmine on New Schematic</title><link>https://newschematic.org/tags/jasmine/</link><description>Recent content in Jasmine on New Schematic</description><generator>Hugo</generator><language>en-us</language><copyright>Christopher Boette, CC by-sa-nc</copyright><lastBuildDate>Fri, 08 Aug 2014 00:45:40 +0000</lastBuildDate><atom:link href="https://newschematic.org/tags/jasmine/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Mock JSON with $httpBackend in Jasmine</title><link>https://newschematic.org/blog/how-to-mock-json-with-httpbackend-in-jasmine/</link><pubDate>Fri, 08 Aug 2014 00:45:40 +0000</pubDate><guid>https://newschematic.org/blog/how-to-mock-json-with-httpbackend-in-jasmine/</guid><description>&lt;p&gt;There is a lot of information out there on running tests for Angular using Jasmine + Karma. One thing that was tripping me up, though, was being able to access a mock JSON file, rather than trying to hit a server with an HTTP request every test.&lt;/p&gt;
&lt;p&gt;Working from this &lt;a href="http://dailyjs.com/2013/05/16/angularjs-5/" target="_blank"&gt;code sample&lt;/a&gt;, I injected the mock file with the &lt;code&gt;beforeEach&lt;/code&gt; call. However, I wasn&amp;rsquo;t able to access the JSON response until I injected the &lt;code&gt;defaultJSON&lt;/code&gt; directly into the specific test:&lt;/p&gt;</description></item></channel></rss>