Sha256: 515d3a1acddb907209e5d6342663fd784610d5c79390ad8d7067d7ad0e97c192

Contents?: true

Size: 812 Bytes

Versions: 15

Compression:

Stored size: 812 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

15 entries across 15 versions & 1 rubygems

Version Path
active_remote-3.3.3 spec/lib/active_remote/serialization_spec.rb
active_remote-3.3.2 spec/lib/active_remote/serialization_spec.rb
active_remote-3.3.1 spec/lib/active_remote/serialization_spec.rb
active_remote-3.3.0 spec/lib/active_remote/serialization_spec.rb
active_remote-3.2.2 spec/lib/active_remote/serialization_spec.rb
active_remote-3.2.1 spec/lib/active_remote/serialization_spec.rb
active_remote-3.2.0 spec/lib/active_remote/serialization_spec.rb
active_remote-3.2.0.pre spec/lib/active_remote/serialization_spec.rb
active_remote-3.1.3 spec/lib/active_remote/serialization_spec.rb
active_remote-3.1.2 spec/lib/active_remote/serialization_spec.rb
active_remote-3.1.2.pre spec/lib/active_remote/serialization_spec.rb
active_remote-3.1.1 spec/lib/active_remote/serialization_spec.rb
active_remote-3.1.0 spec/lib/active_remote/serialization_spec.rb
active_remote-3.0.0 spec/lib/active_remote/serialization_spec.rb
active_remote-3.0.0.pre1 spec/lib/active_remote/serialization_spec.rb