Sha256: ace211114c7f31d61d582d516f095a25f4063b1ca80cd527a797dd51fd656b7f
Contents?: true
Size: 724 Bytes
Versions: 1
Compression:
Stored size: 724 Bytes
Contents
# frozen_string_literal: true require 'csv' RSpec.describe SolidusFeeds::Publishers::StaticFile do let(:filename) { 'my_feed.csv' } let(:io) { StringIO.new } let(:generator) { ->(io) { csv = CSV.new(io) csv << ["some", "data"] csv << ["another", "line"] } } describe '#call' do it 'saves the generated content to the specified file' do buffer = StringIO.new allow(File).to receive(:open).with(filename, 'w').and_yield(buffer) static_file_publisher = described_class.new(path: filename) static_file_publisher.call do |io| generator.call(io) end expect(buffer.string).to eq( "some,data\nanother,line\n" ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_feeds-0.1.0 | spec/lib/solidus_feeds/publishers/static_file_spec.rb |