Sha256: d652859b49a3061c61174c0c86af56988981fe0f126e7fa64e7d52916a50bea1
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe_with_render "Index as CSV" do before :all do load_defaults! reload_routes! end before(:each) do Admin::PostsController.reset_index_config! end describe "get index with format csv" do before do Post.create :title => "Hello World" Post.create :title => "Goodbye World" end it "should return csv" do get :index, 'format' => 'csv' response.content_type.should == 'text/csv' end it "should return a header and a line for each item" do get :index, 'format' => 'csv' response.body.split("\n").size.should == 3 end Post.columns.each do |column| it "should include a header for #{column.name}" do get :index, 'format' => 'csv' response.body.split("\n").first.should include(column.name.titleize) end end it "should set a much higher per page pagination" do 100.times{ Post.create :title => "woot" } get :index, 'format' => 'csv' response.body.split("\n").size.should == 103 end end end
Version data entries
4 entries across 4 versions & 1 rubygems