You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/active_storage_validations_test.rb
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
29
29
u.proc_image_regex.attach(image_150x150_file)
30
30
u.photos.attach(bad_dummy_file)
31
31
u.proc_photos.attach(bad_dummy_file)
32
+
u.video.attach(video_file)
32
33
assert !u.valid?
33
34
assert_equalu.errors.full_messages,['Photos has an invalid content type','Proc photos has an invalid content type']
34
35
@@ -39,6 +40,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
39
40
u.proc_image_regex.attach(image_150x150_file)
40
41
u.photos.attach(image_150x150_file)
41
42
u.proc_photos.attach(image_150x150_file)
43
+
u.video.attach(video_file)
42
44
assert !u.valid?
43
45
assert_equalu.errors.full_messages,['Avatar has an invalid content type','Proc avatar has an invalid content type']
44
46
assert_equalu.errors.details,avatar: [
@@ -68,6 +70,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
68
70
u.proc_image_regex.attach(image_150x150_file)
69
71
u.photos.attach(pdf_file)# Should be handled by regex match.
70
72
u.proc_photos.attach(pdf_file)# Should be handled by regex match.
73
+
u.video.attach(video_file)
71
74
assertu.valid?
72
75
73
76
u=User.new(name: 'John Smith')
@@ -77,6 +80,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
77
80
u.proc_image_regex.attach(bad_dummy_file)
78
81
u.photos.attach(image_150x150_file)
79
82
u.proc_photos.attach(image_150x150_file)
83
+
u.video.attach(video_file)
80
84
assert !u.valid?
81
85
assert_equalu.errors.full_messages,['Image regex has an invalid content type','Proc image regex has an invalid content type']
82
86
@@ -87,6 +91,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
87
91
u.proc_image_regex.attach(bad_dummy_file)
88
92
u.photos.attach(bad_dummy_file)
89
93
u.proc_photos.attach(bad_dummy_file)
94
+
u.video.attach(video_file)
90
95
assert !u.valid?
91
96
assert_equalu.errors.full_messages,['Avatar has an invalid content type','Photos has an invalid content type','Image regex has an invalid content type','Proc avatar has an invalid content type','Proc photos has an invalid content type','Proc image regex has an invalid content type']
92
97
@@ -96,6 +101,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
96
101
u.photos.attach(image_150x150_file)
97
102
u.proc_photos.attach(image_150x150_file)
98
103
u.conditional_image_2.attach(image_150x150_file)
104
+
u.video.attach(video_file)
99
105
assertu.valid?
100
106
assert_equalu.errors.full_messages,[]
101
107
@@ -105,6 +111,7 @@ class ActiveStorageValidations::Test < ActiveSupport::TestCase
105
111
u.photos.attach(bad_dummy_file)
106
112
u.proc_photos.attach(image_150x150_file)
107
113
u.conditional_image_2.attach(bad_dummy_file)
114
+
u.video.attach(video_file)
108
115
assert !u.valid?
109
116
assert_equalu.errors.full_messages,["Avatar has an invalid content type","Photos has an invalid content type","Conditional image 2 has an invalid content type","Proc avatar has an invalid content type"]
0 commit comments