<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>cucumber/paperclip_steps.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -60,9 +60,57 @@ module Paperclip
         assert_accepts(matcher, klass)
       end
     end
+
+    # Stubs the HTTP PUT for an attachment using S3 storage.
+    #
+    # @example
+    #   stub_paperclip_s3('user', 'avatar', 'png')
+    def stub_paperclip_s3(model, attachment, extension)
+      definition = model.gsub(&quot; &quot;, &quot;_&quot;).classify.constantize.
+                         attachment_definitions[attachment.to_sym]
+
+      path = &quot;http://s3.amazonaws.com/:id/#{definition[:path]}&quot;
+      path.gsub!(/:([^\/\.]+)/) do |match|
+        &quot;([^\/\.]+)&quot;
+      end
+
+      begin
+        FakeWeb.register_uri(:put, Regexp.new(path), :body =&gt; &quot;OK&quot;)
+      rescue NameError
+        raise NameError, &quot;the stub_paperclip_s3 shoulda macro requires the fakeweb gem.&quot;
+      end
+    end
+
+    # Stub S3 and return a file for attachment. Best with Factory Girl.
+    # Uses a strict directory convention:
+    #
+    #     features/support/paperclip
+    #
+    # This method is used by the Paperclip-provided Cucumber step:
+    #
+    #     When I attach a &quot;demo_tape&quot; &quot;mp3&quot; file to a &quot;band&quot; on S3
+    #
+    # @example
+    #   Factory.define :band_with_demo_tape, :parent =&gt; :band do |band|
+    #     band.demo_tape { band.paperclip_fixture(&quot;band&quot;, &quot;demo_tape&quot;, &quot;png&quot;) }
+    #   end
+    def paperclip_fixture(model, attachment, extension)
+      stub_paperclip_s3(model, attachment, extension)
+      base_path = File.join(File.dirname(__FILE__), &quot;..&quot;, &quot;..&quot;,
+                            &quot;features&quot;, &quot;support&quot;, &quot;paperclip&quot;)
+      File.new(File.join(base_path, model, &quot;#{attachment}.#{extension}&quot;))
+    end
   end
 end
 
+class ActionController::Integration::Session  #:nodoc:
+  include Paperclip::Shoulda
+end
+
+class Factory
+  include Paperclip::Shoulda  #:nodoc:
+end
+
 class Test::Unit::TestCase #:nodoc:
  extend  Paperclip::Shoulda
 end</diff>
      <filename>shoulda_macros/paperclip.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4beeb7a77834ef487f4976c892c29c45ddb55a9d</id>
    </parent>
  </parents>
  <author>
    <name>Daniel Croak</name>
    <email>dancroak@dan-lawlesss-macbook.local</email>
  </author>
  <url>http://github.com/thoughtbot/paperclip/commit/98b90bc47f012ab04aa9d0de9d475641cd5fbe83</url>
  <id>98b90bc47f012ab04aa9d0de9d475641cd5fbe83</id>
  <committed-date>2009-08-24T11:37:03-07:00</committed-date>
  <authored-date>2009-08-24T11:37:03-07:00</authored-date>
  <message>shoulda macro and webrat step for testing paperclip on s3</message>
  <tree>8ea0b661c108bffe4ca0a796e55109209b97c6a2</tree>
  <committer>
    <name>Daniel Croak</name>
    <email>dancroak@dan-lawlesss-macbook.local</email>
  </committer>
</commit>
