[rspec-users] Access controller object in controller macro

2012-04-17 Thread Nasir Jamal
Hi We have just upgraded our Rails 2.3.11 app to Rails 3.0.0 and Rspec 1.3.2 to 2.6. We are having two problems with rspec currently and any help would be great. 1) We have some controller macros where we have been using the controller object, session hash, response, etc. in different

[rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Luciano Borges
I'm studying Rspec and doing some model's tests. I have a table with a field which must have two characters, the field should not be empty and can not be repeated. My doubts is with #. describe State do context validations do it The abbreviation should not be empty do

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Julian Leviston
What do you mean repeated? You mean you can't have an abbreviation with two of the same letters? Julian On 18/04/2012, at 10:50 AM, Luciano Borges wrote: I'm studying Rspec and doing some model's tests. I have a table with a field which must have two characters, the field should not be

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Luciano Borges
2012/4/17 Julian Leviston jul...@leviston.net What do you mean repeated? You mean you can't have an abbreviation with two of the same letters? Julian Hi Julian, Yes. I cat't have the same abbreviation on the table, I know that I have to put the validation in the model, but, I'd like to

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Julian Leviston
oh you mean a check for uniqueness. Is this rails? If it is, pretty sure you can do this: item = Item.create(:abbreviation = ab) duplicate_item = Item.create(:abbreviation = ab) duplicate_item.new_record?.should_be true or item = Item.new(:abbreviation = ab) item.should_be valid item.save

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Lenny Marks
Sorry! My posts are very delayed. On Apr 17, 2012, at 8:50 PM, Luciano Borges wrote: I'm studying Rspec and doing some model's tests. I have a table with a field which must have two characters, the field should not be empty and can not be repeated. My doubts is with #. describe

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Lenny Marks
On Apr 17, 2012, at 8:50 PM, Luciano Borges wrote: I'm studying Rspec and doing some model's tests. I have a table with a field which must have two characters, the field should not be empty and can not be repeated. My doubts is with #. describe State do context validations do

[rspec-users] One error reported recursively if two pages visited by request spec

2012-04-17 Thread Mark Berry
Hi, I'm using Rails 3.1.3, rspec-rails 2.9.0, and Ruby 1.9.3p0. I've been getting recursive errors, where one error is reported multiple times. It's quite spectacular in a long suite, with the errors overflowing the console buffer. I've whittled down a simple example: require 'spec_helper'