spec/unit/braintree/util_spec.rb in braintree-2.0.0 vs spec/unit/braintree/util_spec.rb in braintree-2.1.0
- old
+ new
@@ -118,11 +118,11 @@
).should == ["nested[_any_key_]", "top_level"]
end
end
describe "self.extract_attribute_as_array" do
- it "delets the attribute from the hash" do
+ it "deletes the attribute from the hash" do
hash = {:foo => ["x"], :bar => :baz}
Braintree::Util.extract_attribute_as_array(hash, :foo)
hash.should == {:bar => :baz}
end
@@ -141,9 +141,15 @@
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
+
+ it "raises an UnexpectedError if nil data is provided" do
+ expect do
+ Braintree::Util.extract_attribute_as_array(nil, :abc)
+ end.to raise_error(Braintree::UnexpectedError, /Unprocessable entity due to an invalid request/)
+ 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"}}