Permalink
Browse files

caching the test results in memcache also - making for a more real-ti…

…me interactive web app
  • Loading branch information...
1 parent 4f76306 commit 684c82f045b11b221d470118df44d27a1567c2f5 John Goodsen committed Nov 27, 2008
Showing with 12 additions and 3 deletions.
  1. +10 −1 lib/rcumber.rb
  2. +1 −1 ui/views/rcumbers/_stylesheet.html.erb
  3. +1 −1 ui/views/rcumbers/index.html.erb
View
@@ -26,6 +26,14 @@ def state=(x)
Rails.cache.write("rcumber/#{uid}/state", x.to_s)
end
+ def last_results=(results)
+ @results = results
+ Rails.cache.write("RcumberResults_#{path}", results)
+ end
+
+ def last_results
+ @results ||= Rails.cache.read("RcumberResults_#{path}")
+ end
# For now, the UID is the basename w/o extension of the file: e.g. "../foo.feature" has uid =>"foo"
# TODO: FIXME: This has the limitation that you need unique cucumber filenames down the entire directory tree...
@@ -55,8 +63,9 @@ def run
end
def parse_test_results
- return :failing if self.last_results.to_s =~/(\d+) steps failed/
+ return :failing if self.last_results.to_s =~/(\d+) (steps|scenarios) failed/
return :pending if self.last_results.to_s =~/(\d) (steps|scenarios) pending/
+ return :passing
end
def save
@@ -45,7 +45,7 @@ span#state {
background: lightgreen;
}
.pending {
- background: lightyellow;
+ background: orange;
}
.failing {
background: red;
@@ -20,7 +20,7 @@
<td class="<%= rcumber.state.to_s %>"><%= rcumber.state.to_s %></td>
<td>
<%= link_to 'Run', rcumber_run_path(rcumber.uid) + demo_parameters %>
- <%= link_to 'View', rcumber_path(rcumber.uid) + demo_parameters %>
+ | <%= link_to 'View', rcumber_path(rcumber.uid) + demo_parameters %>
</td>
</tr>
<% end %>

0 comments on commit 684c82f

Please sign in to comment.