Sha256: ea2a738f77767b168460a214beae353720b03e9fe7d3d5ac9b3b2880039833ef

Contents?: true

Size: 995 Bytes

Versions: 17

Compression:

Stored size: 995 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'httpthumbnailer/thumbnailer'

describe ThumbnailSpec do
	it "should store thumbanil attributes method, widht, height and options" do
		t = ThumbnailSpec.new('pad', 128, 256, 'PNG', 'background' => '0x00ffff')
		t.method.should == 'pad'
		t.width.should == 128
		t.height.should == 256
		t.format.should == 'PNG'
		t.mime.should == 'image/png'
		t.options.should == { 'background' => '0x00ffff' }
	end

	it "should return full jpeg mime time on JPG format" do
		t = ThumbnailSpec.new('pad', 128, 256, 'JPG')
		t.format.should == 'JPG'
		t.mime.should == 'image/jpeg'
	end
end

describe Thumbnailer do
	it 'should allow adding new method of thumbnails' do
		t = Thumbnailer.new

		t.method('test') do |image, spec|
			image + spec.width + spec.height + spec.format.to_i + spec.options[:magic]
		end

		t.process_image(256, ThumbnailSpec.new('test', 128, 32, '8', :magic => 64)).should == 256 + 128 + 32 + 8 + 64
	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
httpthumbnailer-0.3.1 spec/thumbnailer_spec.rb
httpthumbnailer-0.3.0 spec/thumbnailer_spec.rb
httpthumbnailer-0.2.0 spec/thumbnailer_spec.rb
httpthumbnailer-0.1.0 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.14 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.13 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.12 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.11 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.10 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.9 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.8 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.7 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.6 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.5 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.4 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.3 spec/thumbnailer_spec.rb
httpthumbnailer-0.0.2 spec/thumbnailer_spec.rb