test/surrounded_context_test.rb in surrounded-0.5.1 vs test/surrounded_context_test.rb in surrounded-0.6.0
- old
+ new
@@ -88,33 +88,35 @@
delegate_missing_methods
end
class RoleAssignmentContext
extend Surrounded::Context
- set_methods_as_triggers
initialize(:user, :other_user)
- trigger :user_ancestors do
+ def user_ancestors
user.singleton_class.ancestors
end
- trigger :other_user_ancestors do
+ def other_user_ancestors
other_user.singleton_class.ancestors
end
- trigger :check_user_response do
+ trigger def check_user_response
user.respond_to?(:a_method!)
end
+ trigger :check_user_response # should not raise error
trigger :check_other_user_response do
user.respond_to?(:a_method!)
end
def regular_method_trigger
user.respond_to?(:a_method!)
end
+
+ trigger :user_ancestors, :other_user_ancestors, :regular_method_trigger
module User
def a_method!; end
end
module OtherUser
@@ -172,7 +174,11 @@
assert context.check_user_response
end
it 'allows usage of regular methods for triggers' do
assert context.regular_method_trigger
+ end
+
+ it 'ignores nil trigger names' do
+ assert context.class.send(:trigger)
end
end
\ No newline at end of file