Sha256: 305d6362bc3fa3c809eb677734acb851244c635bf69a77ab354e4c823736a535

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'
require 'fortnox/api'
require 'fortnox/api/mappers'
require 'fortnox/api/repositories/customer'
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'
require 'fortnox/api/repositories/examples/search'

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

  before{ set_api_test_configuration }

  subject(:repository){ described_class.new }

  include_examples '.save',
                   :description,
                   additional_attrs: { sales_account: 1250 }

  include_examples '.save with specially named attribute',
                   { description: 'Test article' },
                   :ean,
                   '5901234123457'

  include_examples '.all', 12

  include_examples '.find', '1' do
    let( :find_by_hash_failure ){ { description: 'Not Found' } }
    let( :single_param_find_by_hash ){ { find_hash: { articlenumber: 1 }, matches: 3 } }

    let( :multi_param_find_by_hash ) do
      { find_hash: { articlenumber: 1, description: 'Cykelpump' }, matches: 1 }
    end
  end

  include_examples '.search', :description, 'Testartikel', 2
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fortnox-api-0.5.2 spec/fortnox/api/repositories/article_spec.rb
fortnox-api-0.5.1 spec/fortnox/api/repositories/article_spec.rb
fortnox-api-0.5.0 spec/fortnox/api/repositories/article_spec.rb