Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'v0.2.1'

Conflicts:
	Gemfile.lock
  • Loading branch information...
commit c6ed5ff3821c90c6af5f534ec832123b866fea94 2 parents 154fe4c + 01aa971
pvertenten authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/shoulda/callback/matchers/active_model.rb
10 lib/shoulda/callback/matchers/active_model.rb
View
@@ -60,8 +60,14 @@ def matches?(subject)
false
else
callbacks = subject.send(:"_#{@lifecycle}_callbacks").dup
- callbacks = callbacks.select do |callback|
- callback.filter == @method &&
+ callbacks = callbacks.select do |callback|
+ object_match = @method.kind_of?(Class) &&
+ callback.filter.match(/^_callback/) &&
+ subject.respond_to?("#{callback.filter}_object") &&
+ subject.send("#{callback.filter}_object").class == @method
+
+ subject.respond_to?(callback.filter) &&
+ (object_match || callback.filter == @method) &&
callback.kind == @hook &&
matches_conditions?(callback) &&
matches_optional_lifecycle?(callback)
Please sign in to comment.
Something went wrong with that request. Please try again.