Created
February 11, 2009 11:54
-
-
Save ismasan/61974 to your computer and use it in GitHub Desktop.
This file contains 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
module Spec | |
module Rails | |
module Matchers | |
def have_sane_through_associations | |
return simple_matcher(":through associations not to have the :dependent options}") do |model| | |
model = model.class if model.is_a? ActiveRecord::Base | |
not model.reflect_on_all_associations.any?{|a| a.options[:through] && a.options[:dependent]} | |
end | |
end | |
end | |
end | |
end | |
# Usage | |
User.should have_sane_through_associations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment