-
-
Save richhollis/9271220 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# an example, showing how to load for rspec and conditionally load for cucumber | |
# lives in whichever dir you set the other file to load | |
module ImageStepHelpers | |
def page_should_contain_image_link_for(image) | |
page.should have_xpath(%Q(//img[@src="#{image.url}"])) | |
end | |
def image_data_from_file(image) | |
image_file_path = Rails.root.join image.image.path | |
File.read(image_file_path) | |
end | |
def hash_image(image_data) | |
require 'md5' | |
MD5.digest(image_data) | |
end | |
end | |
RSpec.configure do |config| | |
config.include ImageStepHelpers, :type => :request | |
end | |
World(ImageStepHelpers) if respond_to?(:World) #cucumber |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment