-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecation warning when running RSpec tests #50
Comments
I just started seeing a similar issue in my specs yesterday. I'll update this when I have tracked down the code causing this. |
Ah cool, I'm glad it's not me being silly then! |
I checked again. It is actually happening in functional tests with Test::Unit:
|
Hmm im not using them, only cucumber features and rspec |
This code was the culprit. You might have something similar somewhere. A recent update to Rails deprecated specifying models as arguments in mass assignment. I think it may have been a Rails 3 or 3.1 thing. Interest.create(
project: @project,
investor: companies(:invco),
state: :followed) The solution, if you need to use mass assignment here, is to do something like this: Interest.create(
project_id: @project.id,
investor_id: companies(:invco).id,
state: :followed) or i = Interest.new
i.project_id = @project.id
i.investor_id = companies(:invco).id
i.state = :followed
i.save Anyways, I don't think this is an issue with enum_attr, but something that both of us were probably doing wrong. It was on my end at least. |
Found the commit in Rails: |
Yep, that was exactly the problem. I was pumping a mock object in at create. Leaving that until afterwards made the warnings go away. |
Am getting this warning....
"DEPRECATION WARNING: You're trying to create an attribute 'game_category'. Writing arbitrary attributes on a model is deprecated. Please just use 'attr_writer' etc. (called from write_enumerated_attribute at /Users/Dom/.rvm/gems/ruby-1.9.3-p194/bundler/gems/enumerated_attribute-56c3506a7778/lib/enumerated_attribute/integrations/active_record.rb:24)"
... when running RSpec tests. Tests do pass okay, and the code works fine. Is it something I am doing?
The text was updated successfully, but these errors were encountered: