Sha256: 6015c9fd14759c851ac18dd787c4bf26472a452d8628c8dc3a0b71e5e8192c3b

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Outpost::List::Column do
  let(:model) { Person }

  #----------------
  
  describe "initialization" do
    let(:list) { Outpost::List::Base.new(model) }
    
    before :each do
      list.column "name", {
        :quick_edit   => true,
        :display      => :display_full_name,
        :header       => "Full Name"
      }
    end

    it "sets position" do
      list.column "body"
      list.columns["name"].position.should eq 0
      list.columns["body"].position.should eq 1
    end

    it "figures out header if none specified" do
      published_column = list.column :published_at
      published_column.header.should eq :published_at.to_s.titleize
    end

    it "sets quick_edit" do
      col = list.columns["name"]
      col.quick_edit.should eq true
      col.quick_edit?.should eq true
    end

    it "sets sortable" do
      col = list.columns["name"]
      col.sortable.should eq false
      col.sortable?.should eq false
    end

    it "sets default_sort_mode to default if not specified" do
      list.columns["name"].default_sort_mode.should eq Outpost::List::DEFAULT_SORT_MODE
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outpost-cms-0.0.3 spec/lib/list/column_spec.rb