Sha256: 4c9e71b699063d608e636bf1fe1c609728712970a88132cd1a83beb5ae2e5c15
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' describe DataForge::File do let(:definition) { instance_double "DataForge::File::RecordFileDefinition" } before do allow(DataForge::File::RecordFileDefinition).to receive(:from_input).with(:definition_name).and_return definition end after do subject.instance_variable_set :@file_definitions, {} end describe ".reader_for" do let(:reader) { double "Reader" } it "should return a record reader for the file with the specified name" do subject.register_file_definition :definition_name expect(DataForge::File::RecordFileReader).to receive(:for).with(definition).and_return reader expect(subject.reader_for :definition_name).to eq reader end it "should raise an error if there is no file registered by the specified name" do expect { subject.reader_for :definition_name }.to raise_error "Unknown file reference 'definition_name'" end end describe ".writer_for" do let(:writer) { double "Writer" } it "should return a record writer for the file with the specified name" do subject.register_file_definition :definition_name expect(DataForge::File::RecordFileWriter).to receive(:for).with(definition).and_return writer expect(subject.writer_for :definition_name).to eq writer end it "should raise an error if there is no file registered by the specified name" do expect { subject.writer_for :definition_name }.to raise_error "Unknown file reference 'definition_name'" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
data_forge-0.1 | spec/data_forge/file_spec.rb |