Sha256: f894a934c392fded27325123a348218d8f112ab69e8232526cf6f5b6debec6cc

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Lolita::Configuration::Column do

  
  it "should create new column with Hash attributes" do
    column=Lolita::Configuration::Column.new(:name=>"col1",:title=>"Col1",:type=>String)
    column.name.should == "col1"
  end

  it "should create new column with Proc as block given" do
    p=Proc.new{
      name "col1"
      title "Col one"
      type String
    }
    column=Lolita::Configuration::Column.new &p
    column.type.should == String
  end

  it "should create new column with block given" do
    column=Lolita::Configuration::Column.new do
      name "col1"
      title "Col one"
      type String
    end
    column.title.size.should > 0
  end

  it "should create new column when String or Symbol is given" do
    column=Lolita::Configuration::Column.new(:col1)
    column.name.should == "col1"
    column=Lolita::Configuration::Column.new("col2")
    column.name.should == "col2"
  end
  
  it "should raise error when no name is provided for column" do
    lambda{
      Lolita::Configuration::Column.new do
        title "Col one"
      end
    }.should raise_error(ArgumentError, "Column must have name.")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lolita-3.1.3 spec/configuration/column_spec.rb
lolita-3.1.2 spec/configuration/column_spec.rb
lolita-3.1.1 spec/configuration/column_spec.rb
lolita-3.1.0 spec/configuration/column_spec.rb
lolita-3.0.7 spec/configuration/column_spec.rb
lolita-3.0.6 spec/configuration/column_spec.rb
lolita-3.0.5 spec/configuration/column_spec.rb
lolita-3.0.4 spec/configuration/column_spec.rb