Sha256: 8ff86481989d011e36f61e38f9d1858d98597677ec22056283e312f7a2910817

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 Bytes

Contents

require 'spec_helper'

describe ActiveRemote::Serialization do
  describe ".serialize_records" do
    let(:records) { [ { :foo => 'bar' } ] }

    subject { Tag.new }

    it "serializes records into active remote objects" do
      Tag.serialize_records(records).each do |record|
        record.should be_a Tag
      end
    end
  end

  describe "#add_errors" do
    let(:error) { Generic::Error.new(:field => 'name', :message => 'Boom!') }
    let(:response) {
      tag = Generic::Remote::Tag.new
      tag.errors << error
      tag
    }

    subject { Tag.new }

    context "when the response has errors" do
      it "adds the errors to the active remote object" do
        subject.add_errors(response.errors)
        subject.errors[:name].should =~ ['Boom!']
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_remote-2.1.0.rc1 spec/lib/active_remote/serialization_spec.rb
active_remote-2.1.0.beta2 spec/lib/active_remote/serialization_spec.rb
active_remote-2.1.0.beta1 spec/lib/active_remote/serialization_spec.rb