test/test_serialize.rb in rest-graph-1.5.0 vs test/test_serialize.rb in rest-graph-1.6.0

- old
+ new

@@ -5,16 +5,25 @@ require File.dirname(__FILE__) + '/common' end describe RestGraph do after do - reset_webmock + WebMock.reset_webmock RR.verify end - it 'could be serialized with lighten' do - marshal = RUBY_VERSION >= '1.9' ? Marshal : nil - [YAML, marshal].compact.each{ |engine| + should 'be serialized with lighten' do + engines = if RUBY_VERSION >= '1.9.2' + require 'psych' + YAML::ENGINE.yamler = 'syck' # TODO: probably a bug? + [Marshal, YAML, Psych] + elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' + [Marshal] + else + [YAML] + end + + engines.each{ |engine| test = lambda{ |obj| engine.load(engine.dump(obj)) } rg = RestGraph.new(:log_handler => lambda{}) lambda{ test[rg] }.should.raise(TypeError) test[rg.lighten].should == rg.lighten lambda{ test[rg] }.should.raise(TypeError)