Created
November 7, 2013 13:43
-
-
Save rubysolo/7354749 to your computer and use it in GitHub Desktop.
Workaround for rspec-fire "does not implement" errors with ActiveRecord models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # inside config.before(:suite) | |
| ActiveRecord::Base.subclasses.each do |model_class| | |
| columns = model_class.columns.map { |c| c.name.to_sym } | |
| missing = columns - model_class.instance_methods | |
| missing.each do |column| | |
| model_class.send(:define_method, column) { |*args| super(*args) } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment