Commit 43f5d4f8 by Mark Kremer Committed by Mike Burns

Added a basic cucumber feature that shows that the Railtie configuration works

parent efead1a1
......@@ -24,6 +24,25 @@ Feature: Rails integration
And I should see an image with a path of "/system/attachments/original/5k.png"
And the file at "/system/attachments/original/5k.png" should be the same as "test/fixtures/5k.png"
Scenario: Configure defaults for all attachments through Railtie
Given I add this snippet to config/application.rb:
"""
config.paperclip_defaults = {:url => "/paperclip/custom/:attachment/:style/:filename"}
"""
Given I add this snippet to the User model:
"""
attr_accessible :name, :attachment
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 "/paperclip/custom/attachments/original/5k.png"
And the file at "/paperclip/custom/attachments/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:
"""
......
......@@ -65,6 +65,14 @@ Given /^I add this snippet to the User model:$/ do |snippet|
end
end
Given /^I add this snippet to config\/application.rb:$/ do |snippet|
file_name = "config/application.rb"
in_current_dir do
content = File.read(file_name)
File.open(file_name, 'w') {|f| f << content.sub(/class Application < Rails::Application.*$/, "class Application < Rails::Application\n#{snippet}\n")}
end
end
Given /^I start the rails application$/ do
in_current_dir do
require "./config/environment"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment