Sha256: a56cb742525a3caba8047e54d43ad2b8008c9026e6dbbab8d82d46809913afed
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' require 'td/command/common' require 'td/command/job' require 'td/command/list' require 'tempfile' module TreasureData::Command describe 'job commands' do let :command do Class.new { include TreasureData::Command }.new end let :job do job = TreasureData::Job.new(nil, 12345, 'hive', 'select * from employee') job.instance_eval do @result = [[["1", 2.0, {key:3}], 1], [["4", 5.0, {key:6}], 2], [["7", 8.0, {key:9}], 3]] @result_size = 3 @status = 'success' end job end describe 'write_result' do it 'supports json output' do file = Tempfile.new("job_spec") command.send(:show_result, job, file, nil, 'json') File.read(file.path).should == %Q([["1",2.0,{"key":3}],\n["4",5.0,{"key":6}],\n["7",8.0,{"key":9}]]) end it 'supports csv output' do file = Tempfile.new("job_spec") command.send(:show_result, job, file, nil, 'csv') File.read(file.path).should == %Q(1,2.0,"{""key"":3}"\n4,5.0,"{""key"":6}"\n7,8.0,"{""key"":9}"\n) end it 'supports tsv output' do file = Tempfile.new("job_spec") command.send(:show_result, job, file, nil, 'tsv') File.read(file.path).should == %Q(1\t2.0\t{"key":3}\n4\t5.0\t{"key":6}\n7\t8.0\t{"key":9}\n) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
td-0.11.7 | spec/td/command/job_spec.rb |