Sha256: 332f9b677e18601c0be2f3856597773d19793a7f2e896981b07114e925297a2e

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe TBird::Processor do
  include TBirdSpecData

  before do
    @custom_process = ->(img) { img.quality 88 }
    @processor = TBird::Processor.new(upload_file[:tempfile])
  end

  it "can process an image" do
    @processor.process(&@custom_process)
    @processor.image.valid?.must_equal true
    @processor.image.destroy!
  end

  it "can thumbnail an image" do
    @processor.thumbnail
    @processor.image.valid?.must_equal true
    @processor.image.destroy!
  end

  it "can resize an image" do
    @processor.resize('300')
    @processor.image.valid?.must_equal true
    @processor.image.destroy!
  end

  it "can return the original image" do
    @processor.original
    @processor.image.valid?.must_equal true
    @processor.image.destroy!
  end

  it "can write image" do
    @processor.resize('x200')
    @processor.write_to_file.must_be_instance_of Tempfile if jruby?
    @processor.write_to_file.must_be_instance_of File unless jruby?
    @processor.image.destroy!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
t_bird-0.0.5 spec/t_bird/processor_spec.rb