File: jpg_spec.rb

package info (click to toggle)
ruby-prawn 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,380 kB
  • sloc: ruby: 15,820; sh: 43; makefile: 20
file content (20 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

# Spec'ing the PNG class. Not complete yet - still needs to check the
# contents of palette and transparency to ensure they're correct.
# Need to find files that have these sections first.

require 'spec_helper'

describe Prawn::Images::JPG do
  let(:img_data) { File.binread("#{Prawn::DATADIR}/images/pigs.jpg") }

  it 'reads the basic attributes correctly' do
    jpg = described_class.new(img_data)

    expect(jpg.width).to eq(604)
    expect(jpg.height).to eq(453)
    expect(jpg.bits).to eq(8)
    expect(jpg.channels).to eq(3)
  end
end