Sha256: fc738977bba40a1fbc1e46f324520d53405e14846c57cb4f0cde99ae32136595

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

$:.unshift File.expand_path('../../../lib', __FILE__)
require 'rspec'
require 'image_optim/image_path'

describe ImageOptim::ImagePath do
  ImagePath = ImageOptim::ImagePath

  describe "convert" do
    it "should return ImagePath for string" do
      path = 'a'

      ImagePath.convert(path).should be_a(ImageOptim::ImagePath)
      ImagePath.convert(path).should eq(ImageOptim::ImagePath.new(path))

      ImagePath.convert(path).should_not eq(path)
      ImagePath.convert(path).should_not be(path)
    end

    it "should return ImagePath for Pathname" do
      pathname = Pathname.new('a')

      ImagePath.convert(pathname).should be_a(ImageOptim::ImagePath)
      ImagePath.convert(pathname).should eq(ImageOptim::ImagePath.new(pathname))

      ImagePath.convert(pathname).should eq(pathname)
      ImagePath.convert(pathname).should_not be(pathname)
    end

    it "should return same instance for ImagePath" do
      image_path = ImageOptim::ImagePath.new('a')

      ImagePath.convert(image_path).should be_a(ImageOptim::ImagePath)
      ImagePath.convert(image_path).should eq(ImageOptim::ImagePath.new(image_path))

      ImagePath.convert(image_path).should eq(image_path)
      ImagePath.convert(image_path).should be(image_path)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
image_optim-0.13.3 spec/image_optim/image_path_spec.rb
image_optim-0.13.2 spec/image_optim/image_path_spec.rb
image_optim-0.13.1 spec/image_optim/image_path_spec.rb
image_optim-0.13.0 spec/image_optim/image_path_spec.rb
image_optim-0.12.1 spec/image_optim/image_path_spec.rb
image_optim-0.12.0 spec/image_optim/image_path_spec.rb
image_optim-0.11.2 spec/image_optim/image_path_spec.rb
image_optim-0.11.1 spec/image_optim/image_path_spec.rb
image_optim-0.11.0 spec/image_optim/image_path_spec.rb
image_optim-0.10.2 spec/image_optim/image_path_spec.rb
image_optim-0.10.1 spec/image_optim/image_path_spec.rb
image_optim-0.10.0 spec/image_optim/image_path_spec.rb