test/test_helper.rb in inch-0.5.0.rc1 vs test/test_helper.rb in inch-0.5.0.rc2
- old
+ new
@@ -16,9 +16,19 @@
expected.each do |role|
assert roles.include?(role), "Should assign #{role}"
end
end
+def count_roles(object, role_class, object_name = nil)
+ find_roles(object, role_class, object_name).size
+end
+
+def find_roles(object, role_class, object_name = nil)
+ object.roles.select do |r|
+ r.class == role_class && (object_name.nil? || r.object.name == object_name)
+ end
+end
+
def fixture_path(name)
File.join(File.dirname(__FILE__), "fixtures", name.to_s)
end
module Inch