Sha256: f0f83eedca21ce0c4a0f6ec1d171ced9a7060a007d278bbe7b38a32c4275b05f

Contents?: true

Size: 477 Bytes

Versions: 12

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe DHS::Record do
  before do
    class Record < DHS::Record
      endpoint 'http://datastore/records'
    end
  end

  let(:item) { { name: 'Thomas' } }
  let(:body) { [item] }

  it 'converts itself to hash' do
    stub_request(:get, 'http://datastore/records')
      .to_return(body: body.to_json)
    record = Record.where.first
    expect(record.to_h).to eq item
    expect(record.to_hash).to eq item
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 spec/record/to_hash_spec.rb
dhs-1.5.0 spec/record/to_hash_spec.rb
dhs-1.4.2 spec/record/to_hash_spec.rb
dhs-1.4.1 spec/record/to_hash_spec.rb
dhs-1.4.0 spec/record/to_hash_spec.rb
dhs-1.3.0 spec/record/to_hash_spec.rb
dhs-1.2.0 spec/record/to_hash_spec.rb
dhs-1.1.0 spec/record/to_hash_spec.rb
dhs-1.0.3 spec/record/to_hash_spec.rb
dhs-1.0.2 spec/record/to_hash_spec.rb
dhs-1.0.1 spec/record/to_hash_spec.rb
dhs-1.0.0 spec/record/to_hash_spec.rb