spec/lib/mustache/data_spec.rb in mustache_render-0.0.21 vs spec/lib/mustache/data_spec.rb in mustache_render-0.0.22
- old
+ new
@@ -20,27 +20,27 @@
it 'render a array' do
data.a = [{:a => 1, :b => 2}, {:a => 10, :b => 20}]
data.render('{{#a}}a:{{a}} b:{{b}}{{/a}}').should == "a:1 b:2a:10 b:20"
end
- it '所有的key转为字符串' do
+ it '所有的key转为symbol' do
data[:a] = 'b'
- data.inspect.should == "{\"a\"=>\"b\"}"
+ data.inspect.should == "{\:a=>\"b\"}"
end
it '当为数组的时候,每个元素也许要进行key字符串化' do
data.b.c = [{:a => 'a', 'b' => 'b'}]
- data.inspect.should == "{\"b\"=>{\"c\"=>[{\"b\"=>\"b\", \"a\"=>\"a\"}]}}"
+ data.should == {:b=>{:c=>[{:a=>"a", "b"=>"b"}]}}
end
it '基本赋值方法' do
data.site = {
:name => 'a'
}
- data.inspect.should == "{\"site\"=>{\"name\"=>\"a\"}}"
- data.site.inspect.should == "{\"name\"=>\"a\"}"
+ data.inspect.should == "{:site=>{:name=>\"a\"}}"
+ data.site.inspect.should == "{:name=>\"a\"}"
end
it '取值类型为数组' do
data.sites = [1, 2, 3]