Sha256: 0d6faea0e7312cd77205538e2fe58f67a52242a95621b7fca4a1aecf143d75a4

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe "YAML" do
  it "should autoload classes" do
    lambda {
      yaml = "--- !ruby/class:Autoloaded::Clazz {}\n"
      YAML.load(yaml).should == Autoloaded::Clazz
    }.should_not raise_error
  end

  it "should autoload the class of a struct" do
    lambda {
      yaml = "--- !ruby/class:Autoloaded::Struct {}\n"
      YAML.load(yaml).should == Autoloaded::Struct
    }.should_not raise_error
  end

  it "should autoload the class for the instance of a struct" do
    lambda {
      yaml = "--- !ruby/struct:Autoloaded::InstanceStruct {}"
      YAML.load(yaml).class.should == Autoloaded::InstanceStruct
    }.should_not raise_error
  end

  it "should autoload the class for the instance" do
    lambda {
      yaml = "--- !ruby/object:Autoloaded::InstanceClazz {}\n"
      YAML.load(yaml).class.should == Autoloaded::InstanceClazz
    }.should_not raise_error
  end

  it "should not throw an uninitialized constant Syck::Syck when using YAML.load_file with poorly formed yaml" do
    lambda {
      YAML.load_file(File.expand_path('spec/fixtures/bad_alias.yml'))
    }.should_not raise_error
  end

  it "should not throw an uninitialized constant Syck::Syck when using YAML.load with poorly formed yaml" do
    lambda { YAML.load(YAML.dump("foo: *bar"))}.should_not raise_error
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
delayed_job_unique_key-0.0.4 spec/yaml_ext_spec.rb
delayed_job-3.0.0 spec/yaml_ext_spec.rb
delayed_job_unique_key-0.0.3 spec/yaml_ext_spec.rb
delayed_job_unique_key-0.0.2 spec/yaml_ext_spec.rb
delayed_job_unique_key-0.0.1 spec/yaml_ext_spec.rb
delayed_job-3.0.0.pre4 spec/yaml_ext_spec.rb
delayed_job-3.0.0.pre3 spec/yaml_ext_spec.rb
delayed_job-3.0.0.pre2 spec/yaml_ext_spec.rb