Sha256: 332f8b6c5f6eed0ef11353cc1ed30b039437daf3b2fc7cad1716cbd000d5f685
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require 'helper' describe 'YAML' do it 'autoloads classes' do expect { yaml = "--- !ruby/class Autoloaded::Clazz\n" expect(load_with_delayed_visitor(yaml)).to eq(Autoloaded::Clazz) }.not_to raise_error end it 'autoloads the class of a struct' do expect { yaml = "--- !ruby/class Autoloaded::Struct\n" expect(load_with_delayed_visitor(yaml)).to eq(Autoloaded::Struct) }.not_to raise_error end it 'autoloads the class for the instance of a struct' do expect { yaml = '--- !ruby/struct:Autoloaded::InstanceStruct {}' expect(load_with_delayed_visitor(yaml).class).to eq(Autoloaded::InstanceStruct) }.not_to raise_error end it 'autoloads the class of an anonymous struct' do expect { yaml = "--- !ruby/struct\nn: 1\n" object = YAML.load(yaml) expect(object).to be_kind_of(Struct) expect(object.n).to eq(1) }.not_to raise_error end it 'autoloads the class for the instance' do expect { yaml = "--- !ruby/object:Autoloaded::InstanceClazz {}\n" expect(load_with_delayed_visitor(yaml).class).to eq(Autoloaded::InstanceClazz) }.not_to raise_error end it 'does not throw an uninitialized constant Syck::Syck when using YAML.load with poorly formed yaml' do expect { YAML.load(YAML.dump('foo: *bar')) }.not_to raise_error end def load_with_delayed_visitor(yaml) YAML.load_dj(yaml) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
delayed-0.2.0 | spec/yaml_ext_spec.rb |
delayed-0.1.1 | spec/yaml_ext_spec.rb |
delayed-0.1.0 | spec/yaml_ext_spec.rb |