spec/csv2hash/validator_spec.rb in csv2hash-0.0.2 vs spec/csv2hash/validator_spec.rb in csv2hash-0.1

- old
+ new

@@ -1,24 +1,24 @@ require 'spec_helper' -describe Validator do +describe Csv2hash::Validator do let(:definition) do - Definition.new([ { position: [0,0], key: 'name' } ], Definition::MAPPING).tap do |definition| + Csv2hash::Definition.new([ { position: [0,0], key: 'name' } ], Csv2hash::Definition::MAPPING).tap do |definition| definition.validate! definition.default! end end subject do - Csv2hash.new(definition, 'file_path').tap do |csv2hash| - csv2hash.data_source = data_source + Csv2hash.new(definition, 'file_path').tap do |parser| + parser.instance_variable_set :@data_source, data_source end end describe '#message' do - subject { Csv2hash.new double('definition', type: Definition::COLLECTION), nil } + subject { Csv2hash.new double('definition', type: Csv2hash::Definition::COLLECTION), nil } context 'string value' do let(:rule) { { foo: 'bar', message: ':foo are value of foo key' } } it 'substitue value of key' do @@ -41,6 +41,6 @@ subject.send(:message, rule, 0, 2).should eql 'value not found on [0, 2]' end end end -end \ No newline at end of file +end