Permalink
Browse files

extract time formatter to constant

  • Loading branch information...
1 parent 31fef60 commit ed4a06ca71ea0081caf1552b4a53a121ff3338db @despo despo committed Feb 11, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/prickle/capybara.rb
View
@@ -8,7 +8,7 @@ class << self
end
- def capture_screen name=Time.now.strftime("%Y%m%d-%H.%M.%s")
+ def capture_screen name=screenshot_name
page.driver.browser.save_screenshot Capybara.image_dir + name + ".jpg"
end
@@ -42,6 +42,8 @@ def popup_message_contains? message
private
+ TIME_FORMATTER = "%Y%m%d-%H.%M.%s"
+
def method_missing method, *args
if method =~ /(^.*)_contains_text\?$/
element($1, :name => args.first).contains_text? args[1]
@@ -54,5 +56,9 @@ def method_missing method, *args
end
end
+ def screenshot_name
+ Time.now.strftime(TIME_FORMATTER)
+ end
+
end
end

0 comments on commit ed4a06c

Please sign in to comment.