require 'spec_helper' describe DataTable do let(:collection) { [ {:name => 'Luke Skywalker', :class => 'Jedi Knight'}, {:name => 'Emporer Palpatine', :class => 'Sith Lord'}, {:name => 'Mithrander', :class => 'Wizard'}, {:name => 'Aragorn', :class => 'Ranger'} ] } it "should render the collection" do html = DataTable.render(collection) do |t| t.column :name, 'Name' t.column :class, 'Class' end expect(html).to eq(%{
Name | Class |
---|---|
Luke Skywalker | Jedi Knight |
Emporer Palpatine | Sith Lord |
Mithrander | Wizard |
Aragorn | Ranger |