Sha256: 161c86f8b407a14e2251c11364ccba47ab9ace504ad687853747387cb663ac3a

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

require 'spec_helper'

describe Datagrid::Columns do
  
  let(:group) { Group.create!(:name => "Pop") }
  let!(:entry) {  Entry.create!(
    :group => group, :name => "Star", :disabled => false, :confirmed => false, :category => "first"
  ) }
  
  subject do
    SimpleReport.new
  end
  it "should build rows of data" do
    subject.rows.should == [["Pop", "Star"]]
  end
  it  "should generate header" do
    subject.header.should == ["Group", "Name"]
  end

  it "should generate data" do
    subject.data.should == [
      subject.header,
      subject.row_for(entry)
    ]
  end

  it "should support csv export" do
    subject.to_csv.should == "Group,Name\nPop,Star\n"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datagrid-0.2.0 spec/datagrid/columns_spec.rb
datagrid-0.1.2 spec/datagrid/columns_spec.rb
datagrid-0.1.1 spec/datagrid/columns_spec.rb
datagrid-0.1.0 spec/datagrid/columns_spec.rb