Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 15 lines (13 sloc) 0.557 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14
When /^I attach the file "([^"]*)" to "([^"]*)" on S3$/ do |file_path, field|
  definition = User.attachment_definitions[field.downcase.to_sym]
  path = "https://paperclip.s3.amazonaws.com#{definition[:path]}"
  path.gsub!(':filename', File.basename(file_path))
  path.gsub!(/:([^\/\.]+)/) do |match|
    "([^\/\.]+)"
  end
  FakeWeb.register_uri(:put, Regexp.new(path), :body => "OK")
  When "I attach the file \"#{file_path}\" to \"#{field}\""
end

Then /^the file at "([^"]*)" should be uploaded to S3$/ do |url|
  FakeWeb.registered_uri?(:put, url)
end
Something went wrong with that request. Please try again.