ioquatix-attachment_fu 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
+
3
+ class ValidationTest < Test::Unit::TestCase
4
+ def test_should_invalidate_big_files
5
+ @attachment = SmallAttachment.new
6
+ assert !@attachment.valid?
7
+ assert @attachment.errors.on(:size)
8
+
9
+ @attachment.size = 2000
10
+ assert !@attachment.valid?
11
+ assert @attachment.errors.on(:size), @attachment.errors.full_messages.to_sentence
12
+
13
+ @attachment.size = 1000
14
+ assert !@attachment.valid?
15
+ assert_nil @attachment.errors.on(:size)
16
+ end
17
+
18
+ def test_should_invalidate_small_files
19
+ @attachment = BigAttachment.new
20
+ assert !@attachment.valid?
21
+ assert @attachment.errors.on(:size)
22
+
23
+ @attachment.size = 2000
24
+ assert !@attachment.valid?
25
+ assert @attachment.errors.on(:size), @attachment.errors.full_messages.to_sentence
26
+
27
+ @attachment.size = 1.megabyte
28
+ assert !@attachment.valid?
29
+ assert_nil @attachment.errors.on(:size)
30
+ end
31
+
32
+ def test_should_validate_content_type
33
+ @attachment = PdfAttachment.new
34
+ assert !@attachment.valid?
35
+ assert @attachment.errors.on(:content_type)
36
+
37
+ @attachment.content_type = 'foo'
38
+ assert !@attachment.valid?
39
+ assert @attachment.errors.on(:content_type)
40
+
41
+ @attachment.content_type = 'pdf'
42
+ assert !@attachment.valid?
43
+ assert_nil @attachment.errors.on(:content_type)
44
+ end
45
+
46
+ def test_should_require_filename
47
+ @attachment = Attachment.new
48
+ assert !@attachment.valid?
49
+ assert @attachment.errors.on(:filename)
50
+
51
+ @attachment.filename = 'foo'
52
+ assert !@attachment.valid?
53
+ assert_nil @attachment.errors.on(:filename)
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ioquatix-attachment_fu
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lots of cool people
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-21 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email:
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - CHANGELOG
24
+ - README
25
+ files:
26
+ - test/backends
27
+ - test/backends/db_file_test.rb
28
+ - test/backends/file_system_test.rb
29
+ - test/backends/remote
30
+ - test/backends/remote/s3_test.rb
31
+ - test/base_attachment_tests.rb
32
+ - test/basic_test.rb
33
+ - test/database.yml
34
+ - test/extra_attachment_test.rb
35
+ - test/fixtures
36
+ - test/fixtures/attachment.rb
37
+ - test/fixtures/files
38
+ - test/fixtures/files/fake
39
+ - test/fixtures/files/fake/rails.png
40
+ - test/fixtures/files/foo.txt
41
+ - test/fixtures/files/rails.png
42
+ - test/geometry_test.rb
43
+ - test/processors
44
+ - test/processors/core_image_test.rb
45
+ - test/processors/gd2_test.rb
46
+ - test/processors/image_science_test.rb
47
+ - test/processors/mini_magick_test.rb
48
+ - test/processors/rmagick_test.rb
49
+ - test/schema.rb
50
+ - test/test_helper.rb
51
+ - test/validation_test.rb
52
+ - lib/attachment_fu
53
+ - lib/attachment_fu/backends
54
+ - lib/attachment_fu/backends/db_file_backend.rb
55
+ - lib/attachment_fu/backends/file_system_backend.rb
56
+ - lib/attachment_fu/backends/s3_backend.rb
57
+ - lib/attachment_fu/processors
58
+ - lib/attachment_fu/processors/core_image_processor.rb
59
+ - lib/attachment_fu/processors/gd2_processor.rb
60
+ - lib/attachment_fu/processors/image_science_processor.rb
61
+ - lib/attachment_fu/processors/mini_magick_processor.rb
62
+ - lib/attachment_fu/processors/rmagick_processor.rb
63
+ - lib/attachment_fu.rb
64
+ - lib/geometry.rb
65
+ - rails/init.rb
66
+ - CHANGELOG
67
+ - README
68
+ - Rakefile
69
+ has_rdoc: true
70
+ homepage: http://github.com/technoweenie/attachment_fu
71
+ post_install_message:
72
+ rdoc_options:
73
+ - --main
74
+ - README
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ version:
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.2.0
93
+ signing_key:
94
+ specification_version: 2
95
+ summary: Gemified rails attachment_fu plugin.
96
+ test_files:
97
+ - test/basic_test.rb
98
+ - test/extra_attachment_test.rb
99
+ - test/geometry_test.rb
100
+ - test/validation_test.rb