Re: [jasmine-js] setup and access a query string from the url within jasmine

161 views
Skip to first unread message

Davis W. Frank

unread,
Aug 1, 2012, 5:07:05 PM8/1/12
to jasmi...@googlegroups.com
Jasmine itself doesn't deal with things that this level. It's just a syntax for describing tests, and assertion/matcher framework, a way to run tests, and a way to report them. Thus, Jasmine doesn't know it's in a browser.

So I think your question is more a how-to-test question than a how-does-Jasmine-do-this question.

Are you trying to test-drive an object that reads the query string? What are you going to do with that information once you have it?

--dwf



On Wed, Aug 1, 2012 at 12:57 PM, Philip Ingram <phi...@ingraminternet.com> wrote:
Sorry for the layman terms but I don't know how else to put it.

I need to pass a query string from the URL to a cookie I'm setting, using javascript.

In JS i need to access document.location.search and then see if my ?ref=123123 sting is there.

Now I don't know the right way to ask this, but how does one tell jasmine that the request coming in has a query string in the url.

Thanks
Philip

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jasmine-js/-/zSAXonofOYgJ.
To post to this group, send email to jasmi...@googlegroups.com.
To unsubscribe from this group, send email to jasmine-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jasmine-js?hl=en.



--
thx,
--dwf

Philip Ingram

unread,
Aug 1, 2012, 5:32:30 PM8/1/12
to jasmi...@googlegroups.com
if it's just a syntax with matcher/assertion framework, what is it running on top of then?

I'm going to grab the query string and add it to a cookie if a cookie isn't set.

I can do it right now without tests, but thought that jasmine or a testing framework that it uses, or the server itself or something would pass it in.

How would you test this?, if i may ask.

Thanks
Philip 


On Wednesday, August 1, 2012 5:07:05 PM UTC-4, DWF wrote:
Jasmine itself doesn't deal with things that this level. It's just a syntax for describing tests, and assertion/matcher framework, a way to run tests, and a way to report them. Thus, Jasmine doesn't know it's in a browser.

So I think your question is more a how-to-test question than a how-does-Jasmine-do-this question.

Are you trying to test-drive an object that reads the query string? What are you going to do with that information once you have it?

--dwf


--
thx,
--dwf

Davis W. Frank

unread,
Aug 1, 2012, 5:49:50 PM8/1/12
to jasmi...@googlegroups.com
Jasmine is just JavaScript - there's nothing else below it.

I'd write an object that does the cookie manipulation, then you'd be test driving the behavior of that object. I'd have it take the string directly instead of reading anything in document, mostly because the Jasmine runner "owns" document location.

--dwf

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jasmine-js/-/vqXQd1XojOwJ.

To post to this group, send email to jasmi...@googlegroups.com.
To unsubscribe from this group, send email to jasmine-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jasmine-js?hl=en.



--
thx,
--dwf

Philip Ingram

unread,
Aug 1, 2012, 6:16:47 PM8/1/12
to jasmi...@googlegroups.com
Cool.  I've been doing that but didn't know if i was missing something.

Thanks "DWF".toLowerCase


On Wednesday, August 1, 2012 5:49:50 PM UTC-4, DWF wrote:
Jasmine is just JavaScript - there's nothing else below it.

I'd write an object that does the cookie manipulation, then you'd be test driving the behavior of that object. I'd have it take the string directly instead of reading anything in document, mostly because the Jasmine runner "owns" document location.

--dwf
if it's just a syntax with matcher/assertion framework, what is it running on top of then?

I'm going to grab the query string and add it to a cookie if a cookie isn't set.

I can do it right now without tests, but thought that jasmine or a testing framework that it uses, or the server itself or something would pass it in.

How would you test this?, if i may ask.

Thanks
Philip 


On Wednesday, August 1, 2012 5:07:05 PM UTC-4, DWF wrote:
Jasmine itself doesn't deal with things that this level. It's just a syntax for describing tests, and assertion/matcher framework, a way to run tests, and a way to report them. Thus, Jasmine doesn't know it's in a browser.

So I think your question is more a how-to-test question than a how-does-Jasmine-do-this question.

Are you trying to test-drive an object that reads the query string? What are you going to do with that information once you have it?

--dwf


--
thx,
--dwf




--
thx,
--dwf

Davis W. Frank

unread,
Aug 1, 2012, 6:19:59 PM8/1/12
to jasmi...@googlegroups.com
You're welcome! And welcome!

--dwf

ps: the initials are case-insensitive

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jasmine-js/-/IL_bcdZ8fUQJ.

To post to this group, send email to jasmi...@googlegroups.com.
To unsubscribe from this group, send email to jasmine-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jasmine-js?hl=en.



--
thx,
--dwf

Reply all
Reply to author
Forward
0 new messages