Sha256: a561a88d85ed4f5d3324dd8766da471341de0609c6651d3354c259c7b1ef35d6

Contents?: true

Size: 1.29 KB

Versions: 4

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

4 entries across 4 versions & 2 rubygems

Version Path
drewda_delayed_job-3.0.3 spec/yaml_ext_spec.rb
delayed_job-3.0.3 spec/yaml_ext_spec.rb
delayed_job-3.0.2 spec/yaml_ext_spec.rb
delayed_job-3.0.1 spec/yaml_ext_spec.rb