Sha256: 8b6847f1f48d027b76cf57fa50c87cdd6d09b34a93e85e93314387948bcb2c70
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' require "csv_shaper_template" describe CsvShaperTemplate do it "should allow configuration via #config method" do csv_string = CsvShaperTemplate.encode(double('context')) do |csv| csv.config.write_headers = false csv.config.col_sep = ';' csv.headers :name, :age, :gender csv.row do |csv| csv.cell :name, 'Paul' csv.cell :age, '27' csv.cell :gender, 'Male' end end expect(csv_string).to eq "Paul;27;Male\n" end it "should override global configuration with local configuration" do CsvShaper::Shaper.config = CsvShaper::Config.new do |c| c.write_headers = false c.col_sep = "\t" end csv_string = CsvShaperTemplate.encode(double('context')) do |csv| csv.config.col_sep = ',' csv.headers :name, :age, :gender csv.row do |csv| csv.cell :name, 'Paul' csv.cell :age, '27' csv.cell :gender, 'Male' end end expect(csv_string).to eq "Paul,27,Male\n" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
csv_shaper-1.3.2 | spec/csv_shaper_template_spec.rb |
csv_shaper-1.3.1 | spec/csv_shaper_template_spec.rb |
csv_shaper-1.3.0 | spec/csv_shaper_template_spec.rb |