Sha256: c8c4f58c3f0662d65e06b5ce2e85dab701731f2b90ddba3559c8df63e65312ad

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

When /^I attach the file "([^"]*)" to "([^"]*)" on S3$/ do |file_path, field|
  definition = Paperclip::Tasks::Attachments.definitions_for(User)[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")
  step "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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperclip-3.5.0 features/step_definitions/s3_steps.rb