search for: valid_user_attribut

Displaying 5 results from an estimated 5 matches for "valid_user_attribut".

Did you mean: valid_user_attributes
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
I happened to mix ryan bates'' authentication scaffold with rspec_scaffold on a demo project. and ran into the problem of mixing mock frameworks...ryan uses mocha. So, as a learning experience, I choose to redo ryan''s tests without mocha but ran into a strange problem with tests of the User model. With debugging you can see.... If you run just the user_spec.rb file, everything
2007 Nov 14
4
Stubbing out required associated models
...te them. I have certain models in which validation requires the presence of an associated model, which itself needs to be valid(validates_presence_of and validates_associated). When I wrote the specs, I wrote helpers for the attributes instead of fixtures, like so: module UserSpecHelper def valid_user_attributes { :email => "test at here.com", :password => "tttttt", :password_confirmation => "tttttt" } end end If the model had a required associated model, I''d also add some valid attribute helpers to make the associated model...
2007 Oct 17
16
rspec causing validates_presence_of to validate twice?
...o include UserExampleHelperMethods before(:each) do @user = User.new @user.password = ''123456'' @user.password_confirmation = ''123456'' end it ''should be invalid without a password when creating'' do @user.attributes = valid_user_attributes @user.password = nil @user.password_confirmation = nil @user.should_not be_valid @user.errors.on(:password).should == "can''t be blank" end end
2008 Mar 18
11
"Why not MockEverthing" or why use fixtures for all tests?
Hello fellow RSpec users. Before you all start warming up your flame throwers please let me explain my Subject line. I''ve been working over 4 months on a large Rails project with a few other developers. Test coverage was spotty at best, though they *were* RSpec tests. One of the other developers and I had started adding more tests, mostly controller tests using the methodology
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall. Thanks to Wilson for converting to the new form. I''ve added a few lines. Basically, it iterates over your model associations and does two things. - First, just try to call the association. Usually fixes speeling erors or other such silliness. - Second, try to find a record with an :include on the association. This