spec/unit/braintree/util_spec.rb in braintree-1.1.2 vs spec/unit/braintree/util_spec.rb in braintree-1.1.3
- old
+ new
@@ -135,9 +135,15 @@
it "returns the value if it's already an array" do
hash = {:foo => ["one", "two"], :bar => :baz}
result = Braintree::Util.extract_attribute_as_array(hash, :foo)
result.should == ["one", "two"]
end
+
+ it "returns empty array if the attribute is not in the hash" do
+ hash = {:foo => ["one", "two"], :bar => :baz}
+ result = Braintree::Util.extract_attribute_as_array(hash, :quz)
+ result.should == []
+ end
end
describe "self.hash_to_query_string" do
it "generates a query string from the hash" do
hash = {:foo => {:key_one => "value_one", :key_two => "value_two"}}