Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread David Chelimsky
On Jul 26, 2010, at 12:36 PM, Bruno Cardoso wrote: > Thanks for the answers. > > What both solutions (from Ashley and David) do is not modify the BD in > anyway, so nothing gets dropped and nothing is created. This resolves > the problem but what if I want a clean installation in each test run?

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Ashley Moran
On 26 Jul 2010, at 6:36 PM, Bruno Cardoso wrote: > What both solutions (from Ashley and David) do is not modify the BD in > anyway, so nothing gets dropped and nothing is created. This resolves > the problem but what if I want a clean installation in each test run? Is > there a way to keep my

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Bruno Cardoso
Bruno Cardoso wrote: > Thanks for the answers. > > What both solutions (from Ashley and David) do is not modify the BD in > anyway, so nothing gets dropped and nothing is created. This resolves > the problem but what if I want a clean installation in each test run? Is > there a way to keep my "

Re: [rspec-users] [newbie] rspec, validations and factory_girl

2010-07-26 Thread Lille
OK. On a Rails note, this seems to suggest that attributes are checked from their accessors before the save, whereas I had assumed my some_attribute accessor would not be called at all during validation... (Thank you David, this is one of the better groups I've lately monitored, and a fine comple

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Bruno Cardoso
Thanks for the answers. What both solutions (from Ashley and David) do is not modify the BD in anyway, so nothing gets dropped and nothing is created. This resolves the problem but what if I want a clean installation in each test run? Is there a way to keep my "schema_migrations" table or remov

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread David Chelimsky
On Jul 26, 2010, at 11:50 AM, Ashley Moran wrote: > > On Jul 26, 2010, at 5:12 pm, Bruno Cardoso wrote: > >> Not sure if this is a RSpec problem or Rails but I believe is more a >> RSpec situation. >> >> What happens is that when I run my RSpecs tests all the BD is recreated, >> >> ... >> >>

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread David Chelimsky
On Jul 26, 2010, at 11:12 AM, Bruno Cardoso wrote: > Hi > > Not sure if this is a RSpec problem or Rails but I believe is more a > RSpec situation. > > What happens is that when I run my RSpecs tests all the BD is recreated, > including the "schema_migration" table, because of this I get a probl

Re: [rspec-users] [newbie] rspec, validations and factory_girl

2010-07-26 Thread David Chelimsky
On Jul 26, 2010, at 11:34 AM, Lille wrote: > Hi, > > class B < ActiveRecord::Base > belongs_to :a > validates_numericality_of :some_attribute, :greater_than => > 0, :allow_blank=>true > > def some_attribute > a.numeric_attr * read_attribute(:some_attribute) > end > ... > > If I creat

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Ashley Moran
On Jul 26, 2010, at 5:12 pm, Bruno Cardoso wrote: > Not sure if this is a RSpec problem or Rails but I believe is more a > RSpec situation. > > What happens is that when I run my RSpecs tests all the BD is recreated, > > ... > > Anyone know how to resolve this? Hi Bruno Are you running `rake

Re: [rspec-users] render_template expectation - surprising pattern matching issue

2010-07-26 Thread Phillip Koebbe
On 2010-07-26 11:12 AM, Timo Rößner wrote: Hey guys, we just found out by accident that rspec seems to apply a pretty confusing mechanism to ensure that a certain template is rendered. To clarify, consider this standard controller spec: # working it 'GET edit' do get :edit, :id =>

Re: [rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Ashley Moran
On Jul 26, 2010, at 3:44 pm, Wincent Colaiuta wrote: > Personally I wouldn't do this. It makes it harder for anybody coming to your > project to understand what's going on, because they see this "contract 'foo' > do" construct and don't know what it is unless they dig into your > spec_helper.

Re: [rspec-users] beginner questions: parametrize tests and disable tests (skippy?)

2010-07-26 Thread Wincent Colaiuta
El 26/07/2010, a las 15:52, nathanvda escribió: > For test::unit there exists a solution: http://github.com/jm/skippy > Is there a similar solution for Rspec? > Or how do you guys solve this? The way to do the "Skippy" thing under RSpec 2 will be filtering: http://blog.davidchelimsky.net/2010/06

[rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Bruno Cardoso
Hi Not sure if this is a RSpec problem or Rails but I believe is more a RSpec situation. What happens is that when I run my RSpecs tests all the BD is recreated, including the "schema_migration" table, because of this I get a problem saying: You have 29 pending migrations: 20100628100855 Creat

[rspec-users] [newbie] rspec, validations and factory_girl

2010-07-26 Thread Lille
Hi, class B < ActiveRecord::Base belongs_to :a validates_numericality_of :some_attribute, :greater_than => 0, :allow_blank=>true def some_attribute a.numeric_attr * read_attribute(:some_attribute) end ... If I create an instance of my class B in rspec with factory_girl w.out a pa

[rspec-users] render_template expectation - surprising pattern matching issue

2010-07-26 Thread Timo Rößner
Hey guys, we just found out by accident that rspec seems to apply a pretty confusing mechanism to ensure that a certain template is rendered. To clarify, consider this standard controller spec: # working it 'GET edit' do get :edit, :id => '37' response.should render_template(:edit)

[rspec-users] beginner questions: parametrize tests and disable tests (skippy?)

2010-07-26 Thread nathanvda
Hi there, i have two very specific questions. I am writing an application to send sms-es. Now i would like to be able, somehow, to disable the part of my tests that actually sends the sms-es. My code is tested, but to actually test sending the sms-es, i need to test the configuration. So it is nee

Re: [rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Wincent Colaiuta
El 26/07/2010, a las 14:09, Ashley Moran escribió: > The solution I'm playing with is to extract shared contract (ie shared > example groups) that you can mix into a spec for a host class (eg User, > Checklist) above to prove the feature (here collections) works, without > reference to the impl

Re: [rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Ashley Moran
On Jul 26, 2010, at 8:55 am, Wincent Colaiuta wrote: > Seems to me that including the same shared example group twice in the same > "describe" block is a bit of an abuse, to be honest. I don't think it was > ever really intended to be used in that way. You're right, it clearly wasn't intended

Re: [rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Wincent Colaiuta
El 26/07/2010, a las 09:31, Ashley Moran escribió: > I'm back again, and still on a quest to tame shared example to do my bidding. > This time what I'm wondering is... is there any way to format shared example > specdoc description output with data passed in with #let, or otherwise? eg: > How

[rspec-users] RSpec 2 example group block scope

2010-07-26 Thread Ashley Moran
Hi again As part of the refactoring I'm doing, I'm writing out quite a bit of metaprogramming. The easiest way to prove constant lookup is working is to create a new class in an example group, and use its name. But the scope of the example group definition appears to be the containing module,

[rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Ashley Moran
Hi I'm back again, and still on a quest to tame shared example to do my bidding. This time what I'm wondering is... is there any way to format shared example specdoc description output with data passed in with #let, or otherwise? eg: How do I get "1" and "2" into either of the placeholders h