<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/core_helpers/sees.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -7,22 +7,28 @@ class ActiveRecord::Base
   # Unfortunately Selenium execution seems to be one step ahead of the actual
   # test server processing. This method should be used if you are looking for
   # a newly created record after a Selenium based form submission.
+  #
+  # This can be used with a block to provide an additional condition.
+  # For example, to find an Expense which was recently created with an amount of 1.99&quot;
+  #   Expense.find_newly_created { |expense| expense.amount == 1.99 }
+  #
   def self.find_newly_created
     now = Time.now
     record = self.last
     c = 0
     loop do
-      begin
-        if Spec::Matchers::BeClose.new(now.to_i, 5.seconds).matches?(record.created_at.to_i)
-          break
+      if Spec::Matchers::BeClose.new(now.to_i, 5.seconds).matches?(record.created_at.to_i)
+        if block_given?
+          break if yield(record)
         else
-          record = self.last
-          sleep 0.3
-          c+=1
+          break
         end
-     end
+      end
+      record = self.last
+      sleep 2
+      c+=1
+      raise &quot;the record was not created in a timely fashion&quot; if c == 10
     end
-    raise &quot;the record was not created in a timely fashion&quot; if c == 10
     record
   end
 
@@ -37,8 +43,13 @@ class ActiveRecord::Base
     updated_at = record.updated_at
     c = 0
     loop do
-      break if record.reload.updated_at != updated_at
-      sleep 0.3
+      record.reload
+      if block_given?
+        break if yield(record)
+      elsif record.updated_at != updated_at
+        break
+      end
+      sleep 2
       c+=1
       raise &quot;the expense was not updated in a timely fashion&quot; if c == 10
     end</diff>
      <filename>lib/selenium/helpers/active_record_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 module RailsSeleniumStory::Helpers::EscapeString
-  def escape_string string
-    string.gsub(/('|&quot;)/, '\\\\\1')
+  def escape_string string, num=1
+    slashes = '\\\\' * num
+    string.gsub(/('|&quot;)/, slashes + '\1')
   end
   
   def escape_regex string_or_regex</diff>
      <filename>lib/selenium/helpers/escape_string.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ module RailsSeleniumStory::Matchers
   
     def initialize(tag, content=nil, &amp;block)
       @@scopes ||= []
-      @tag = tag
+      @tag = escape_string(tag, 2)
       @content = content
       @block = block
       @@scopes &lt;&lt; self</diff>
      <filename>lib/selenium/helpers/matchers/have_tag_matcher.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>dbb7af6498425334b2af5ad21bcdd0c9e520129d</id>
    </parent>
  </parents>
  <author>
    <name>Zach Dennis</name>
    <email>zach.dennis@gmail.com</email>
  </author>
  <url>http://github.com/mvanholstyn/mhs_testing/commit/5bcff9140e9936c5c3f47398739ea6523960f3ac</url>
  <id>5bcff9140e9936c5c3f47398739ea6523960f3ac</id>
  <committed-date>2008-05-07T17:29:03-07:00</committed-date>
  <authored-date>2008-05-07T17:29:03-07:00</authored-date>
  <message>Minor misc. updates:
* Added see_an_error_explanation method in the scope of RailsStory
* Updated the find_newly_created and find_recently_updated ActiveRecord helpers to take blocks
* Updated escape_string to take how many times to escape the string (useful for escaping nested strings for javascript)* Updated the have_tag_matcher to utilize the new esca</message>
  <tree>251b01401bce39ac57b9262f7bcb2c5706502832</tree>
  <committer>
    <name>Zach Dennis</name>
    <email>zach.dennis@gmail.com</email>
  </committer>
</commit>
