Sha256: df89504dbd2fb5f42b6f6321eb02476fb0eb64d593e9ba6cf1fc0cb0b4aa489e

Contents?: true

Size: 854 Bytes

Versions: 4

Compression:

Stored size: 854 Bytes

Contents

require File.dirname(__FILE__) + "/../spec_helper"

describe DBF::Column, "when initialized" do
  
  before(:each) do
    @column = DBF::Column.new "ColumnName", "N", 1, 0
  end
  
  it "should set the #name accessor" do
    @column.name.should == "ColumnName"
  end
  
  it "should set the #type accessor" do
    @column.type.should == "N"
  end
  
  it "should set the #length accessor" do
    @column.length.should == 1
  end
  
  it "should set the #decimal accessor" do
    @column.decimal.should == 0
  end
  
  it "should raise an error if length is greater than 0" do
    lambda { column = DBF::Column.new "ColumnName", "N", -1, 0 }.should raise_error(DBF::ColumnLengthError)
  end
  
  it "should strip null characters from the name" do
    column = DBF::Column.new "Column\0Name\0", "N", 1, 0
    column.name.should == "ColumnName"
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dbf-1.0.0 spec/unit/column_spec.rb
dbf-1.0.2 spec/unit/column_spec.rb
dbf-1.0.3 spec/unit/column_spec.rb
dbf-1.0.1 spec/unit/column_spec.rb