|
1 | 1 | require_relative '../fixtures/common' |
2 | 2 | require_relative '../fixtures/strings' |
3 | 3 |
|
4 | | -describe :yaml_load, shared: true do |
5 | | - after :each do |
6 | | - rm_r $test_file |
7 | | - end |
8 | | - |
| 4 | +describe :yaml_load_safe, shared: true do |
9 | 5 | it "returns a document from current io stream when io provided" do |
10 | 6 | File.open($test_file, 'w') do |io| |
11 | 7 | YAML.dump( ['badger', 'elephant', 'tiger'], io ) |
12 | 8 | end |
13 | 9 | File.open($test_file) { |yf| YAML.send(@method, yf ) }.should == ['badger', 'elephant', 'tiger'] |
| 10 | + ensure |
| 11 | + rm_r $test_file |
14 | 12 | end |
15 | 13 |
|
16 | 14 | it "loads strings" do |
|
90 | 88 | YAML.send(@method, block_seq).should == [[["one", "two", "three"]]] |
91 | 89 | end |
92 | 90 |
|
| 91 | + it "loads a symbol key that contains spaces" do |
| 92 | + string = ":user name: This is the user name." |
| 93 | + expected = { :"user name" => "This is the user name."} |
| 94 | + YAML.send(@method, string).should == expected |
| 95 | + end |
| 96 | +end |
| 97 | + |
| 98 | +describe :yaml_load_unsafe, shared: true do |
93 | 99 | it "works on complex keys" do |
94 | 100 | require 'date' |
95 | 101 | expected = { |
|
101 | 107 | YAML.send(@method, $complex_key_1).should == expected |
102 | 108 | end |
103 | 109 |
|
104 | | - it "loads a symbol key that contains spaces" do |
105 | | - string = ":user name: This is the user name." |
106 | | - expected = { :"user name" => "This is the user name."} |
107 | | - YAML.send(@method, string).should == expected |
108 | | - end |
109 | | - |
110 | 110 | describe "with iso8601 timestamp" do |
111 | 111 | it "computes the microseconds" do |
112 | 112 | [ [YAML.send(@method, "2011-03-22t23:32:11.2233+01:00"), 223300], |
|
0 commit comments