Sha256: e0360fcd01d75f921b45834f8dd7c74184e5d6dfb5ee05f5ac51ebfd6e323757
Contents?: true
Size: 886 Bytes
Versions: 3
Compression:
Stored size: 886 Bytes
Contents
require 'spec_helper' require 'json2xxx' describe Json2xxx::Core do before do @core = Core.new end it "tsv" do data = [ {id: 1, name: 'user1', address: 'tokyo'}, {id: 2, name: 'user2', address: 'tokyo'}, {id: 3, name: 'user3', address: 'tokyo'} ] result = @core.convert_csv(data, "\t") result.should == %Q{"id"\t"name"\t"address" "1"\t"user1"\t"tokyo" "2"\t"user2"\t"tokyo" "3"\t"user3"\t"tokyo" } end it "tsv" do data = [ {id: 1, name: 'user1', address: 'tokyo'}, {id: 2, name: 'user2', address: 'tokyo', zip_code: '111-1111'}, {id: 3, name: 'user3', address: 'tokyo'} ] result = @core.convert_csv(data, "\t") result.should == %Q{"id"\t"name"\t"address" "1"\t"user1"\t"tokyo" "2"\t"user2"\t"tokyo" "3"\t"user3"\t"tokyo" } end after do end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json2xxx-0.4.0 | spec/core_spec.rb |
json2xxx-0.3.0 | spec/core_spec.rb |
json2xxx-0.2.0 | spec/core_spec.rb |