test/example_proxy_test.rb in surrounded-0.9.1 vs test/example_proxy_test.rb in surrounded-0.9.2
- old
+ new
@@ -34,12 +34,17 @@
trigger :admin_missing_method do
admin.method_that_does_not_exist
end
end
-ProxyUser = Struct.new(:name)
-ProxyUser.send(:include, Surrounded)
+ProxyUser = Class.new do
+ include Surrounded
+ def initialize(name)
+ @name = name
+ end
+ attr_reader :name
+end
describe ProxyContext do
let(:user){
ProxyUser.new('Jim')
}
@@ -58,10 +63,10 @@
end
it 'passes missing methods up the ancestry of the object' do
err = ->{ context.admin_missing_method }.must_raise(NoMethodError)
- assert_match 'ProxyUser name="Jim"', err.message
+ assert_match /ProxyUser.*name="Jim"/, err.message
end
it 'allows access to other objects in the context' do
assert_equal 'GTD', context.talking
end