Sha256: b023608177caf08a476cdb42f54ca863d9f8c902e4a8dd1e0ccec3c539e84cf5

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

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

include OldApiResource

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

1 entries across 1 versions & 1 rubygems

Version Path
old_api_resource-0.3.0 spec/lib/model_errors_spec.rb