Commit ec51e940b460618b6c0eebec443292712eda07db
1 parent
55f2636e
Exists in
master
and in
1 other branch
Index on Errs#last_notice_at should allow listing pile of errors.
Showing
5 changed files
with
29 additions
and
3 deletions
Show diff stats
Rakefile
| ... | ... | @@ -8,4 +8,18 @@ require 'bundler' |
| 8 | 8 | Errbit::Application.load_tasks |
| 9 | 9 | |
| 10 | 10 | Rake::Task[:default].clear |
| 11 | + | |
| 12 | +namespace :spec do | |
| 13 | + desc "Preparing test env" | |
| 14 | + task :prepare do | |
| 15 | + tmp_env = Rails.env | |
| 16 | + Rails.env = "test" | |
| 17 | + %w( errbit:bootstrap ).each do |task| | |
| 18 | + Rake::Task[task].invoke | |
| 19 | + end | |
| 20 | + Rails.env = tmp_env | |
| 21 | + end | |
| 22 | +end | |
| 23 | + | |
| 24 | +Rake::Task["spec"].prerequisites.push("spec:prepare") | |
| 11 | 25 | task :default => ['spec'] |
| 12 | 26 | \ No newline at end of file | ... | ... |
app/models/err.rb
db/seeds.rb
| ... | ... | @@ -10,7 +10,7 @@ puts "-- email: #{admin_email}" |
| 10 | 10 | puts "-- password: #{admin_pass}" |
| 11 | 11 | puts "" |
| 12 | 12 | puts "Be sure to change these credentials ASAP!" |
| 13 | -user = User.new({ | |
| 13 | +user = User.where(:email => admin_email).first || User.new({ | |
| 14 | 14 | :name => 'Errbit Admin', |
| 15 | 15 | :email => admin_email, |
| 16 | 16 | :password => admin_pass, | ... | ... |
lib/tasks/errbit/bootstrap.rake
spec/controllers/errs_controller_spec.rb
| ... | ... | @@ -12,8 +12,11 @@ describe ErrsController do |
| 12 | 12 | |
| 13 | 13 | describe "GET /errs" do |
| 14 | 14 | context 'when logged in as an admin' do |
| 15 | - it "gets a paginated list of unresolved errs" do | |
| 15 | + before(:each) do | |
| 16 | 16 | sign_in Factory(:admin) |
| 17 | + end | |
| 18 | + | |
| 19 | + it "gets a paginated list of unresolved errs" do | |
| 17 | 20 | errs = WillPaginate::Collection.new(1,30) |
| 18 | 21 | 3.times { errs << Factory(:err) } |
| 19 | 22 | Err.should_receive(:unresolved).and_return( |
| ... | ... | @@ -22,6 +25,11 @@ describe ErrsController do |
| 22 | 25 | get :index |
| 23 | 26 | assigns(:errs).should == errs |
| 24 | 27 | end |
| 28 | + | |
| 29 | + it "should handle lots of errors" do | |
| 30 | + 1000.times { Factory :notice } | |
| 31 | + lambda { get :index }.should_not raise_error | |
| 32 | + end | |
| 25 | 33 | end |
| 26 | 34 | |
| 27 | 35 | context 'when logged in as a user' do | ... | ... |