I'm trying to do a ajax call with JQuery in JSpec, and I get the
following error:
ActiveXObject is not defined, Line 1544 (of JSpec core)
This is the line:
1543 function object(str) {
1544 try { return new ActiveXObject(str) } catch(e) {}
1545 }
1546 return object('Msxml2.XMLHTTP.6.0') ||
1547 object('Msxml2.XMLHTTP.3.0') ||
1548 object('Msxml2.XMLHTTP') ||
1549 object('Microsoft.XMLHTTP')
1550 },
My test looks like this:
describe "Create"
it "creates a new child record in the database"
var request = {something:"here"}
$.ajax({
data: request,
type: "POST",
url: 'http://localhost:3000/somepath',
dataType: 'json',
success: function(response)
{
alert(response)
response.yeah.should.be "baby"
},
error: function(response)
{
alert(response)
}
})
end
end
and my dom.html should include the right files:
<script src="/Library/Ruby/Gems/1.8/gems/jspec-3.3.3/lib/jspec.js"></
script>
<script src="support/jquery.js"></script>
<script src="/Library/Ruby/Gems/1.8/gems/jspec-3.3.3/lib/
jspec.xhr.js"></script>
<script src="/Library/Ruby/Gems/1.8/gems/jspec-3.3.3/lib/
jspec.jquery.js"></script>
Anyone have any answer to this? Thanks...
--
JSpec thanks you for your interest and support! To post simply reply
to this email.
documentation: http://jspec.info
unsubscribe: jspec+un...@googlegroups.com
group: http://groups.google.com/group/jspec
I have this code:
describe 'API Tests'
before_each
$.ajaxSetup({async:false})
end
it "creates a new child record in the database"
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?
tags=cat&tagmode=any&format=json&jsoncallback=?",
function(data)
{
alert(data.items)
//data.foo.should.eql 'bar'
})
end
end
I load a json object from flickr and print out the object. Everything
works fine. But I says "0 passes 0 failures". Even though I put (as
you can see) a test that obviously should fail, it doesn't do
anything.
Everything is working if I do it with a mock json call.
Is there anything I need to know to make it work. Same doc.html
includes as the last post.
- Rune
On Mar 16, 10:27 pm, Rune Skjoldborg Madsen <r...@runemadsen.com>
wrote:
> Thanks...
>
> I'm using Firefox and get the error in Firebug. Without Firebug enabled,
> it seems to work though.
>
> I have set async to false.
>
> - Rune
>
> On 3/16/10 9:57 PM, vision media [ Tj Holowaychuk ] wrote:
>
>
>
> > Hmm lol even if it is undefined it should not
> > get through that try/catch block... what browser(s) are you using?
>
> > Also you should include a script tag for jspec.jquery.js to make jQuery's
> > requests sync and not async :) alternatively you could use jspec.xhr.js
> > for mock requests
>
> > response.yeah.should.be <http://response.yeah.should.be> "baby"
> > },
> > error: function(response)
> > {
> > alert(response)
> > }
> > })
> > end
> > end
>
> > and my dom.html should include the right files:
>
> > <script src="/Library/Ruby/Gems/1.8/gems/jspec-3.3.3/lib/jspec.js"></
> > script>
> > <script src="support/jquery.js"></script>
> > <script src="/Library/Ruby/Gems/1.8/gems/jspec-3.3.3/lib/
> > jspec.xhr.js"></script>
> > <script src="/Library/Ruby/Gems/1.8/gems/jspec-3.3.3/lib/
> > jspec.jquery.js"></script>
>
> > Anyone have any answer to this? Thanks...
>
> > --
> > JSpec thanks you for your interest and support! To post simply reply
> > to this email.
>
> > documentation:http://jspec.info
> > unsubscribe: jspec+un...@googlegroups.com
> > <mailto:jspec%2Bunsu...@googlegroups.com>