# frozen_string_literal: true require 'spec_helper' describe Imis::Panel::Vsc do let(:vsc) { described_class.new } let(:details) do { certificate: 'E136924', year: 2024, count: 42 } end before { vsc.api.imis_id = 6374 } describe '#get' do it 'loads a specific object' do expect(vsc.get(1433)).to be_a(Hash) end end # rubocop:disable RSpec/ExampleLength it 'handles new records correctly', :aggregate_failures do new_record = vsc.create(details) expect(new_record).to be_a(Hash) ordinal = new_record['Properties']['$values'][1]['Value']['$value'] update_result = vsc.update(details.merge(count: 43, ordinal: ordinal)) updated = update_result['Properties']['$values'].find { |v| v['Name'] == 'Quantity' } expect(updated['Value']['$value']).to eq(43) expect(vsc.destroy(ordinal)).to eq('') end # rubocop:enable RSpec/ExampleLength end