spec/unit/processor/image_magick_spec.rb in bulldog-0.0.8 vs spec/unit/processor/image_magick_spec.rb in bulldog-0.0.9
- old
+ new
@@ -32,15 +32,15 @@
configure do
style name, attributes
end
end
- def process(&block)
+ def process(*args, &block)
configure do
process(:on => :event, :with => :image_magick, &block)
end
- @thing.attachment.process(:event)
+ @thing.attachment.process(:event, *args)
end
describe "#dimensions" do
it "should yield the dimensions of the input file at that point in the processing pipeline if a block is given" do
style :output
@@ -74,9 +74,23 @@
describe "#process" do
it "should run convert if no block is given" do
style :output
Bulldog.expects(:run).once.with(convert, "#{original_path}[0]", output_path).returns('')
process
+ end
+
+ it "should process the specified set of styles, if given, even those not in the configured style set" do
+ style :one
+ style :two
+ style :three
+ styles = []
+ configure do
+ process(:on => :event, :with => :image_magick, :styles => [:one, :two]) do
+ styles << style.name
+ end
+ end
+ @thing.attachment.process(:event, :styles => [:two, :three])
+ styles.should == [:two, :three]
end
it "should add an error to the record if convert fails" do
style :output
Bulldog.stubs(:run).returns(nil)