Sha256: 851e9baa99559f7c66ae924f8a5f336f48d98f7e5461821a17fb365787cea3dc
Contents?: true
Size: 1.76 KB
Versions: 3
Compression:
Stored size: 1.76 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: Database integration test Given I add this snippet to the User model: """ has_attached_file :attachment, :storage => :database, :database_table => :user_attachments, :url => '/user_attachment_views/:id?style=:style' """ And I run a rails generator to generate a "UserAttachmentView" scaffold with "" Given I add this snippet to the "user_attachment_views" controller: """ def show style = params[:style] ? params[:style] : 'original' record = User.find(params[:id]) send_data record.attachment.file_contents(style), :filename => record.attachment_file_name, :type => record.attachment_content_type end """ And I run a paperclip_database generator to create storage for paperclip "attachment" to the "User" model And I run a migration 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 "/user_attachment_views/1?style=original" And the file at "/user_attachment_views/1?style=original" should be the same as "test/fixtures/5k.png"
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
paperclip_database-0.3.0 | features/basic_integration.feature |
paperclip_database-0.2.0 | features/basic_integration.feature |
paperclip_database-0.1.0 | features/basic_integration.feature |