Re: [rspec-users] hiiiiiii...........lots of question ..

2012-08-02 Thread Ken Chien
Hi Fahim, Have you looked at the documentation here [https://www.relishapp.com/rspec/] ? There are lots of great examples. Regards, Ken On Thu, Aug 2, 2012 at 1:14 AM, Fahim Patel wrote: > i implement all this question but i dont have knowledge perfectly > ...ok > > explain with e

Re: [rspec-users] Asserting on a yield

2012-03-07 Thread Ken Chien
Hi Matt, On Wed, Mar 7, 2012 at 2:22 AM, Matt Wynne wrote: > Hi all, > > I'm spec'ing a method that yields a value. Right now, I spec it like this: > > result = nil > thing.do_stuff { |value| result = value } > result.should == expected > > This feels like too much ceremony. What I wa

Re: [rspec-users] should_receive_chain

2012-02-21 Thread Ken Chien
Hi Justin, On Tue, Feb 21, 2012 at 4:03 AM, Justin Ko wrote: > Would you like to do this? > > account.should_receive_chain(:users, :active, :first) > > I would love this syntax. I find that I usually resort to stub_chain and lose the ability to check that the object received a particular message

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Ken Chien
I think you were closer when you had: --- Source code extract starts - context 'saves updates to an existing part object successfully' do before do part = double('part').stub(:update_ attributes).and_return(true) end it 'does its job in saving

Re: [rspec-users] Controller Spec & DataMapper Chaining

2011-03-18 Thread Ken Chien
When calling get/post/etc, the second optional parameter is a hash representing the "params" hash. So, in order to test the conditional(s) in your controller, you should write: get :index, :alpha => true #test the first conditional In another example, pass in :beta => true like this: get

Re: [rspec-users] Controller Spec & DataMapper Chaining

2011-03-18 Thread Ken Chien
What problems are you running into? It appears that you should stub out Widget.all before all examples, unless you really want to hit the database. Ken 2011/3/18 Sid Wood > Hi there, > > I'm fairly new to RSpec, and DataMapper and I'm trying to write a > controller spec for an index action t

Re: [rspec-users] Rspec single file

2011-03-10 Thread Ken Chien
I assume you're asking in the context of Rails? If so, take a look at Spork[1]. You can choose what you want to load once, and what you want to load before every spec. Ken --- [1] https://github.com/timcharper/spork 2011/3/10 phani kumar > > > Hi Guys, > > How can run the single spec file wi

Re: [rspec-users] How to do controller.stub(:some_method) at request test when using rspec2

2011-03-09 Thread Ken Chien
You should be able to call: controller.stub(:some_method) My suspicion is what you passed to the describe method. Instead of: describe "save attachment" pass the controller name, without quotes: describe DynamicFlowsController then controller.stub should work, and then you can refactor t