Sha256: ccb2385758fd4218adcc136106c998c353efde1779b765e214317abcd46dc04d

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

# -*- coding: utf-8 -*-
require File.join(File.dirname(__FILE__), 'spec_helper')

class OrderFinderFormForTable
  include ArFinderForm

  with_model(Order) do
  end

end


describe ArFinderForm::Table do

  before do
    @table = OrderFinderFormForTable.builder
  end

  it "name" do
    @table.name.should == "orders"
  end

  it "root_table" do
    @table.root_table.should == @table
  end

  describe "model_column_for" do
    column_names = [:id, :user_id, :product_id, :amount, :price,
      :delivery_estimate, :delivered_at, :deleted_at]

    it "by Symbol" do
      column_names.each do |column_name|
        @table.model_column_for(column_name).should be_ar_column(column_name.to_s)
      end
      @table.model_column_for('unexist_column').should be_nil
    end

    it "by String" do
      column_names.each do |column_name|
        @table.model_column_for(column_name.to_s).should be_ar_column(column_name.to_s)
      end
      @table.model_column_for(:unexist_column).should be_nil
    end

  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ar_finder_form-0.1.0 spec/table_spec.rb