diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-05-19 01:44:05 -0700 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-05-19 01:44:05 -0700 |
commit | 4ce7356d6d08cf02dde23b6e2fe2066a26ec45b2 (patch) | |
tree | 9e9953b6240efe270603a19151d91c9c8a0508dc /spec/unit/resource_collection_spec.rb | |
parent | a125c8a450c4368bfdb1668679dd7153d53757c6 (diff) | |
download | chef-4ce7356d6d08cf02dde23b6e2fe2066a26ec45b2.tar.gz |
Working on network layer
Diffstat (limited to 'spec/unit/resource_collection_spec.rb')
-rw-r--r-- | spec/unit/resource_collection_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb index 10f251aaac..ac83e019c0 100644 --- a/spec/unit/resource_collection_spec.rb +++ b/spec/unit/resource_collection_spec.rb @@ -171,6 +171,20 @@ describe Chef::ResourceCollection do it "should raise an exception if you pass something other than a string or hash to resource" do lambda { @rc.resources([Array.new]) }.should raise_error(ArgumentError) end + + it "should serialize to json" do + json = @rc.to_json + json.should =~ /json_class/ + json.should =~ /instance_vars/ + end + + it "should deserialize itself from json" do + @rc << @resource + json = @rc.to_json + s_rc = JSON.parse(json) + s_rc.should be_a_kind_of(Chef::ResourceCollection) + s_rc[0].name.should eql(@resource.name) + end def check_by_names(results, *names) names.each do |res_name| |