Sha256: 1e9a020e0bcf37f6616da1db288269ee142cd44bd77c790524e73d71a15fb9bd

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

# RSpec.shared_examples 'a quickbooks_online create' do
#   it do
#     result = create_result_for(
#       adaptor: adaptor,
#       resource: resource
#     )

#     expect(result).to be_success
#   end
# end

# RSpec.shared_examples 'a quickbooks_online find' do
#   it do
#     result = create_result_for(
#       adaptor: adaptor,
#       resource: resource
#     ).raise_if_error
#     expect(result).to be_success
#     resource = result.resource

#     result = find_result_for(
#       adaptor: adaptor,
#       resource: resource
#     )

#     expect(result).to be_success
#   end
# end

# RSpec.shared_examples 'a quickbooks_online update' do
#   it do
#     result = create_result_for(
#       adaptor: adaptor,
#       resource: resource
#     ).raise_if_error

#     expect(result).to be_success
#     resource = result.resource

#     # Ensure values are currently not the same as the updates
#     attribute_updates.each do |k, v|
#       expect(resource.send(k)).not_to eq(v)
#     end

#     resource.assign_attributes(attribute_updates)
#     result = update_result_for(
#       adaptor: adaptor,
#       resource: resource
#     )

#     expect(result).to be_success
#     resource = result.resource

#     # Ensure values are updated
#     attribute_updates.each do |k, v|
#       expect(resource.send(k)).to eq(v)
#     end

#     result = find_result_for(
#       adaptor: adaptor,
#       resource: resource.class.new(
#         ledger_id: resource.ledger_id
#       )
#     ).raise_if_error

#     expect(result).to be_success
#     resource = result.resource

#     # Ensure values are updated after raw find
#     attribute_updates.each do |k, v|
#       expect(resource.send(k)).to eq(v)
#     end
#   end
# end

RSpec.shared_examples 'a standard quickbooks_online resource' do
  it_behaves_like 'a create', delete: false
  it_behaves_like 'a find', delete: false
  it_behaves_like 'an update', delete: false
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ledger_sync-1.3.3 qa/support/quickbooks_online_shared_examples.rb
ledger_sync-1.3.2 qa/support/quickbooks_online_shared_examples.rb
ledger_sync-1.3.1 qa/support/quickbooks_online_shared_examples.rb