Re: [rspec-users] File creation

2010-04-25 Thread Rick DeNatale
On Thu, Apr 22, 2010 at 9:28 AM, ben rooney wrote: > I have a model that generates the authorization_rules.rb for > declarative_auth. I am not sure how I can go about testing the model - > apart from anything I don't want my test to over-write the file - so, > er, I am not quite sure how to go abo

Re: [rspec-users] Controller tests fail to parse route based on resource

2010-04-25 Thread Marcelo de Moraes Serpa
Hi Phillip, The code is actually post :update, I have mistyped there. But that's not the issue. The problem is when I try to use the Rails-generated resource method: put user_url(@user). It does generate the URL correctly ( http://test.domain/users/int where int is any integer) but it fails to ac

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
> Regarding your original problem of the mocking error, have you debugged into > the FlexImage code? In looking at your gist, you have this: > > # @photo = mock_model(Photo, {:image_file_string => photo_content}) > > which says "create a mock object based on the Photo model, and if > #ima

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Phillip Koebbe
On 2010-04-25 5:25 PM, Patrick J. Collins wrote: Here is a gist of my code: http://gist.github.com/378778 Use stub when you just want to provide the plumbing. Use should_receive when you are setting an expectation. As an example, you could do Photo.stub(:create) just to provide the method to a

Re: [rspec-users] Controller tests fail to parse route based on resource

2010-04-25 Thread Phillip Koebbe
On 2010-04-25 5:52 PM, Marcelo de Moraes Serpa wrote: Hello list, I have a controller example that looks like this: it 'Should update (PUT /users/:id)' do @attributes = @user.attributes @attributes[:firstname] = "Another one" lambda { put user_url(@user),@attribut

[rspec-users] Controller tests fail to parse route based on resource

2010-04-25 Thread Marcelo de Moraes Serpa
Hello list, I have a controller example that looks like this: it 'Should update (PUT /users/:id)' do @attributes = @user.attributes @attributes[:firstname] = "Another one" lambda { put user_url(@user),@attributes User.find(@user.id).firstname == @attributes[:

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
Here is a gist of my code: http://gist.github.com/378778 > Use stub when you just want to provide the plumbing. Use should_receive when > you are setting an expectation. As an example, you could do > Photo.stub(:create) just to provide the method to avoid errors when your code > calls it. But if y

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Phillip Koebbe
On 2010-04-25 4:25 PM, Patrick J. Collins wrote: On Sun, 25 Apr 2010, Phillip Koebbe wrote: See http://gist.github.com/378489 for how I ended up specing a file upload. This isn't the exact same situation, but maybe you will get some ideas that will help. And there may be a better way, but this

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
On Sun, 25 Apr 2010, Phillip Koebbe wrote: > See http://gist.github.com/378489 for how I ended up specing a file upload. > This isn't the exact same situation, but maybe you will get some ideas that > will help. And there may be a better way, but this seems to work and is fairly > easy for me unde

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Phillip Koebbe
On 2010-04-25 3:43 AM, Patrick J. Collins wrote: Hi everyone, I have a test for importing vcards, and I was finding that each time it was being run, it was generating new photos and since it was using the test database, it was actually overwriting real photos that were being stored in the file

[rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
Hi everyone, I have a test for importing vcards, and I was finding that each time it was being run, it was generating new photos and since it was using the test database, it was actually overwriting real photos that were being stored in the file system (they are named based on the record's id). S