citrusbyte-milton 0.3.4 → 0.3.5
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.
- data/lib/milton.rb +2 -1
- data/lib/milton/attachment.rb +1 -1
- data/test/milton/attachment_test.rb +30 -0
- metadata +4 -3
data/lib/milton.rb
CHANGED
@@ -101,7 +101,8 @@ module Milton
|
|
101
101
|
begin
|
102
102
|
require path
|
103
103
|
rescue LoadError => e
|
104
|
-
raise LoadError.new(message + " (failed to require #{path})")
|
104
|
+
raise LoadError.new(message + " (failed to require #{path})") if e.message =~ Regexp.new(path)
|
105
|
+
raise e
|
105
106
|
end
|
106
107
|
end
|
107
108
|
module_function :try_require
|
data/lib/milton/attachment.rb
CHANGED
@@ -32,9 +32,39 @@ class AttachmentTest < ActiveSupport::TestCase
|
|
32
32
|
|
33
33
|
context "setting options" do
|
34
34
|
context "defaults" do
|
35
|
+
class DefaultAttachment < ActiveRecord::Base
|
36
|
+
is_attachment
|
37
|
+
end
|
38
|
+
|
35
39
|
should "use :disk as default storage" do
|
36
40
|
assert_equal :disk, Attachment.milton_options[:storage]
|
37
41
|
end
|
42
|
+
|
43
|
+
should "use #{Rails.root}/public/default_attachments as default disk storage root" do
|
44
|
+
assert_equal File.join(Rails.root, 'public', 'default_attachments'), DefaultAttachment.milton_options[:storage_options][:root]
|
45
|
+
end
|
46
|
+
|
47
|
+
should "use 0755 as default mode for new disk files" do
|
48
|
+
assert_equal 0755, DefaultAttachment.milton_options[:storage_options][:chmod]
|
49
|
+
end
|
50
|
+
|
51
|
+
should "raise LoadError if storage engine could not be required" do
|
52
|
+
assert_raise LoadError do
|
53
|
+
class BadStorageAttachment < ActiveRecord::Base
|
54
|
+
is_attachment :storage => :foo
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
should "raise helpful LoadError if storage engine could not be required" do
|
60
|
+
begin
|
61
|
+
class BadStorageAttachment < ActiveRecord::Base
|
62
|
+
is_attachment :storage => :foo
|
63
|
+
end
|
64
|
+
rescue LoadError => e
|
65
|
+
assert_equal "No 'foo' storage found for Milton (failed to require milton/storage/foo_file)", e.message
|
66
|
+
end
|
67
|
+
end
|
38
68
|
end
|
39
69
|
|
40
70
|
context "inheritence" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citrusbyte-milton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Alavi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- test/test_helper.rb
|
51
51
|
has_rdoc: false
|
52
52
|
homepage: http://labs.citrusbyte.com/projects/milton
|
53
|
+
licenses:
|
53
54
|
post_install_message:
|
54
55
|
rdoc_options: []
|
55
56
|
|
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
requirements: []
|
71
72
|
|
72
73
|
rubyforge_project: milton
|
73
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.3.5
|
74
75
|
signing_key:
|
75
76
|
specification_version: 2
|
76
77
|
summary: Rails file and upload handling plugin built for extensibility. Supports Amazon S3 and resizes images.
|