Skip to content
Newer
Older
100644 64 lines (58 sloc) 3.04 KB
898baf2 @sikachu Add integration test in cucumber to test rake task
sikachu authored
1 Feature: Rake tasks
2
3 Background:
4 Given I generate a new rails application
5 And I run a rails generator to generate a "User" scaffold with "name:string"
6 And I run a paperclip generator to add a paperclip "attachment" to the "User" model
7 And I run a migration
8 And I add this snippet to the User model:
9 """
f187552 @sikachu Fix rake task failure on Rails 3.2.3
sikachu authored
10 attr_accessible :name, :attachment
898baf2 @sikachu Add integration test in cucumber to test rake task
sikachu authored
11 has_attached_file :attachment, :path => ":rails_root/public/system/:attachment/:style/:filename"
12 """
13
14 Scenario: Paperclip refresh thumbnails task
15 When I modify my attachment definition to:
16 """
17 has_attached_file :attachment, :path => ":rails_root/public/system/:attachment/:style/:filename",
18 :styles => { :medium => "200x200#" }
19 """
20 And I upload the fixture "5k.png"
21 Then the attachment "medium/5k.png" should have a dimension of 200x200
22 When I modify my attachment definition to:
23 """
24 has_attached_file :attachment, :path => ":rails_root/public/system/:attachment/:style/:filename",
25 :styles => { :medium => "100x100#" }
26 """
27 When I successfully run `bundle exec rake paperclip:refresh:thumbnails CLASS=User --trace`
28 Then the attachment "original/5k.png" should exist
29 And the attachment "medium/5k.png" should have a dimension of 100x100
30
31 Scenario: Paperclip refresh metadata task
32 When I upload the fixture "5k.png"
33 And I swap the attachment "original/5k.png" with the fixture "12k.png"
34 And I successfully run `bundle exec rake paperclip:refresh:metadata CLASS=User --trace`
35 Then the attachment should have the same content type as the fixture "12k.png"
36 And the attachment should have the same file size as the fixture "12k.png"
37
38 Scenario: Paperclip refresh missing styles task
39 When I upload the fixture "5k.png"
40 Then the attachment file "original/5k.png" should exist
41 And the attachment file "medium/5k.png" should not exist
42 When I modify my attachment definition to:
43 """
44 has_attached_file :attachment, :path => ":rails_root/public/system/:attachment/:style/:filename",
45 :styles => { :medium => "200x200#" }
46 """
47 When I successfully run `bundle exec rake paperclip:refresh:missing_styles --trace`
48 Then the attachment file "original/5k.png" should exist
49 And the attachment file "medium/5k.png" should exist
50
51 Scenario: Paperclip clean task
52 When I upload the fixture "5k.png"
53 And I upload the fixture "12k.png"
54 Then the attachment file "original/5k.png" should exist
55 And the attachment file "original/12k.png" should exist
56 When I modify my attachment definition to:
57 """
58 has_attached_file :attachment, :path => ":rails_root/public/system/:attachment/:style/:filename"
59 validates_attachment_size :attachment, :less_than => 10.kilobytes
60 """
61 And I successfully run `bundle exec rake paperclip:clean CLASS=User --trace`
62 Then the attachment file "original/5k.png" should exist
63 But the attachment file "original/12k.png" should not exist
Something went wrong with that request. Please try again.