test/surrounded_context_test.rb in surrounded-0.9.10 vs test/surrounded_context_test.rb in surrounded-0.9.11

- old
+ new

@@ -95,9 +95,24 @@ it 'checks for the role based upon the calling object' do refute context.role?(:user){} # this test is the caller end end +describe Surrounded::Context, '#role_player?' do + let(:player){ User.new("Jim") } + let(:other_player){ User.new("Amy") } + let(:non_player){ User.new("Guille") } + let(:context){ TestContext.new(player, other_player) } + + it 'is true if the given object is a role player' do + expect(context.role_player?(player)).must_equal true + end + + it 'is false if the given oject is not a role player' do + expect(context.role_player?(non_player)).must_equal false + end +end + class RoleAssignmentContext extend Surrounded::Context initialize(:user, :other_user) \ No newline at end of file