Sha256: 8921651502892d55561c8045981d886781e80e06c6bd420ed9d85f9c033a0b1e
Contents?: true
Size: 1.22 KB
Versions: 11
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' describe EY::CloudClient::ApiStruct do class Foo < EY::CloudClient::ApiStruct.new(:fruit, :veggie); end it "acts like a normal struct" do f = Foo.new(cloud_client, "fruit" => "banana") f.fruit.should == "banana" end describe "from_hash initializer" do it "assigns values from string keys" do f = Foo.from_hash(cloud_client, "fruit" => "banana") f.should == Foo.new(cloud_client, "fruit" => "banana") end it "assigns values from symbol keys" do f = Foo.from_hash(cloud_client, :fruit => "banana") f.should == Foo.new(cloud_client, "fruit" => "banana") end end describe "from_array initializer" do it "provides a from_array initializer" do f = Foo.from_array(cloud_client, [:fruit => "banana"]) f.should == [Foo.new(cloud_client, "fruit" => "banana")] end it "handles a common-arguments hash as the second argument" do foos = Foo.from_array(cloud_client, [{:fruit => "banana"}, {:fruit => 'apple'}], :veggie => 'kale') foos.should == [ Foo.new(cloud_client, "fruit" => "banana", "veggie" => "kale"), Foo.new(cloud_client, "fruit" => "apple", "veggie" => "kale"), ] end end end
Version data entries
11 entries across 11 versions & 1 rubygems