Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Created March 22, 2011 00:20
Show Gist options
  • Save oliverbarnes/880522 to your computer and use it in GitHub Desktop.
Save oliverbarnes/880522 to your computer and use it in GitHub Desktop.
Finding dragonfly image with cucumber/capybara
#config
app.url_path_prefix = '/images'
#route
match '/images/:dragonfly/:file_name', :to => Dragonfly[:images]
#model
class Store
include MongoMapper::Document
key :photo_uid, String
key :photo_name, String
image_accessor :photo
def photo_url
self.photo.thumb('274x207#').url(:suffix => "/#{self.photo_name}") if self.photo
end
end
#cucumber
Then I should see the image "my_photo.png"
Then /^I should see the image "(.+)"$/ do |image|
page.should have_xpath("//img[contains(@src, \"#{image}\")]")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment