Sha256: 8b0566791846f9e66ffad5ed40d0b6d36236165f1443761a1f6b18e5ed2f186c
Contents?: true
Size: 1.5 KB
Versions: 4
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' module Alf class Renderer describe CSV do context 'the class' do subject{ CSV } it_should_behave_like "a Renderer class" end context 'an instance on multiple tuples' do let(:input){ [{:id => 1, :name => "Smith"}, {:id => 2, :name => "Jones"}] } subject{ renderer.execute(StringIO.new).string } describe "without options" do let(:renderer){ CSV.new(input) } let(:expected){ "id,name\n1,Smith\n2,Jones\n" } it{ should eq(expected) } end describe "with options" do let(:renderer){ CSV.new(input, options) } let(:options){ {col_sep: ";"} } let(:expected){ "id;name\n1;Smith\n2;Jones\n" } it{ should eq(expected) } end end context 'an instance on a single tuples' do subject{ renderer.execute(StringIO.new).string } let(:input){ {:id => 1, :name => "Smith"} } describe "without options" do let(:renderer){ CSV.new(input) } let(:expected){ "id,name\n1,Smith\n" } it{ should eq(expected) } end describe "with options" do let(:renderer){ CSV.new(input, options) } let(:options){ {col_sep: ";"} } let(:expected){ "id;name\n1;Smith\n" } it{ should eq(expected) } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems