spec/spec_helper.rb in cancan-1.6.7 vs spec/spec_helper.rb in cancan-1.6.8.rc1

- old
+ new

@@ -15,11 +15,11 @@ config.mock_with :rr config.before(:each) do Project.delete_all Category.delete_all end - config.extend WithModel + config.extend WithModel if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record" end class Ability include CanCan::Ability @@ -27,9 +27,24 @@ end end class Category < SuperModel::Base has_many :projects +end + +module Sub + class Project < SuperModel::Base + belongs_to :category + attr_accessor :category # why doesn't SuperModel do this automatically? + + def self.respond_to?(method, include_private = false) + if method.to_s == "find_by_name!" # hack to simulate ActiveRecord + true + else + super + end + end + end end class Project < SuperModel::Base belongs_to :category attr_accessor :category # why doesn't SuperModel do this automatically?