Re: [rspec-users] testing multiple sessions in cucumber/webrat

2009-02-28 Thread BJ Clark
Joe,I would test this in 2 steps. I'd first test that whatever state change (or whatever happens when you User A clicks the link) takes place. Then in another test, I'd check that, given a certain state (or again, whatever is supposed to happen), then User B sees whatever. HTH, BJ Clar

[rspec-users] have_tag and img's

2009-03-20 Thread BJ Clark
is: 'Vidoop::Captcha::Helper rendering a catpcha should build xhtml form pieces' FAILED Expected at least 1 element matching "img[src='http://api.vidoop.com/vs/captchas/cpt123/image' ]", found 0. is not true. I've tried with_tag as simple as "img" but even

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly specing

2009-04-19 Thread BJ Clark
ect should probably necessitate a change in your views. That's the way it *should* work. However, your views shouldn't be tightly coupled with each other but they will have to be coupled in some way or another. - BJ Clark On Apr 19, 2009, at 12:37 PM, Fernando Perez wrot

Re: [rspec-users] Using Rails observers and testability

2009-05-04 Thread BJ Clark
Fernando, They are easier to spec with Pat Maddox's "no peeping toms" plugin. http://github.com/pat-maddox/no-peeping-toms/tree/master BJ Clark On May 4, 2009, at 5:33 AM, Fernando Perez wrote: Hi, Before I do anything stupid, I'd like to know if there are any gotc

Re: [rspec-users] Unable to post to an update action in a controller spec

2009-05-13 Thread BJ Clark
eated a bit, as I should be submitting to /items/1 instead. Anyway, now how can I trigger the update action in my controller test? I tried stuff like: post :update, {:method => 'put', :item => {'1' => {:quantity => 5}}} put :update, :item => 1 etc. There are 4 method

Re: [rspec-users] Using "return" in rspec test

2009-05-18 Thread BJ Clark
de?).and_return(true) something.should be_true end context "not in demo mode" do @product.stub!(:demoMode?).and_return(false) something.should_not be_true end end - BJ Clark AboutUs.org With the above spec, the second "it should print hi" test will n

Re: [rspec-users] Stubbing out Time correctly

2009-07-13 Thread BJ Clark
Adam, What I usually do is extract out the original Time.now call to method somewhere (with an intention revealing name) and stub out the method instead of #now itself. - BJ Clark On Jul 13, 2009, at 9:45 AM, Adam Anderson wrote: So that is what is happening now. Time.now is being

Re: [rspec-users] basic noob questions

2009-07-24 Thread BJ Clark
o in these situations. Its probably not important that Govtpostion receives "new". It's important that when it receives new with the proper things, and then saves, that it behaves a certain way. And when it doesn't receive the proper things, it acts another way. Hope tha