Commit 9dae4a1750b7211069a2230969920da91594e964

Authored by Dan Croak
1 parent ee360790

added webrat steps for paperclip. 'When I attach a [filename] file to a [klass] on S3

Showing 1 changed file with 15 additions and 0 deletions   Show diff stats
features/step_definitions/paperclip_steps.rb 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +When /^I attach an? "([^\"]*)" file to an? "([^\"]*)" on S3$/ do |filename, klass|
  2 + filename = filename.to_sym
  3 + definition = klass.classify.constantize.attachment_definitions[filename]
  4 +
  5 + path = "http://s3.amazonaws.com/:id/#{definition[:path]}"
  6 + path.gsub!(/:([^\/\.]+)/) do |match|
  7 + "([^\/\.]+)"
  8 + end
  9 +
  10 + FakeWeb.register_uri(:put, Regexp.new(path), :body => "OK")
  11 +
  12 + attach_file filename,
  13 + "features/support/paperclip/#{klass.underscore}/#{filename}.png"
  14 +end
  15 +
... ...