Permalink
Browse files

Get specs passing

  • Loading branch information...
1 parent 2cb00c3 commit 36f0b27603fa4c9010885f3cd8bbdfeb14018587 Ben Marini committed May 25, 2011
Showing with 6 additions and 11 deletions.
  1. +6 −11 spec/controllers/index_as_csv_spec.rb
@@ -1,40 +1,35 @@
require 'spec_helper'
describe_with_render Admin::PostsController 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
end

0 comments on commit 36f0b27

Please sign in to comment.