![]() Fix `class_name` qualifier for association matchers so that if the model being referenced is namespaced, the matcher will correctly resolve the class before checking it against the association's `class_name`. Take these models for instance: module Models class Friend < ActiveRecord::Base end class User < ActiveRecord::Base has_many :friends, class_name: 'Friend' end end Here, the `has_many` is referring to Models::Friend, not just Friend. Previously in order to test the association, you had to write: describe Models::User do it { should have_many(:friends).class_name('Models::Friend') } end Now, `have_many` will attempt to resolve the string given to `class_name` within the context of the namespace first before treating it as a reference to a global constant. This means you can now write this: describe Models::User do it { should have_many(:friends).class_name('Friend') } end |
||
---|---|---|
.. | ||
association_matchers | ||
accept_nested_attributes_for_matcher.rb | ||
association_matcher.rb | ||
association_matchers.rb | ||
define_enum_for_matcher.rb | ||
have_db_column_matcher.rb | ||
have_db_index_matcher.rb | ||
have_readonly_attribute_matcher.rb | ||
serialize_matcher.rb |