Skip to content

Instantly share code, notes, and snippets.

@motdotla
Created August 30, 2009 06:28
Show Gist options
  • Save motdotla/177890 to your computer and use it in GitHub Desktop.
Save motdotla/177890 to your computer and use it in GitHub Desktop.
1)
TypeError in 'User should be valid when new'
can't modify frozen object
/Users/scottmotte/code/merb/twinstang.com/gems/gems/jnicklas-carrierwave-0.3.3/lib/carrierwave/mount.rb:235:in `_mounter'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/jnicklas-carrierwave-0.3.3/lib/carrierwave/mount.rb:189:in `remove_avatar!'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:178:in `send'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:178:in `evaluate_method'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:166:in `call'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:93:in `run'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:92:in `each'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:92:in `send'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:92:in `run'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:276:in `run_callbacks'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/jnunemaker-mongomapper-0.3.5/lib/mongomapper/callbacks.rb:91:in `callback'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/jnunemaker-mongomapper-0.3.5/lib/mongomapper/callbacks.rb:85:in `destroy'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/jnunemaker-mongomapper-0.3.5/lib/mongomapper/document.rb:111:in `each'
/Users/scottmotte/code/merb/twinstang.com/gems/gems/jnunemaker-mongomapper-0.3.5/lib/mongomapper/document.rb:111:in `destroy_all'
./spec/models/../spec_helper.rb:28:in `empty_database'
./spec/models/user_spec.rb:8:
# spec_helper.rb # line 28
def empty_database
User.destroy_all # or even User.all.each {|u| u.destroy}
end
# in user_spec.rb: 8ish
before(:each) do
empty_database
@user = User.new(valid_user_attributes)
end
it "should be valid when new" do
@user.should be_valid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment