test/surrounded_context_test.rb in surrounded-0.9.1 vs test/surrounded_context_test.rb in surrounded-0.9.2

- old
+ new

@@ -256,5 +256,24 @@ it 'assigns a defined role to each item in a role player collection' do assert_equal "member show, member show", context.get_member_show end end + +class Keyworder + extend Surrounded::Context + + keyword_initialize :this, :that +end + +describe Surrounded::Context, 'keyword initializers' do + it 'works with keyword arguments' do + assert context = Keyworder.new(this: User.new('Jim'), that: User.new('Guille')) + end + + it 'raises errors with missing keywords' do + err = assert_raises(ArgumentError){ + Keyworder.new(this: User.new('Amy')) + } + assert_match /missing keyword: that/, err.message + end +end