spec/errors_spec.rb in mutations-0.8.3 vs spec/errors_spec.rb in mutations-0.9.0
- old
+ new
@@ -53,12 +53,24 @@
assert o.errors[:arr1][0].is_a?(Mutations::ErrorAtom)
assert_nil o.errors[:arr1][1]
assert o.errors[:arr1][2].is_a?(Mutations::ErrorAtom)
end
- it "titleizes keys" do
- atom = Mutations::ErrorAtom.new(:newsletter_subscription, :boolean)
- assert_equal "Newsletter Subscription isn't a boolean", atom.message
+ describe "error messages" do
+ it "titleizes keys" do
+ atom = Mutations::ErrorAtom.new(:newsletter_subscription, :boolean)
+ assert_equal "Newsletter Subscription isn't a boolean", atom.message
+ end
+
+ it "titleizes _id postfix as ID" do
+ atom = Mutations::ErrorAtom.new(:newsletter_subscription_id, :boolean)
+ assert_equal "Newsletter Subscription ID isn't a boolean", atom.message
+ end
+
+ it "titleizes id as ID" do
+ atom = Mutations::ErrorAtom.new(:id, :boolean)
+ assert_equal "ID isn't a boolean", atom.message
+ end
end
describe "Bunch o errors" do
before do
@outcome = GivesErrors.run(:str1 => "", :str2 => "opt9", :int1 => "zero", :hash1 => {:bool1 => "bob"}, :arr1 => ["bob", 1, "sally"])