Sha256: a3c5755e50652ce1cdbaecc7cf19181a08c2df73f0c85d397610faf338f27139

Contents?: true

Size: 671 Bytes

Versions: 12

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

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

  context 'href_for' do
    it 'injects variables and returns href' do
      expect(Record.href_for(1)).to eq 'http://datastore/records/1'
      expect(Record.href_for('vmasd241')).to eq 'http://datastore/records/vmasd241'
    end

    it 'also works with url_for (alias)' do
      expect(Record.url_for(1)).to eq 'http://datastore/records/1'
      expect(Record.url_for('vmasd241')).to eq 'http://datastore/records/vmasd241'
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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