[rspec-users] Hiding Test-Unit Generators ??

2010-11-02 Thread Arco
Just curious if this was ever fixed?? On Jul 13, 2010, at 8:49 PM, Arco wrote: > In a recent blog post, David wrote: > Because RSpec is the test framework of record, Rails doesn’t know to > hide the test_unit generators. If you want to hide them, just add this > to one of your config files: >

Re: [rspec-users] Rspec-2 around/before(:all) hooks

2010-11-02 Thread David Chelimsky
On Nov 2, 2010, at 1:54 PM, Mack T. wrote: > Rspec-2 around/before(:all) hooks > > I'm trying to create several model instances before all of our tests are > run. I'm having trouble defining the behavior in my Rspec.configure > block. I've tried before(:all) and around(:all), but to no avail.

Re: [rspec-users] Not sure why let is not doing the same thing as traditional test

2010-11-02 Thread Justin Ko
I'm under the weather so I won't be able to give you a thorough answer. #let - The block is executed when you call it. #let! - The block is "wrapped" in a before(:each) filter. So, you want to use #let! On Nov 2, 7:55 pm, Nadal wrote: > Here is my test which passes. > >    before do >         @

[rspec-users] Not sure why let is not doing the same thing as traditional test

2010-11-02 Thread Nadal
Here is my test which passes. before do @page = Factory(:page) @note = Factory(:note, :page => @page, :title => 'super cool') end it 'has size 1' do @page.notes.size.should == 1 end I read rspec book and wanted to use let. Here is my implementation. A

[rspec-users] Rspec-2 around/before(:all) hooks

2010-11-02 Thread Mack T.
Rspec-2 around/before(:all) hooks I'm trying to create several model instances before all of our tests are run. I'm having trouble defining the behavior in my Rspec.configure block. I've tried before(:all) and around(:all), but to no avail. before(:all) successfully creates the models, but it a

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Iain E. Davis
> To me, checking whether the attribute changed is more straight-forward > than implementing a custom matcher, at least at my current level of > experience (novice) with rails and rspec. Okay, so that didn't last very long. Suddenly, I was swimming in very repetitive code in my _spec files...I cou

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Evgeniy Dolzhenko
> I suppose I need to be careful that the attribute change was rejected > for some other reason (bad data, for example). But that's true of any > example/test. Good catch, that's why I think the Shoulda approach makes sense (since otherwise you're duplicating the Rails test suite which is supposed

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Rick DeNatale
On Tue, Nov 2, 2010 at 10:39 AM, Iain E. Davis wrote: > I failed to mention I'm using Rails 2.3.8 and Rspec-1.3.x. I should > have said that right away. > > On Tue, Nov 2, 2010 at 01:33, Alexey Ilyichev wrote: >> An attempt to assign protected attributes leads to the warning in your log > Hmm...

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Iain E. Davis
I failed to mention I'm using Rails 2.3.8 and Rspec-1.3.x. I should have said that right away. On Tue, Nov 2, 2010 at 01:33, Alexey Ilyichev wrote: > An attempt to assign protected attributes leads to the warning in your log Hmm... Maybe I should actually look at the log once in a while... >    

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Wincent Colaiuta
On 02/11/2010, at 01:36, Iain E. Davis wrote: > I've been puzzling over how to test that attr_accessible has been set > for the correct columns; but the tests I've come up with so far seem > to fail to fail when I expect. I came across this old message from > this list: > > http://www.mail-archiv

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Evgeniy Dolzhenko
update_attributes [1] doesn't raise any exception when you try to assign the attribute which is protected with `attr_accessible/attr_protected` machinery (only warning in log is printed). So your options are: 1. perform update_attributes for an attribute and then assert that the attribute didn't c

Re: [rspec-users] Testing attr_accessible (and/or attr_protected)

2010-11-02 Thread Alexey Ilyichev
An attempt to assign protected attributes leads to the warning in your log and not doing actual assignment. You can test it like this: describe Article, 'protected attributes' do it 'should deny mass-assignment to the user_id' do RAILS_DEFAULT_LOGGER.should_receive(:warn) # I ain't sure if i