rspec-rails-2.8.1 is released
January 5th, 2012
Bug fix release
The rails-3.2.0.rc2 release broke stub_model in rspec-rails-2.0.0 > 2.8.0.
The rspec-rails-2.8.1 release fixes this issue, but it means that when you
upgrade to rails-3.2.0.rc2 or greater, you’ll have to upgrade to
rspec-rails-2.8.1 or greater.
Because rspec-rails-2.8.1 supports all versions of rails since 3.0, I recommend that you upgrade to rspec-rails-2.8.1 first, and then upgrade to rails-3.2.0.rc2 (or 3.2.0 once it’s out).
Changelog
http://rubydoc.info/gems/rspec-rails/file/Changelog.md
Docs
http://rubydoc.info/gems/rspec-rails
http://relishapp.com/rspec/rspec-rails


January 8th, 2012 at 1:47 am
wow, it runs much faster now the rspec/rails 2.8 combo.
rspec 2.8.0: 20.19 seconds (288 examples) rspec 2.7.0: 49.31 seconds (288 examples)
thanks for this great realease.
January 19th, 2012 at 4:20 pm
stub_model does not seems to work for a table that has no :id. I currently have a model Model1 that has an one to one association (i.e. belongs_to) with another model Model2; and so I set id to false for the table associated with Model1 (it instead has a reference id to the table of Model2 and this reference id has an uniqueness validation within Model1).
To get around this, I am using mock_model for the table without an id (i.e. Model1 above).
Assuming I am doing nothing wrong here, is there a way to get around this problem for stub_model? From what I understand, stub_model needs an :id for methods like :new_record? etcetera.
January 19th, 2012 at 11:01 pm
I realized that stub_model does support a primary key other than id (see link below).
So, for example, if I change :user_id type to :primary_key (instead of :reference or :integer etc) within the migrate file for the table associated with Model1(i.e. Model1 in my first post above), stub_model works.
https://github.com/amatsuda/rspec-rails/commit/108e9bccd2693feac46bce3b2b24c427e6c1abdf
(Just a suggestion: it will be nice if stub_model throws out a more readable error (e.g. no primary_key or id), instead of “to_sym not defined for nil class”. )