Sha256: c2d658956de5fb69dda96f5a3d4c6b0b376a9a4886aac8e4e91189821fd7dabd
Contents?: true
Size: 930 Bytes
Versions: 2
Compression:
Stored size: 930 Bytes
Contents
# frozen_string_literal: true require 'json' require 'csv' RSpec.describe SoapyBing::Ads::Reports::Parsers::CSVParser do describe '#rows' do subject { described_class.new(csv_data).rows } context 'on valid CSV data' do let(:csv_fixture_path) do File.join('spec', 'fixtures', 'reports', 'campaign_performance_report.csv') end let(:csv_data) { File.read(csv_fixture_path) } let(:json_fixture_path) do File.join('spec', 'fixtures', 'reports', 'campaign_performance_report.json') end let(:json_data) { JSON.load(File.read(json_fixture_path)) } it 'responds with array of Hashes' do expect(subject).to eq json_data end end context 'on malformed CSV data' do let(:csv_data) { '"co", "' } it 'throws exception CSV::MalformedCSVError' do expect { subject }.to raise_error CSV::MalformedCSVError end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
soapy_bing-0.1.0 | spec/soapy_bing/ads/reports/parsers/csv_parser_spec.rb |
soapy_bing-0.0.5 | spec/soapy_bing/ads/reports/parsers/csv_parser_spec.rb |