fog-dragonfly 0.8.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.
Files changed (155) hide show
  1. data/.specopts +2 -0
  2. data/.yardopts +23 -0
  3. data/Gemfile +23 -0
  4. data/Gemfile.rails.2.3.5 +14 -0
  5. data/History.md +266 -0
  6. data/LICENSE +20 -0
  7. data/README.md +88 -0
  8. data/Rakefile +92 -0
  9. data/VERSION +1 -0
  10. data/config.ru +13 -0
  11. data/docs.watchr +1 -0
  12. data/dragonfly.gemspec +293 -0
  13. data/extra_docs/Analysers.md +108 -0
  14. data/extra_docs/Caching.md +23 -0
  15. data/extra_docs/Configuration.md +138 -0
  16. data/extra_docs/DataStorage.md +136 -0
  17. data/extra_docs/Encoding.md +96 -0
  18. data/extra_docs/GeneralUsage.md +121 -0
  19. data/extra_docs/Generators.md +102 -0
  20. data/extra_docs/Heroku.md +50 -0
  21. data/extra_docs/Index.md +36 -0
  22. data/extra_docs/MimeTypes.md +40 -0
  23. data/extra_docs/Models.md +266 -0
  24. data/extra_docs/Mongo.md +45 -0
  25. data/extra_docs/Processing.md +130 -0
  26. data/extra_docs/Rack.md +52 -0
  27. data/extra_docs/Rails2.md +55 -0
  28. data/extra_docs/Rails3.md +62 -0
  29. data/extra_docs/Sinatra.md +25 -0
  30. data/extra_docs/URLs.md +169 -0
  31. data/features/3.0.3.feature +8 -0
  32. data/features/images.feature +47 -0
  33. data/features/no_processing.feature +14 -0
  34. data/features/rails_2.3.5.feature +7 -0
  35. data/features/steps/common_steps.rb +8 -0
  36. data/features/steps/dragonfly_steps.rb +66 -0
  37. data/features/steps/rails_steps.rb +39 -0
  38. data/features/support/env.rb +40 -0
  39. data/fixtures/files/app/models/album.rb +3 -0
  40. data/fixtures/files/app/views/albums/new.html.erb +4 -0
  41. data/fixtures/files/app/views/albums/show.html.erb +4 -0
  42. data/fixtures/files/config/initializers/dragonfly.rb +4 -0
  43. data/fixtures/files/features/manage_album_images.feature +12 -0
  44. data/fixtures/files/features/step_definitions/image_steps.rb +15 -0
  45. data/fixtures/files/features/support/paths.rb +15 -0
  46. data/fixtures/files/features/text_images.feature +7 -0
  47. data/fixtures/rails_2.3.5/template.rb +10 -0
  48. data/fixtures/rails_3.0.3/template.rb +20 -0
  49. data/irbrc.rb +17 -0
  50. data/lib/dragonfly.rb +45 -0
  51. data/lib/dragonfly/active_model_extensions.rb +13 -0
  52. data/lib/dragonfly/active_model_extensions/attachment.rb +169 -0
  53. data/lib/dragonfly/active_model_extensions/class_methods.rb +45 -0
  54. data/lib/dragonfly/active_model_extensions/instance_methods.rb +28 -0
  55. data/lib/dragonfly/active_model_extensions/validations.rb +37 -0
  56. data/lib/dragonfly/analyser.rb +59 -0
  57. data/lib/dragonfly/analysis/file_command_analyser.rb +32 -0
  58. data/lib/dragonfly/analysis/image_magick_analyser.rb +47 -0
  59. data/lib/dragonfly/analysis/r_magick_analyser.rb +63 -0
  60. data/lib/dragonfly/app.rb +182 -0
  61. data/lib/dragonfly/config/heroku.rb +19 -0
  62. data/lib/dragonfly/config/image_magick.rb +41 -0
  63. data/lib/dragonfly/config/r_magick.rb +46 -0
  64. data/lib/dragonfly/config/rails.rb +17 -0
  65. data/lib/dragonfly/configurable.rb +119 -0
  66. data/lib/dragonfly/core_ext/object.rb +8 -0
  67. data/lib/dragonfly/core_ext/string.rb +9 -0
  68. data/lib/dragonfly/core_ext/symbol.rb +9 -0
  69. data/lib/dragonfly/data_storage.rb +9 -0
  70. data/lib/dragonfly/data_storage/file_data_store.rb +114 -0
  71. data/lib/dragonfly/data_storage/mongo_data_store.rb +82 -0
  72. data/lib/dragonfly/data_storage/s3data_store.rb +115 -0
  73. data/lib/dragonfly/encoder.rb +13 -0
  74. data/lib/dragonfly/encoding/image_magick_encoder.rb +57 -0
  75. data/lib/dragonfly/encoding/r_magick_encoder.rb +61 -0
  76. data/lib/dragonfly/function_manager.rb +69 -0
  77. data/lib/dragonfly/generation/hash_with_css_style_keys.rb +23 -0
  78. data/lib/dragonfly/generation/image_magick_generator.rb +140 -0
  79. data/lib/dragonfly/generation/r_magick_generator.rb +155 -0
  80. data/lib/dragonfly/generator.rb +9 -0
  81. data/lib/dragonfly/image_magick_utils.rb +81 -0
  82. data/lib/dragonfly/job.rb +371 -0
  83. data/lib/dragonfly/job_builder.rb +39 -0
  84. data/lib/dragonfly/job_definitions.rb +26 -0
  85. data/lib/dragonfly/job_endpoint.rb +15 -0
  86. data/lib/dragonfly/loggable.rb +28 -0
  87. data/lib/dragonfly/middleware.rb +34 -0
  88. data/lib/dragonfly/processing/image_magick_processor.rb +99 -0
  89. data/lib/dragonfly/processing/r_magick_processor.rb +126 -0
  90. data/lib/dragonfly/processor.rb +9 -0
  91. data/lib/dragonfly/r_magick_utils.rb +48 -0
  92. data/lib/dragonfly/rails/images.rb +22 -0
  93. data/lib/dragonfly/response.rb +82 -0
  94. data/lib/dragonfly/routed_endpoint.rb +40 -0
  95. data/lib/dragonfly/serializer.rb +32 -0
  96. data/lib/dragonfly/simple_cache.rb +23 -0
  97. data/lib/dragonfly/simple_endpoint.rb +63 -0
  98. data/lib/dragonfly/temp_object.rb +220 -0
  99. data/samples/beach.png +0 -0
  100. data/samples/egg.png +0 -0
  101. data/samples/round.gif +0 -0
  102. data/samples/sample.docx +0 -0
  103. data/samples/taj.jpg +0 -0
  104. data/spec/argument_matchers.rb +19 -0
  105. data/spec/dragonfly/active_model_extensions/active_model_setup.rb +97 -0
  106. data/spec/dragonfly/active_model_extensions/active_record_setup.rb +85 -0
  107. data/spec/dragonfly/active_model_extensions/model_spec.rb +723 -0
  108. data/spec/dragonfly/active_model_extensions/spec_helper.rb +11 -0
  109. data/spec/dragonfly/analyser_spec.rb +123 -0
  110. data/spec/dragonfly/analysis/file_command_analyser_spec.rb +57 -0
  111. data/spec/dragonfly/analysis/image_magick_analyser_spec.rb +15 -0
  112. data/spec/dragonfly/analysis/r_magick_analyser_spec.rb +27 -0
  113. data/spec/dragonfly/analysis/shared_analyser_spec.rb +51 -0
  114. data/spec/dragonfly/app_spec.rb +280 -0
  115. data/spec/dragonfly/config/r_magick_spec.rb +25 -0
  116. data/spec/dragonfly/configurable_spec.rb +220 -0
  117. data/spec/dragonfly/core_ext/string_spec.rb +17 -0
  118. data/spec/dragonfly/core_ext/symbol_spec.rb +17 -0
  119. data/spec/dragonfly/data_storage/data_store_spec.rb +76 -0
  120. data/spec/dragonfly/data_storage/file_data_store_spec.rb +169 -0
  121. data/spec/dragonfly/data_storage/mongo_data_store_spec.rb +38 -0
  122. data/spec/dragonfly/data_storage/s3_data_store_spec.rb +94 -0
  123. data/spec/dragonfly/deprecation_spec.rb +20 -0
  124. data/spec/dragonfly/encoding/image_magick_encoder_spec.rb +41 -0
  125. data/spec/dragonfly/encoding/r_magick_encoder_spec.rb +37 -0
  126. data/spec/dragonfly/function_manager_spec.rb +154 -0
  127. data/spec/dragonfly/generation/hash_with_css_style_keys_spec.rb +24 -0
  128. data/spec/dragonfly/generation/image_magick_generator_spec.rb +12 -0
  129. data/spec/dragonfly/generation/r_magick_generator_spec.rb +24 -0
  130. data/spec/dragonfly/generation/shared_generator_spec.rb +91 -0
  131. data/spec/dragonfly/image_magick_utils_spec.rb +16 -0
  132. data/spec/dragonfly/job_builder_spec.rb +37 -0
  133. data/spec/dragonfly/job_definitions_spec.rb +35 -0
  134. data/spec/dragonfly/job_endpoint_spec.rb +120 -0
  135. data/spec/dragonfly/job_spec.rb +773 -0
  136. data/spec/dragonfly/loggable_spec.rb +80 -0
  137. data/spec/dragonfly/middleware_spec.rb +68 -0
  138. data/spec/dragonfly/processing/image_magick_processor_spec.rb +29 -0
  139. data/spec/dragonfly/processing/r_magick_processor_spec.rb +26 -0
  140. data/spec/dragonfly/processing/shared_processing_spec.rb +215 -0
  141. data/spec/dragonfly/routed_endpoint_spec.rb +48 -0
  142. data/spec/dragonfly/serializer_spec.rb +61 -0
  143. data/spec/dragonfly/simple_cache_spec.rb +27 -0
  144. data/spec/dragonfly/simple_endpoint_spec.rb +89 -0
  145. data/spec/dragonfly/temp_object_spec.rb +352 -0
  146. data/spec/image_matchers.rb +47 -0
  147. data/spec/simple_matchers.rb +44 -0
  148. data/spec/spec_helper.rb +58 -0
  149. data/yard/handlers/configurable_attr_handler.rb +38 -0
  150. data/yard/setup.rb +15 -0
  151. data/yard/templates/default/fulldoc/html/css/common.css +107 -0
  152. data/yard/templates/default/layout/html/layout.erb +87 -0
  153. data/yard/templates/default/module/html/configuration_summary.erb +31 -0
  154. data/yard/templates/default/module/setup.rb +17 -0
  155. metadata +550 -0
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+ require File.dirname(__FILE__) + '/../../spec_helper'
3
+ require File.dirname(__FILE__) + '/data_store_spec'
4
+ require 'mongo'
5
+
6
+ describe Dragonfly::DataStorage::MongoDataStore do
7
+
8
+ before(:each) do
9
+ begin
10
+ Mongo::Connection.new
11
+ rescue Mongo::ConnectionFailure => e
12
+ pending "You need to start mongo on localhost:27017 to test the MongoDataStore"
13
+ end
14
+ @data_store = Dragonfly::DataStorage::MongoDataStore.new :database => 'dragonfly_test'
15
+ end
16
+
17
+ it_should_behave_like 'data_store'
18
+
19
+ describe "authenticating" do
20
+ before(:each) do
21
+ @temp_object = Dragonfly::TempObject.new('Feijão verde')
22
+ end
23
+
24
+ it "should not attempt to authenticate if a username is not given" do
25
+ @data_store.db.should_not_receive(:authenticate)
26
+ @data_store.store(@temp_object)
27
+ end
28
+
29
+ it "should attempt to authenticate once if a username is given" do
30
+ @data_store.username = 'terry'
31
+ @data_store.password = 'butcher'
32
+ @data_store.db.should_receive(:authenticate).exactly(:once).with('terry','butcher').and_return(true)
33
+ uid = @data_store.store(@temp_object)
34
+ @data_store.retrieve(uid)
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,94 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require File.dirname(__FILE__) + '/data_store_spec'
3
+ require 'yaml'
4
+
5
+ describe Dragonfly::DataStorage::S3DataStore do
6
+
7
+ # To run these tests, put a file ".s3_spec.yml" in the dragonfly root dir, like this:
8
+ # key: XXXXXXXXXX
9
+ # secret: XXXXXXXXXX
10
+ # enabled: true
11
+ if File.exist?(file = File.expand_path('../../../../.s3_spec.yml', __FILE__))
12
+ config = YAML.load_file(file)
13
+ KEY = config['key']
14
+ SECRET = config['secret']
15
+ enabled = config['enabled']
16
+ else
17
+ enabled = false
18
+ end
19
+
20
+ if enabled
21
+
22
+ describe "common data_store behaviour" do
23
+
24
+ before(:each) do
25
+ @data_store = Dragonfly::DataStorage::S3DataStore.new
26
+ @data_store.configure do |d|
27
+ d.bucket_name = 'dragonfly_test'
28
+ d.access_key_id = KEY
29
+ d.secret_access_key = SECRET
30
+ end
31
+ end
32
+
33
+ it_should_behave_like 'data_store'
34
+
35
+ describe "generate_uid" do
36
+ context "without a specific_uid" do
37
+ it 'should the default value' do
38
+ @data_store.send(:generate_uid, "hello").should =~ /\d+\/\d+\/\d+\/\d+\/\d+\/\d+\/\w+\/hello/
39
+ end
40
+ end
41
+
42
+ context "with a specific_uid" do
43
+ before do
44
+ @data_store.specific_uid = lambda{|name| name}
45
+ end
46
+
47
+ after do
48
+ @data_store.specific_uid = nil
49
+ end
50
+
51
+ it 'should call the specific_uid lambda' do
52
+ @data_store.send(:generate_uid, "hello").should == 'hello'
53
+ end
54
+ end
55
+ end
56
+
57
+ describe "store" do
58
+ it "should return a unique identifier for each storage" do
59
+ temp_object = Dragonfly::TempObject.new('gollum')
60
+ temp_object2 = Dragonfly::TempObject.new('gollum')
61
+ @data_store.store(temp_object).should_not == @data_store.store(temp_object2)
62
+ end
63
+
64
+ it "should work ok with files with funny names" do
65
+ temp_object = Dragonfly::TempObject.new('eggheads',
66
+ :name => 'A Picture with many spaces in its name (at 20:00 pm).png'
67
+ )
68
+ uid = @data_store.store(temp_object)
69
+ uid.should =~ /A_Picture_with_many_spaces_in_its_name_at_20_00_pm_\.png$/
70
+ data, extra = @data_store.retrieve(uid)
71
+ data.should == 'eggheads'
72
+ end
73
+
74
+ it "should allow for setting the path manually" do
75
+ temp_object = Dragonfly::TempObject.new('eggheads')
76
+ uid = @data_store.store(temp_object, :path => 'hello/there')
77
+ uid.should == 'hello/there'
78
+ data, extra = @data_store.retrieve(uid)
79
+ data.should == 'eggheads'
80
+ end
81
+
82
+ it "should work fine when not using the filesystem" do
83
+ @data_store.use_filesystem = false
84
+ temp_object = Dragonfly::TempObject.new('gollum')
85
+ uid = @data_store.store(temp_object)
86
+ @data_store.retrieve(uid).should == ["gollum", {:meta=>{}, :format=>nil, :name=>nil}]
87
+ end
88
+ end
89
+
90
+ end
91
+
92
+ end
93
+
94
+ end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Deprecated stuff" do
4
+
5
+ describe "job urls" do
6
+
7
+ before(:each) do
8
+ @app = test_app.configure_with(:imagemagick) do |c|
9
+ # c.log = Logger.new($stdout)
10
+ end
11
+ @job = @app.fetch('eggs')
12
+ end
13
+
14
+ it { @job.url(:gif).should == @job.gif.url }
15
+ it { @job.url('20x20').should == @job.thumb('20x20').url }
16
+ it { @job.url('20x20', :gif).should == @job.thumb('20x20', :gif).url }
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dragonfly::Encoding::ImageMagickEncoder do
4
+
5
+ before(:all) do
6
+ sample_file = File.dirname(__FILE__) + '/../../../samples/beach.png' # 280x355, 135KB
7
+ @image = Dragonfly::TempObject.new(File.new(sample_file))
8
+ @encoder = Dragonfly::Encoding::ImageMagickEncoder.new
9
+ end
10
+
11
+ describe "#encode" do
12
+
13
+ it "should encode the image to the correct format" do
14
+ image = @encoder.encode(@image, :gif)
15
+ image.should have_format('gif')
16
+ end
17
+
18
+ it "should throw :unable_to_handle if the format is not handleable" do
19
+ lambda{
20
+ @encoder.encode(@image, :goofy)
21
+ }.should throw_symbol(:unable_to_handle)
22
+ end
23
+
24
+ it "should do nothing if the image is already in the correct format" do
25
+ image = @encoder.encode(@image, :png)
26
+ image.should == @image
27
+ end
28
+
29
+ it "should allow for extra args" do
30
+ image = @encoder.encode(@image, :jpg, '-quality 1')
31
+ image.should have_format('jpeg')
32
+ image.should have_size('1.45KB')
33
+ end
34
+
35
+ it "should still work even if the image is already in the correct format and args are given" do
36
+ image = @encoder.encode(@image, :png, '-quality 1')
37
+ image.should_not == @image
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dragonfly::Encoding::RMagickEncoder do
4
+
5
+ before(:all) do
6
+ sample_file = File.dirname(__FILE__) + '/../../../samples/beach.png' # 280x355
7
+ @image = Dragonfly::TempObject.new(File.new(sample_file))
8
+ @encoder = Dragonfly::Encoding::RMagickEncoder.new
9
+ end
10
+
11
+ describe "#encode" do
12
+
13
+ it "should encode the image to the correct format" do
14
+ image = @encoder.encode(@image, :gif)
15
+ image.should have_format('gif')
16
+ end
17
+
18
+ it "should throw :unable_to_handle if the format is not handleable" do
19
+ lambda{
20
+ @encoder.encode(@image, :goofy)
21
+ }.should throw_symbol(:unable_to_handle)
22
+ end
23
+
24
+ it "should do nothing if the image is already in the correct format" do
25
+ image = @encoder.encode(@image, :png)
26
+ image.should == @image
27
+ end
28
+
29
+ it "should work when not using the filesystem" do
30
+ @encoder.use_filesystem = false
31
+ image = @encoder.encode(@image, :gif)
32
+ image.should have_format('gif')
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,154 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ Spec::Matchers.define :have_keys do |*keys|
4
+ match do |given|
5
+ given.keys.map{|sym| sym.to_s }.sort == keys.map{|sym| sym.to_s }.sort
6
+ end
7
+ end
8
+
9
+ describe Dragonfly::FunctionManager do
10
+
11
+ before(:each) do
12
+ @fm = Dragonfly::FunctionManager.new
13
+ end
14
+
15
+ describe "registering functions" do
16
+
17
+ describe "registering procs" do
18
+
19
+ let(:func){ proc{ "HELLO" } }
20
+
21
+ it "should allow registering procs" do
22
+ @fm.add :hello, func
23
+ @fm.functions.should == {:hello => [func]}
24
+ end
25
+
26
+ it "should allow registering using block syntax" do
27
+ @fm.add(:hello, &func)
28
+ @fm.functions.should == {:hello => [func]}
29
+ end
30
+
31
+ end
32
+
33
+ describe "registering classes" do
34
+
35
+ before(:each) do
36
+ @class = Class.new do
37
+ def doogie(buff)
38
+ "eggheads #{buff}"
39
+ end
40
+ def bumfries(smarmey)
41
+ "sharkboy"
42
+ end
43
+ end
44
+ @fm.register(@class)
45
+ end
46
+
47
+ it "should add the methods" do
48
+ @fm.functions.should have_keys(:doogie, :bumfries)
49
+ end
50
+
51
+ it "should record the registered object" do
52
+ @fm.objects.length.should eql(1)
53
+ @fm.objects.first.should be_a(@class)
54
+ end
55
+
56
+ it "should work when calling" do
57
+ @fm.call_last(:doogie, 3).should == "eggheads 3"
58
+ end
59
+
60
+ it "should return the object when registering" do
61
+ @fm.register(@class).should be_a(@class)
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
68
+ describe "configuring on registration" do
69
+
70
+ before(:each) do
71
+ @class = Class.new do
72
+ include Dragonfly::Configurable
73
+ configurable_attr :height, 183
74
+ def initialize(age=6)
75
+ @age = age
76
+ end
77
+ def height_and_age
78
+ [height, @age]
79
+ end
80
+ end
81
+ @fm.register(@class)
82
+ end
83
+
84
+ it "should pass the args on register to the object initializer" do
85
+ @fm.register(@class, 43)
86
+ @fm.call_last(:height_and_age).should == [183, 43]
87
+ end
88
+
89
+ it "should run configure if a block given" do
90
+ @fm.register(@class){|c| c.height = 180 }
91
+ @fm.call_last(:height_and_age).should == [180, 6]
92
+ end
93
+
94
+ it "should not include configurable methods in the functions" do
95
+ @fm.functions.keys.should == [:height_and_age]
96
+ end
97
+ end
98
+
99
+ describe "calling" do
100
+
101
+ describe "errors" do
102
+ it "should raise an error for call_last if the function doesn't exist" do
103
+ lambda{
104
+ @fm.call_last(:i_dont_exist)
105
+ }.should raise_error(Dragonfly::FunctionManager::NotDefined)
106
+ end
107
+
108
+ it "should raise an error if the function is defined but unable to handle" do
109
+ @fm.add(:chicken){ throw :unable_to_handle }
110
+ lambda{
111
+ @fm.call_last(:chicken)
112
+ }.should raise_error(Dragonfly::FunctionManager::UnableToHandle)
113
+ end
114
+ end
115
+
116
+ describe "simple" do
117
+ it "should correctly call a registered block" do
118
+ @fm.add(:egg){|num| num + 1 }
119
+ @fm.call_last(:egg, 4).should == 5
120
+ end
121
+ it "should correctly call a registered class" do
122
+ klass = Class.new do
123
+ def dog(num)
124
+ num * 2
125
+ end
126
+ end
127
+ @fm.register(klass)
128
+ @fm.call_last(:dog, 4).should == 8
129
+ end
130
+ it "should correctly call an object that responds to 'call'" do
131
+ obj = Object.new
132
+ def obj.call(num); num - 3; end
133
+ @fm.add(:spoon, obj)
134
+ @fm.call_last(:spoon, 4).should == 1
135
+ end
136
+ end
137
+
138
+ describe "with more than one implementation of same function" do
139
+ it "should use the last registered" do
140
+ @fm.add(:bingo){|num| num + 1 }
141
+ @fm.add(:bingo){|num| num - 1 }
142
+ @fm.call_last(:bingo, 4).should == 3
143
+ end
144
+
145
+ it "should skip methods that throw :unable_to_handle" do
146
+ @fm.add(:bingo){|num| num + 1 }
147
+ @fm.add(:bingo){|num| throw :unable_to_handle }
148
+ @fm.call_last(:bingo, 4).should == 5
149
+ end
150
+ end
151
+
152
+ end
153
+
154
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dragonfly::Generation::HashWithCssStyleKeys do
4
+
5
+ before(:each) do
6
+ @hash = Dragonfly::Generation::HashWithCssStyleKeys[
7
+ :font_style => 'normal',
8
+ :'font-weight' => 'bold',
9
+ 'font_colour' => 'white',
10
+ 'font-size' => 23,
11
+ :hello => 'there'
12
+ ]
13
+ end
14
+
15
+ describe "accessing using underscore symbol style" do
16
+ it{ @hash[:font_style].should == 'normal' }
17
+ it{ @hash[:font_weight].should == 'bold' }
18
+ it{ @hash[:font_colour].should == 'white' }
19
+ it{ @hash[:font_size].should == 23 }
20
+ it{ @hash[:hello].should == 'there' }
21
+ it{ @hash[:non_existent_key].should be_nil }
22
+ end
23
+
24
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+ require 'dragonfly/generation/shared_generator_spec'
3
+
4
+ describe Dragonfly::Generation::ImageMagickGenerator do
5
+
6
+ before(:each) do
7
+ @generator = Dragonfly::Generation::ImageMagickGenerator.new
8
+ end
9
+
10
+ it_should_behave_like 'image generator'
11
+
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ require 'dragonfly/generation/shared_generator_spec'
3
+
4
+ describe Dragonfly::Generation::RMagickGenerator do
5
+
6
+ before(:each) do
7
+ @generator = Dragonfly::Generation::RMagickGenerator.new
8
+ end
9
+
10
+ describe "when using the filesystem" do
11
+ before(:each) do
12
+ @generator.use_filesystem = true
13
+ end
14
+ it_should_behave_like 'image generator'
15
+ end
16
+
17
+ describe "when not using the filesystem" do
18
+ before(:each) do
19
+ @generator.use_filesystem = false
20
+ end
21
+ it_should_behave_like 'image generator'
22
+ end
23
+
24
+ end