KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am working through the (excellent) railstutorial.org site have have a basic question about rspec. When I run the below test on a new user model, I get an "unknown attribute: username" message and a failed test. before(:each) do @attr = { :lname_e => "User", :fname_e => "Test", :email => "user@example.com", :username => "testUser" } end it "should create a new instance given valid attributes" do User.create!(@attr) end Error syntax is Failures: 1) User should create a new instance given valid attributes Failure/Error: User.create!(@attr) unknown attribute: username # ./spec/models/user_spec.rb:11:in `block (2 levels) in <top (required)>' The field is in the users table (string), it's in the model as attr_accessible and in the console I can create a user with exactly the same syntax in the test. This "username" field was added via a migration after creating the initial table, is there some other file I need to update here? Thanks,
Tags (comma-separated)
Save Edits
Cancel