Sha256: 3e4d213c4f1a36a71805dbe3b6bf60abc655306f6f5ad0908c78ddd9aa81458e

Contents?: true

Size: 747 Bytes

Versions: 4

Compression:

Stored size: 747 Bytes

Contents

require 'spec_helper'

describe Datagrid::Filters do

  it "should support default option as proc" do
    test_report do
      scope {Entry}
      filter(:created_at, :date, :default => proc { Date.today } )
    end.created_at.should == Date.today
  end

  it "should not support array argument for not multiple filter" do
    report = test_report do
      scope {Entry}
      filter(:group_id, :integer)
    end
    lambda {
      report.group_id = [1,2]
    }.should raise_error(Datagrid::ArgumentError)
  end
  

  it "should initialize report Scope table not exists" do
    class ModelWithoutTable < ActiveRecord::Base; end
    class TheReport
      include Datagrid

      scope {ModelWithoutTable}

      filter(:name)
    end

  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datagrid-0.3.3 spec/datagrid/filters_spec.rb
datagrid-0.3.2 spec/datagrid/filters_spec.rb
datagrid-0.3.1 spec/datagrid/filters_spec.rb
datagrid-0.3.0 spec/datagrid/filters_spec.rb