Sha256: 3b994770ca81ffa4ab80fe922360aad40f4d93e1c88533584117a77b629e3a49

Contents?: true

Size: 1.09 KB

Versions: 14

Compression:

Stored size: 1.09 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class Hirb::Helpers::ActiveRecordTableTest < Test::Unit::TestCase
  context "activerecord table" do
    test "with no select renders" do
      expected_table = <<-TABLE.unindent
      +-----+-------+
      | age | name  |
      +-----+-------+
      | 7   | rufus |
      | 101 | alf   |
      +-----+-------+
      2 rows in set
      TABLE
      @pets = [stub(:name=>'rufus', :age=>7, :attributes=>{"name"=>'rufus', 'age'=>7}, :class=>stub(:column_names=>%w{age name})),
        stub(:name=>'alf', :age=>101)]
      Hirb::Helpers::ActiveRecordTable.render(@pets).should == expected_table
    end

    test "with select renders" do
      expected_table = <<-TABLE.unindent
      +-------+
      | name  |
      +-------+
      | rufus |
      | alf   |
      +-------+
      2 rows in set
      TABLE
      @pets = [stub(:name=>'rufus', :age=>7, :attributes=>{'name'=>'rufus'}, :class=>stub(:column_names=>%w{age name})),
        stub(:name=>'alf', :age=>101)]
      Hirb::Helpers::ActiveRecordTable.render(@pets).should == expected_table
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
cldwalker-hirb-0.2.2 test/active_record_table_test.rb
cldwalker-hirb-0.2.3 test/active_record_table_test.rb
cldwalker-hirb-0.2.4 test/active_record_table_test.rb
cldwalker-hirb-0.2.5 test/active_record_table_test.rb
cldwalker-hirb-0.2.6 test/active_record_table_test.rb
hirb-0.2.10 test/active_record_table_test.rb
hirb-0.2.9 test/active_record_table_test.rb
hirb-0.2.8 test/active_record_table_test.rb
hirb-0.2.7 test/active_record_table_test.rb
hirb-0.2.6 test/active_record_table_test.rb
hirb-0.2.2 test/active_record_table_test.rb
hirb-0.2.3 test/active_record_table_test.rb
hirb-0.2.4 test/active_record_table_test.rb
hirb-0.2.5 test/active_record_table_test.rb