Sha256: ad43accb1134e7394dbdcbc77ce5fa4fdba1a8c773ea9d8502d9c460f0090daf

Contents?: true

Size: 726 Bytes

Versions: 57

Compression:

Stored size: 726 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

include ApiResource

describe "Saving Resources with errors" do
  
  before(:all) do
    ErrorResource.include_root_in_json = true
  end
  
  context "Remote Errors" do
  
    it "should be able to handle errors as a hash" do
      t = ErrorResource.new(:name => "Ethan", :age => 12)
      t.save.should be_false
      t.errors.should_not be_nil
      t.errors['name'].should_not be_nil
    end
  
    it "should be able to handle errors as full messages" do
      t = ErrorFullMessageResource.new(:name => "Ethan", :age => 12)
      t.save.should be_false
      t.errors.should_not be_nil
      t.errors['name'].should_not be_nil
    end
    
  end
  
end

Version data entries

57 entries across 57 versions & 2 rubygems

Version Path
api_resource-0.6.25 spec/lib/model_errors_spec.rb
api_resource-0.6.24 spec/lib/model_errors_spec.rb
api_resource-0.6.23 spec/lib/model_errors_spec.rb
api_resource-0.6.22 spec/lib/model_errors_spec.rb
api_resource-0.6.21 spec/lib/model_errors_spec.rb
api_resource-0.6.20 spec/lib/model_errors_spec.rb
api_resource-0.6.19 spec/lib/model_errors_spec.rb
api_resource-0.6.18 spec/lib/model_errors_spec.rb
api_resource-0.6.17 spec/lib/model_errors_spec.rb
api_resource-0.6.16 spec/lib/model_errors_spec.rb
api_resource-0.6.15 spec/lib/model_errors_spec.rb
api_resource-0.6.14 spec/lib/model_errors_spec.rb
api_resource-0.6.13 spec/lib/model_errors_spec.rb
api_resource-0.6.12 spec/lib/model_errors_spec.rb
api_resource-0.6.11 spec/lib/model_errors_spec.rb
api_resource-0.6.9 spec/lib/model_errors_spec.rb
api_resource-0.6.10 spec/lib/model_errors_spec.rb
api_resource-0.6.8 spec/lib/model_errors_spec.rb
api_resource-0.6.7 spec/lib/model_errors_spec.rb
api_resource-0.6.6 spec/lib/model_errors_spec.rb