Commit 9dae4a1750b7211069a2230969920da91594e964
1 parent
ee360790
Exists in
master
and in
1 other branch
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
@@ -0,0 +1,15 @@ | @@ -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 | + |