Sha256: a4d2eedf05d72e50a0e65a5f02700378f79b9c6c438730968bd9b6bdce340f54
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' RSpec.describe RDStation::Fields do let(:valid_auth_token) { 'valid_auth_token' } let(:rdstation_fields_with_valid_token) { described_class.new(valid_auth_token) } let(:valid_headers) do { 'Authorization' => "Bearer #{valid_auth_token}", 'Content-Type' => 'application/json' } end describe '#all' do let(:fields_endpoint) { 'https://api.rd.services/platform/contacts/fields' } let(:all_account_fields) do { 'fields' => [ { 'uuid' => 'fdeba6ec-f1cf-4b13-b2ea-e93d47c0d828', 'api_identifier' => 'name', 'custom_field' => false, 'data_type' => 'STRING', 'name' => { 'default' => 'nome', 'pt-BR' => 'nome' }, 'label' => { 'default' => 'Nome completo', 'pt-BR' => 'Nome completo' }, 'presentation_type' => 'TEXT_INPUT', 'validation_rules' => {} } ] } end context 'with a valid auth token' do before do stub_request(:get, fields_endpoint) .with(headers: valid_headers) .to_return(status: 200, body: all_account_fields.to_json) end it 'returns all account fields' do fields = rdstation_fields_with_valid_token.all expect(fields).to eq(all_account_fields) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems