Sha256: 56810bb9dc3f2c9fa024ffcf9dbb5ad37ed471c8005d13006af8b6bba6a821b5
Contents?: true
Size: 984 Bytes
Versions: 2
Compression:
Stored size: 984 Bytes
Contents
require 'spec_helper' require 'support/model_test_helpers' require 'multi_json' # require 'gorillib/model' require 'gorillib/builder' require 'gorillib/model/serialization/csv' describe Gorillib::Model::LoadFromCsv, :model_spec, :builder_spec do context ".load_csv" do let(:expected_engine) do {:name=>:Wankel, :carburetor=>:no, :volume=>1, :cylinders=>982, :owner=>"who_am_i"} end before :each do engine_class.class_eval { include Gorillib::Model::LoadFromCsv } csv_file = double('csv_file') csv_file.stub(:shift) {} csv_file.stub(:each).and_yield(expected_engine.values) CSV.should_receive(:open).and_yield(csv_file) end it "loads from file" do engine_class.load_csv('test').to_wire().first.keep_if{|k,| k != :_type}.should eql(expected_engine) end it "loads from file with block" do expect { |b| engine_class.load_csv('test', &b) }.to yield_with_args(engine_class) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gorillib-0.6.0 | spec/gorillib/model/serialization/csv_spec.rb |
gorillib-0.5.2 | spec/gorillib/model/serialization/csv_spec.rb |