Sha256: a634292fe6926242334c82d7559485f44aa8b39ba1e0a79d63b8a10dbf618fde

Contents?: true

Size: 928 Bytes

Versions: 8

Compression:

Stored size: 928 Bytes

Contents

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

def sample_file_path(file)
  File.join(File.dirname(__FILE__), 'samples', file)
end

describe "Jpeg" do
  subject { @jpeg }
  describe :open do
    context "valid jpeg" do
      before { @jpeg = Jpeg.open(sample_file_path("sample.jpg")) }
      its(:size) { should == [112, 112] }
      its(:width) { should == 112 }
      its(:height) { should == 112 }
    end
    context "non-exists file" do
      it {
        lambda {
          Jpeg.open(sample_file_path("nonexists.jpg"))
        }.should raise_error
      }
    end

    context "not a correct jpeg file" do
      it {
        lambda {
          Jpeg.open(sample_file_path("sample.png"))
        }.should raise_error
      }
    end
  end
  describe :from_string do
    before { @jpeg = Jpeg.open_buffer(File.open(sample_file_path("sample.jpg")).read) }
    its(:size) { should == [112, 112] }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jpeg-0.2.2 spec/jpeg_spec.rb
jpeg-0.2.1 spec/jpeg_spec.rb
jpeg-0.2.0 spec/jpeg_spec.rb
jpeg-0.1.4 spec/jpeg_spec.rb
jpeg-0.1.3 spec/jpeg_spec.rb
jpeg-0.1.2 spec/jpeg_spec.rb
jpeg-0.1.1 spec/jpeg_spec.rb
jpeg-0.1.0 spec/jpeg_spec.rb