<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,21 +6,11 @@ Monarch.constructor(&quot;Screw.Interface.Runner&quot;, Monarch.View.Template, {
       var self = this;
       jQuery(function() {
         var root_description = Screw.root_description();
-        var completed_example_count = 0;
-        var total_example_count = root_description.total_examples();
-        root_description.on_example_completed(function() {
-          completed_example_count++;
-          if (completed_example_count == total_example_count) {
-            var outcome = (root_description.failed_examples().length == 0) ? &quot;success&quot; : root_description.failure_messages().join(&quot;\n&quot;);
-            Screw.jQuery.ajax({ type: 'POST', url: '/complete', data: outcome });
-          }
-        });
-
         var queue = new Monarch.Queue();
         var runner;
         queue.add(function() {
           var show = jQuery.cookie(&quot;__screw_unit__show&quot;) || &quot;all&quot;;
-          runner = Screw.Interface.Runner.to_view({root: Screw.root_description(), show: show});
+          runner = Screw.Interface.Runner.to_view({root: Screw.root_description(), show: show, post_on_completion: true});
         });
         queue.add(function() {
           Screw.$('body').html(runner);
@@ -96,8 +86,6 @@ Monarch.constructor(&quot;Screw.Interface.Runner&quot;, Monarch.View.Template, {
 
     rerun_failed: function() {
       var failing_paths = Monarch.Util.map(this.root.failed_examples(), function(example) { return example.path() });
-
-      
       Screw.Interface.set_location(Screw.Interface.base_location() + '?' + JSON.stringify(failing_paths));
     },
 
@@ -107,26 +95,12 @@ Monarch.constructor(&quot;Screw.Interface.Runner&quot;, Monarch.View.Template, {
 
     run: function(run_paths) {
       var self = this;
-      var objects_to_run = [];
-      if (run_paths) {
-        Monarch.Util.each(run_paths, function(path) {
-          var runnable = self.root.runnable_at_path(path);
-          if (runnable) {
-            objects_to_run.push(runnable);
-          } else {
-            throw new Error(&quot;No runnable at path &quot; + path);
-          }
-        });
-      } else {
-        objects_to_run.push(self.root);
-      }
-
+      var objects_to_run = this.determine_runnables_to_run(run_paths);
       this.completed_example_count = 0;
       this.total_examples = Screw.root_description().total_examples();
 
       var queue = new Monarch.Queue();
-      this.root.on_example_completed(function() { self.update() } );
-
+      this.root.on_example_completed(function() { self.example_completed() } );
 
       Monarch.Util.each(objects_to_run, function(runnable) {
         queue.add(function() {
@@ -137,12 +111,33 @@ Monarch.constructor(&quot;Screw.Interface.Runner&quot;, Monarch.View.Template, {
       queue.start();
     },
 
-    update: function() {
+    determine_runnables_to_run: function(run_paths) {
+      if (!run_paths) return [this.root];
+
+      var self = this;
+      var runnables_to_run = [];
+      Monarch.Util.each(run_paths, function(path) {
+        var runnable = self.root.runnable_at_path(path);
+        if (runnable) {
+          runnables_to_run.push(runnable);
+        } else {
+          throw new Error(&quot;No runnable at path &quot; + path);
+        }
+      });
+      return runnables_to_run;
+    },
+
+    example_completed: function() {
       this.completed_example_count++;
-          
-      if (this.completed_example_count == this.total_examples) {
-        var is_success = (Screw.root_description().failed_examples().length == 0);
-        this.find(&quot;ul.descriptions&quot;).addClass(is_success ? &quot;passed&quot; : &quot;failed&quot;);
+      if (this.completed_example_count == this.total_examples) this.all_examples_completed();
+    },
+
+    all_examples_completed: function() {
+      var is_success = (Screw.root_description().failed_examples().length == 0);
+      this.find(&quot;ul.descriptions&quot;).addClass(is_success ? &quot;passed&quot; : &quot;failed&quot;);
+      if (this.post_on_completion) {
+        var outcome = (is_success) ? &quot;success&quot; : this.root.failure_messages().join(&quot;\n&quot;);
+        Screw.jQuery.ajax({ type: 'POST', url: '/complete', data: outcome });
       }
     }
   }</diff>
      <filename>client/lib/screw/interface/runner.js</filename>
    </modified>
    <modified>
      <diff>@@ -181,24 +181,20 @@ Screw.Unit(function(c) { with(c) {
       });
     });
 
-    describe(&quot;#update&quot;, function() {
+    describe(&quot;#example_completed&quot;, function() {
       describe(&quot;when the examples are completed&quot;, function() {
         before(function() {
           view.completed_example_count = 0;
           view.total_examples = 1;
         });
 
-        after(function() {
-          expect(view.completed_example_count).to(equal, view.total_examples);
-        });
-
         describe(&quot;when there were failures&quot;, function() {
           before(function() {
             mock(Screw.root_description(), &quot;failed_examples&quot;, function() { return [1]; });
           });
 
           it(&quot;adds the .failed class to the root description&quot;, function() {
-            view.update();
+            view.example_completed();
 
             expect(Screw.root_description().failed_examples).to(have_been_called, once);
             expect(view.find(&quot;ul.descriptions&quot;).hasClass(&quot;failed&quot;)).to(be_true);
@@ -211,7 +207,7 @@ Screw.Unit(function(c) { with(c) {
           });
 
           it(&quot;adds the .passed class to the root description&quot;, function() {
-            view.update();
+            view.example_completed();
             expect(Screw.root_description().failed_examples).to(have_been_called, once);
             expect(view.find(&quot;ul.descriptions&quot;).hasClass(&quot;passed&quot;)).to(be_true);
           });</diff>
      <filename>client/spec/interface/runner_spec.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a3e5530a276282eda8469fd58398fd5c6c0eea3c</id>
    </parent>
  </parents>
  <author>
    <name>Grockit</name>
    <email>grockit@grok-a.local</email>
  </author>
  <url>http://github.com/grockit/screw-unit/commit/1f89466be5c5def273110d0f6be51b842e4314b5</url>
  <id>1f89466be5c5def273110d0f6be51b842e4314b5</id>
  <committed-date>2009-10-13T16:36:06-07:00</committed-date>
  <authored-date>2009-10-13T16:36:06-07:00</authored-date>
  <message>Refactored posting to server on completion of all examples</message>
  <tree>c1af79709a426343c4d08d379456968977198ccf</tree>
  <committer>
    <name>Grockit</name>
    <email>grockit@grok-a.local</email>
  </committer>
</commit>
