Skip to content

Commit

Permalink
Add failing test for deserializing poorly formatted, non-delayed job …
Browse files Browse the repository at this point in the history
…based yaml loading.
  • Loading branch information
gaffneyc committed Feb 11, 2011
1 parent 8d302a7 commit 4513aee
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions spec/yaml_ext_spec.rb
Expand Up @@ -3,14 +3,29 @@
describe YAML do
it "should autoload classes that are unknown at runtime" do
lambda {
YAML.load("--- !ruby/object:Autoloaded::Clazz {}")
obj = YAML.load("--- !ruby/object:Autoloaded::Clazz {}")
obj.class.to_s.should == 'Autoloaded::Clazz'
}.should_not raise_error
end

it "should autoload structs that are unknown at runtime" do
lambda {
YAML.load("--- !ruby/struct:Autoloaded::Struct {}")
obj = YAML.load("--- !ruby/struct:Autoloaded::Struct {}")
obj.class.to_s.should == 'Autoloaded::Struct'
}.should_not raise_error
end

# As we're overriding some of Yaml's internals it is best that our changes
# don't impact other places where Yaml is used. Or at least don't make it
# look like the exception is caused by DJ
it "should not raise exception on poorly formatted yaml" do
lambda do
YAML.load(<<-EOYAML
default:
<<: *login
EOYAML
)
end.should_not raise_error
end

end
end

0 comments on commit 4513aee

Please sign in to comment.