Sha256: e654e21a30afef667a95ee8de49b76e239c8899c57f59fcbc8ab8a074cbeee5c

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

require 'smart_csv'

describe "Check class CSV::Table" do
  before(:each) do
    data = "id,firstname,lastname\n1,One,One\n2,Two,Two\n4,Four,Four\n5,Five,Five\n6,One,One"
    @data = CSV.parse(data, {:col_sep => ',', :headers => true})
  end

  it "should correct create one record" do
    @data.size.should eql(5)
    @data.create("id"=> '13', "lastname" => '1992')
    @data.size.should eql(6)
    @data[-1]["id"].should eql('13')
  end

  it "should correct select records" do
    @data.where('firstname' => 'One').size.should eql(2)
    @data.where('firstname' => 'One').where_not('id' => '6').size.should eql(1)
  end

  it "should correct delete records" do
    @data.size.should eql(5)
    @data.delete_all
    @data.size.should eql(0)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_csv-0.0.2 spec/csv/table/table_spec.rb