Sha256: 70ecacb26b188ff85434d48db2aae9abad066477c28e24d73713384f22413c62

Contents?: true

Size: 702 Bytes

Versions: 12

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe DHS::Record do
  context 'build' do
    let(:datastore) { 'http://depay.fi/v2' }

    before do
      DHC.config.placeholder('datastore', datastore)
      class Feedback < DHS::Record
        endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
        endpoint '{+datastore}/feedbacks'
      end
    end

    it 'builds a new item from scratch' do
      feedback = Feedback.build recommended: true
      expect(feedback).to be_kind_of Feedback
      expect(feedback.recommended).to eq true
      stub_request(:post, 'http://depay.fi/v2/feedbacks')
        .with(body: '{"recommended":true}')
      feedback.save
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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