summaryrefslogtreecommitdiff
path: root/vendor/plugins/paperclip/test/matchers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
commite0a7e0fec760ba12c8067a37e10c96f1f05876e2 (patch)
treed0cf745592a46aee4d4913911fd34c7c24515220 /vendor/plugins/paperclip/test/matchers
parent6424e10be5a89f175a74c71c55660412a169b8b8 (diff)
Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade
- Converted plugins to gems (Gemfile) - Updated config structure (application.rb, boot.rb, environment.rb) - Converted routes to Rails 3 DSL - Converted named_scope to scope throughout models - Converted find(:all, :conditions) to where() chains - Fixed has_many :order to use ordering scope - Updated session store and secret token configuration - Fixed exception_notification middleware configuration - Patched Ruby 2.4 / Rails 3.2 incompatibilities: - Integer/Float duration arithmetic (ActiveSupport) - Arel visit_Integer for PostgreSQL adapter - create_database String/Integer coercion - ActionController consider_all_requests_local - Migrated taggings schema for acts-as-taggable-on - Replaced dynamic_form gem with custom form_error_messages helper - Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for) - Fixed admin layout yield - Updated test suite for Rails 3 APIs
Diffstat (limited to 'vendor/plugins/paperclip/test/matchers')
-rw-r--r--vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb21
-rw-r--r--vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb30
-rw-r--r--vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb21
-rw-r--r--vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb50
4 files changed, 0 insertions, 122 deletions
diff --git a/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb
deleted file mode 100644
index b29ec372..00000000
--- a/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb
+++ /dev/null
@@ -1,21 +0,0 @@
1require 'test/helper'
2
3class HaveAttachedFileMatcherTest < Test::Unit::TestCase
4 context "have_attached_file" do
5 setup do
6 @dummy_class = reset_class "Dummy"
7 reset_table "dummies"
8 @matcher = self.class.have_attached_file(:avatar)
9 end
10
11 should "reject a class with no attachment" do
12 assert_rejects @matcher, @dummy_class
13 end
14
15 should "accept a class with an attachment" do
16 modify_table("dummies"){|d| d.string :avatar_file_name }
17 @dummy_class.has_attached_file :avatar
18 assert_accepts @matcher, @dummy_class
19 end
20 end
21end
diff --git a/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb
deleted file mode 100644
index 241eb5f1..00000000
--- a/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb
+++ /dev/null
@@ -1,30 +0,0 @@
1require 'test/helper'
2
3class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
4 context "validate_attachment_content_type" do
5 setup do
6 reset_table("dummies") do |d|
7 d.string :avatar_file_name
8 end
9 @dummy_class = reset_class "Dummy"
10 @dummy_class.has_attached_file :avatar
11 @matcher = self.class.validate_attachment_content_type(:avatar).
12 allowing(%w(image/png image/jpeg)).
13 rejecting(%w(audio/mp3 application/octet-stream))
14 end
15
16 should "reject a class with no validation" do
17 assert_rejects @matcher, @dummy_class
18 end
19
20 should "reject a class with a validation that doesn't match" do
21 @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{audio/.*}
22 assert_rejects @matcher, @dummy_class
23 end
24
25 should "accept a class with a validation" do
26 @dummy_class.validates_attachment_content_type :avatar, :content_type => %r{image/.*}
27 assert_accepts @matcher, @dummy_class
28 end
29 end
30end
diff --git a/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb
deleted file mode 100644
index 860a7604..00000000
--- a/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb
+++ /dev/null
@@ -1,21 +0,0 @@
1require 'test/helper'
2
3class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase
4 context "validate_attachment_presence" do
5 setup do
6 reset_table("dummies"){|d| d.string :avatar_file_name }
7 @dummy_class = reset_class "Dummy"
8 @dummy_class.has_attached_file :avatar
9 @matcher = self.class.validate_attachment_presence(:avatar)
10 end
11
12 should "reject a class with no validation" do
13 assert_rejects @matcher, @dummy_class
14 end
15
16 should "accept a class with a validation" do
17 @dummy_class.validates_attachment_presence :avatar
18 assert_accepts @matcher, @dummy_class
19 end
20 end
21end
diff --git a/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb b/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb
deleted file mode 100644
index 7e4c9b40..00000000
--- a/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb
+++ /dev/null
@@ -1,50 +0,0 @@
1require 'test/helper'
2
3class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
4 context "validate_attachment_size" do
5 setup do
6 reset_table("dummies") do |d|
7 d.string :avatar_file_name
8 end
9 @dummy_class = reset_class "Dummy"
10 @dummy_class.has_attached_file :avatar
11 end
12
13 context "of limited size" do
14 setup{ @matcher = self.class.validate_attachment_size(:avatar).in(256..1024) }
15
16 should "reject a class with no validation" do
17 assert_rejects @matcher, @dummy_class
18 end
19
20 should "reject a class with a validation that's too high" do
21 @dummy_class.validates_attachment_size :avatar, :in => 256..2048
22 assert_rejects @matcher, @dummy_class
23 end
24
25 should "reject a class with a validation that's too low" do
26 @dummy_class.validates_attachment_size :avatar, :in => 0..1024
27 assert_rejects @matcher, @dummy_class
28 end
29
30 should "accept a class with a validation that matches" do
31 @dummy_class.validates_attachment_size :avatar, :in => 256..1024
32 assert_accepts @matcher, @dummy_class
33 end
34 end
35
36 context "validates_attachment_size with infinite range" do
37 setup{ @matcher = self.class.validate_attachment_size(:avatar) }
38
39 should "accept a class with an upper limit" do
40 @dummy_class.validates_attachment_size :avatar, :less_than => 1
41 assert_accepts @matcher, @dummy_class
42 end
43
44 should "accept a class with no upper limit" do
45 @dummy_class.validates_attachment_size :avatar, :greater_than => 1
46 assert_accepts @matcher, @dummy_class
47 end
48 end
49 end
50end