Re: [rspec-users] Testing arbitrary post action parameters

2009-01-17 Thread James Byrne
I still cannot get this to work. Tracing the actual calls in the log I see this: Processing UsersController#index (for 127.0.0.1 at 2009-01-17 18:32:54) [PUT] Parameters: {"action"=>"index", "controller"=>"users", "user"=>"2"} User Load (16.0ms) SELECT * FROM "users" Rendering template w

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-17 Thread James Byrne
James Byrne wrote: > > When /user named "(.*)" enables the administrator role/ do |name| > > put users_url( :user => User.find_by_username!(name) ), :user => > {:administrator => true} > > end > > Which at least does not blow up on me. But it does not set the > administrator flag to true e

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-17 Thread James Byrne
Pat Maddox wrote: > Does > put users_url(user), :user => {:administrator => true} > not work? > I have spent a good deal of time trying to get this to work with no success. I have read the api regarding the put method in: ActionController::Integration::Session which is what I believe provide

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-17 Thread Pat Maddox
On Sat, Jan 17, 2009 at 3:34 PM, James Byrne wrote: > James Byrne wrote: > >> >> I have spent a good deal of time trying to get this to work with no >> success. I have read the api regarding the put method in: >> >> ActionController::Integration::Session >> >> If I read this aright then in your

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-17 Thread James Byrne
James Byrne wrote: > > I have spent a good deal of time trying to get this to work with no > success. I have read the api regarding the put method in: > > ActionController::Integration::Session > > If I read this aright then in your example user should be a hash, but a > hash of what? Where

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread Pat Maddox
On Fri, Jan 16, 2009 at 12:25 PM, James Byrne wrote: > Pat Maddox wrote: > >> I assume you don't though, cause that'd be kinda weird. How about >> passing it in the POST params: >> >> put users_url(user), :user => {:administrator => true} >> >> Something along those lines... > > That is the probl

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread James Byrne
Zach Dennis wrote: > > > The "Then" step ensures that the user is redirected to an access > denied page. Granted, this doesn't go the granularity you may be > trying to get at, but knowing you aren't actually getting through to > the underlying action (by being redirected to the access denied pag

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread Zach Dennis
In the past we've done the following: Story: Users without hierarchy manager role accessing the hierarchy In order to ensure users that shouldn't have access to the hierarchy don't As a user who isn't a hierarchy manager I should not be able to access the hierarchy Scenario: Non hierarch

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread James Byrne
Pat Maddox wrote: > I assume you don't though, cause that'd be kinda weird. How about > passing it in the POST params: > > put users_url(user), :user => {:administrator => true} > > Something along those lines... That is the problem, I am not sure what syntax to use int the step definition. I

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread James Byrne
James Byrne wrote: > > Now, what I am looking for is an example of how an authenticated user > would craft a post request in their browser to set the > user.administrator flag to true. > OK, I figured out how to do this, as an authenticated user, from the browser. I am now going to try the sy

Re: [rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread Pat Maddox
On Fri, Jan 16, 2009 at 10:00 AM, James Byrne wrote: > I am working on our (newly renamed) authentication feature. The current > scenario is: > > Scenario: Non-administrators should not set administrator ability >Given I have no users > And I add a user named "admin" as an administrator

[rspec-users] Testing arbitrary post action parameters

2009-01-16 Thread James Byrne
I am working on our (newly renamed) authentication feature. The current scenario is: Scenario: Non-administrators should not set administrator ability Given I have no users And I add a user named "admin" as an administrator And I add a user named "myuser" as not an administrator