Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # an example, showing how to load for rspec and conditionally load for cucumber
  2. # lives in whichever dir you set the other file to load
  3.  
  4. module ImageStepHelpers
  5.   def page_should_contain_image_link_for(image)
  6.     page.should have_xpath(%Q(//img[@src="#{image.url}"]))
  7.   end
  8.  
  9.   def image_data_from_file(image)
  10.     image_file_path = Rails.root.join image.image.path
  11.     File.read(image_file_path)
  12.   end
  13.  
  14.   def hash_image(image_data)
  15.     require 'md5'
  16.     MD5.digest(image_data)
  17.   end
  18. end
  19.  
  20. RSpec.configure do |config|
  21.   config.include ImageStepHelpers, :type => :request
  22. end
  23.  
  24. World(ImageStepHelpers) if respond_to?(:World) #cucumber