Sha256: e56ac3aad7baccd43af62477fde72cd0a5ef409b1ee62cb6c4c208c08d524d7d
Contents?: true
Size: 1.1 KB
Versions: 8
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe Ridley::DataBagItem do let(:connection) { double('connection') } let(:data_bag) { double('data_bag') } subject { Ridley::DataBagItem.new(connection, data_bag) } describe "::from_hash" do context "when JSON has a 'raw_data' field" do let(:response) do { "name" => "data_bag_item_ridley-test_appconfig", "raw_data" => { "id" => "appconfig", "host" => "host.local" }, "json_class" => "Chef::DataBagItem", "data_bag" => "ridley-test", "chef_type" => "data_bag_item" } end it "returns a new object from attributes in the 'raw_data' field" do subject.from_hash(response).attributes.should eql(response["raw_data"]) end end context "when JSON does not contain a 'raw_data' field" do let(:response) do { "id" => "appconfig", "host" => "host.local" } end it "returns a new object from the hash" do subject.from_hash(response).attributes.should eql(response) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems