Sha256: 44ebc3ef1b1764774d8825b58b2a151b8acb35de816499279a88fc3aa5845a28

Contents?: true

Size: 810 Bytes

Versions: 18

Compression:

Stored size: 810 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|
        expect(record).to 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)
        expect(subject.errors[:name]).to match_array(["Boom!"])
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
active_remote-6.0.3 spec/lib/active_remote/serialization_spec.rb
active_remote-6.1.2 spec/lib/active_remote/serialization_spec.rb
active_remote-7.0.0 spec/lib/active_remote/serialization_spec.rb
active_remote-6.1.1 spec/lib/active_remote/serialization_spec.rb
active_remote-6.1.0 spec/lib/active_remote/serialization_spec.rb
active_remote-6.0.2 spec/lib/active_remote/serialization_spec.rb
active_remote-6.0.1 spec/lib/active_remote/serialization_spec.rb
active_remote-6.0.0.beta spec/lib/active_remote/serialization_spec.rb
active_remote-5.2.0 spec/lib/active_remote/serialization_spec.rb
active_remote-5.2.0.beta spec/lib/active_remote/serialization_spec.rb
active_remote-5.2.0.alpha spec/lib/active_remote/serialization_spec.rb
active_remote-5.0.1 spec/lib/active_remote/serialization_spec.rb
active_remote-5.1.1 spec/lib/active_remote/serialization_spec.rb
active_remote-5.1.0 spec/lib/active_remote/serialization_spec.rb
active_remote-5.0.0 spec/lib/active_remote/serialization_spec.rb
active_remote-5.1.0.rc1 spec/lib/active_remote/serialization_spec.rb
active_remote-5.0.0.rc1 spec/lib/active_remote/serialization_spec.rb
active_remote-5.0.0.pre spec/lib/active_remote/serialization_spec.rb