Sha256: a490435b7b426fc2737083aab81ab8d72421a85208c1985502fca05015abe60c

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

Feature: Rails integration

  Background:
    Given I generate a new rails application
    And I run a rails generator to generate a "User" scaffold with "name:string"
    And I run a paperclip generator to add a paperclip "attachment" to the "User" model
    And I run a migration
    And I update my new user view to include the file upload field
    And I update my user view to include the attachment

  Scenario: Filesystem integration test
    Given I add this snippet to the User model:
      """
      has_attached_file :attachment
      attr_protected
      """
    And I start the rails application
    When I go to the new user page
    And I fill in "Name" with "something"
    And I attach the file "test/fixtures/5k.png" to "Attachment"
    And I press "Submit"
    Then I should see "Name: something"
    And I should see an image with a path of "/system/attachments/1/original/5k.png"
    And the file at "/system/attachments/1/original/5k.png" should be the same as "test/fixtures/5k.png"

  Scenario: S3 Integration test
    Given I add this snippet to the User model:
      """
      has_attached_file :attachment,
                        :storage => :s3,
                        :path => "/:attachment/:id/:style/:filename",
                        :s3_credentials => Rails.root.join("config/s3.yml")
      attr_protected
      """
    And I write to "config/s3.yml" with:
      """
      bucket: paperclip
      access_key_id: access_key
      secret_access_key: secret_key
      """
    And I start the rails application
    When I go to the new user page
    And I fill in "Name" with "something"
    And I attach the file "test/fixtures/5k.png" to "Attachment" on S3
    And I press "Submit"
    Then I should see "Name: something"
    And I should see an image with a path of "http://s3.amazonaws.com/paperclip/attachments/1/original/5k.png"
    And the file at "http://s3.amazonaws.com/paperclip/attachments/1/original/5k.png" should be uploaded to S3

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperclip-2.8.0 features/basic_integration.feature