[rspec-users] Dreading Controller Specs

2008-10-21 Thread Rob Lacey
Hi there, I was look for a little advice really. I've been using RSpec for about 4 months now and I find it an absolute joy for model work and a really nice tool it makes everything so much more readable and nicer to organise However, I seem to dread spec-ing out controllers, they end up bein

Re: [rspec-users] Mocks: expectations vs spying

2008-10-21 Thread Rahoul Baruah
On 18 Oct 2008, at 14:53, Pat Maddox wrote: I quit once I found not_a_mock [1] which works nicely. My preference Yay! Thanks for the pointer Pat. Baz. Rahoul Baruah Web design and development: http://www.3hv.co.uk/ Nottingham Forest: http://www.eighteensixtyfive.co.uk/ Serious Rails Host

Re: [rspec-users] Dreading Controller Specs

2008-10-21 Thread Rahoul Baruah
On 21 Oct 2008, at 10:45, Rob Lacey wrote: I almost am tempted to simplify the controller by using only the User model and moving most of the checks out of the controller action entirely and putting all into User, although that would mean that the user model, single_sign_on and music_servi

Re: [rspec-users] Mocks: expectations vs spying

2008-10-21 Thread David Chelimsky
On Mon, Oct 20, 2008 at 2:03 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: > > On 19 Oct 2008, at 21:18, Ashley Moran wrote: > >> >> On Oct 19, 2008, at 9:32 am, Matt Wynne wrote: >> [1] http://notahat.com/not_a_mock >>> >>> Looks sweet - it will be in my first mock on Monday! > > Thinking about i

Re: [rspec-users] Mocks: expectations vs spying

2008-10-21 Thread Matt Wynne
So if I want to have a spec suite which uses a combination of mocking frameworks, is this possible? Maybe if some of the files include ../not_a_mock_spec_helper and the others include ../default_spec_helper and then both those files require some common spec_helper file? On 21 Oct 2008, at

Re: [rspec-users] Dreading Controller Specs

2008-10-21 Thread Matt Wynne
On 21 Oct 2008, at 13:08, Rahoul Baruah wrote: On 21 Oct 2008, at 10:45, Rob Lacey wrote: I almost am tempted to simplify the controller by using only the User model and moving most of the checks out of the controller action entirely and putting all into User, although that would mean tha

Re: [rspec-users] Mocks: expectations vs spying

2008-10-21 Thread David Chelimsky
On Tue, Oct 21, 2008 at 10:41 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: > So if I want to have a spec suite which uses a combination of mocking > frameworks, is this possible? > > Maybe if some of the files include ../not_a_mock_spec_helper and the others > include ../default_spec_helper and then b

Re: [rspec-users] Dreading Controller Specs

2008-10-21 Thread Stephen Eley
On Tue, Oct 21, 2008 at 5:45 AM, Rob Lacey <[EMAIL PROTECTED]> wrote: > > However, I seem to dread spec-ing out controllers, they end up being quite > untidy, I think maybe I am approaching them in the wrong way as it probably > shouldn't be as hard as I am making it. For what it's worth, Rob, I'm

Re: [rspec-users] config.gem/rspec-rails/rspec bug (#577)

2008-10-21 Thread David Chelimsky
Hey all, Just a heads up about a bug related to configuring the rspec gems in your rails 2.1.1 projects: http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/577 Apparently, if you config.gem both rspec and rspec-rails 1.1.9 w/ rspec first, you'll get an error: # DON'T DO THIS: config.g

Re: [rspec-users] Dreading Controller Specs

2008-10-21 Thread Rahoul Baruah
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 21 Oct 2008, at 16:51, Matt Wynne wrote: Doesn't this just end up shifting the ugly mocking code into the Presenter specs though? The stock answer to this question is to move this logic down into the model layer, so that the interface the P

Re: [rspec-users] Dreading Controller Specs

2008-10-21 Thread Stephen Eley
On Tue, Oct 21, 2008 at 3:57 PM, Rahoul Baruah <[EMAIL PROTECTED]> wrote: > > * the presenter/service's role is to coordinate the models - so its specs > are purely about mocking the associations and the calls inbetween them > * the presenter/service isn't a model (not ActiveRecord::Base) - so it's

Re: [rspec-users] Cucumber, more examples, tabular data input sets

2008-10-21 Thread Joseph Wilk
Matt Wynne wrote: ScenarioTemplate: Non admins are rejected Given I login as Joe without the '[privilege]' privilege When I [request_method] /admin[path] Then I am notified that access was denied | privilege | request_method | path | | Joe | GET | /admin | | Joe | POST | /invoces/1 |

Re: [rspec-users] Where is current_user?

2008-10-21 Thread Harry Bishop
Thanks David, Your method works well and rspec succeeds now. Is the preferred way of using code with rspec to not rely on instance variables set in a parent during execution but to rely on the method only construct to be able to interact? I see the way this works for the outline you provided.