Browse files

build_reaper plugin always installed and only deletes builds if confi…

…gured

Build reaper plugin is being loaded before site_config.rb so it was
never being loaded. Now it is always loaded.
  • Loading branch information...
1 parent 6817c41 commit b875e88f1b8bcdf18e26086b8d4339647263a0c5 Jose Capo & Pantera Arzhintar committed Jan 19, 2012
Showing with 8 additions and 2 deletions.
  1. +2 −2 lib/builder_plugins/build_reaper.rb
  2. +6 −0 test/unit/plugins/build_reaper_test.rb
View
4 lib/builder_plugins/build_reaper.rb
@@ -7,7 +7,7 @@ class BuildReaper < BuilderPlugin
cattr_accessor :number_of_builds_to_keep
def build_finished(build)
- delete_all_builds_but BuildReaper.number_of_builds_to_keep
+ delete_all_builds_but BuildReaper.number_of_builds_to_keep unless BuildReaper.number_of_builds_to_keep.nil?
end
def delete_all_builds_but(number)
@@ -17,4 +17,4 @@ def delete_all_builds_but(number)
end
end
-Project.plugin :build_reaper unless BuildReaper.number_of_builds_to_keep.nil?
+Project.plugin :build_reaper
View
6 test/unit/plugins/build_reaper_test.rb
@@ -36,4 +36,10 @@ def test_should_delete_no_builds
assert_equal %w(build-1-success), Dir["*"]
end
+
+ def test_should_only_delete_builds_if_configured
+ @reaper.expects(:delete_all_builds_but).never
+
+ @reaper.build_finished(nil)
+ end
end

0 comments on commit b875e88

Please sign in to comment.