forked from thoughtbot/paperclip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic integration test using Cucumber
This test will generate a basic Rails application, include Paperclip into Gemfile, and call basic `has_attached_file` in the model. This will make sure that we're not messing up any of the configuration and integration for our gem and the Rails framework.
- Loading branch information
Showing
26 changed files
with
425 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
appraise "rails2" do | ||
gem "rails", "~> 2.3.14" | ||
gem "paperclip", :path => "../" | ||
end | ||
|
||
appraise "rails3" do | ||
gem "rails", "~> 3.0.10" | ||
gem "paperclip", :path => "../" | ||
end | ||
|
||
appraise "rails3_1" do | ||
gem "rails", "~> 3.1.0" | ||
gem "paperclip", :path => "../" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 | ||
""" | ||
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") | ||
""" | ||
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.