Sha256: ca8e4cd85e5f90c3c508380147bdce837a880ce9730b4f3acf1b9163a0c50998

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'fortnox/api'
require 'fortnox/api/mappers'
require 'fortnox/api/repositories/unit'
require 'fortnox/api/repositories/examples/all'
require 'fortnox/api/repositories/examples/find'
require 'fortnox/api/repositories/examples/save'
require 'fortnox/api/repositories/examples/save_with_specially_named_attribute'

describe Fortnox::API::Repository::Unit, order: :defined, integration: true do
  include Helpers::Configuration

  before { set_api_test_configuration }

  subject(:repository) { described_class.new }

  # When recording new VCR cassettes, code needs to be changed to a unique value
  include_examples '.save',
                   :description,
                   additional_attrs: { code: 'blarg4' }

  # When recording new VCR cassettes, code needs to be changed to a unique value
  include_examples '.save with specially named attribute',
                   { description: 'Happy clouds' },
                   :code,
                   'woooh4'

  # When recording new VCR cassettes, expected number must be updated
  include_examples '.all', 12

  include_examples '.find', 'blarg', find_by_hash: false do
    let(:find_by_hash_failure) { { code: 'notfound' } }
    let(:single_param_find_by_hash) { { find_hash: { code: 'blarg' }, matches: 1 } }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fortnox-api-0.7.2 spec/fortnox/api/repositories/unit_spec.rb
fortnox-api-0.7.1 spec/fortnox/api/repositories/unit_spec.rb
fortnox-api-0.7.0 spec/fortnox/api/repositories/unit_spec.rb