Sha256: f63340b62df91c2255334b70baa14215d7df25bb385d026569bdf2aebd60b66c

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require 'spec_helper'
require 'ffi/extractor'

require 'yaml'

describe FFI::Extractor do
  it "should have a VERSION constant" do
    subject.const_get('VERSION').should_not be_empty
  end

  describe "abort!" do
    it "should throw :return, 1" do
      lambda { subject.abort! }.should throw_symbol(:return, 1)
    end
  end

  let(:file) { 'spec/files/image.jpg'   }
  let(:data) { File.new(file,'rb').read }

  let(:metadata) { YAML.load_file('spec/files/image.meta') }

  describe "extract" do
    it "should extract metadata from a String" do
      findings = []

      subject.extract(data) do |*arguments|
        findings << arguments
      end

      findings.should =~ metadata
    end
  end

  describe "extract_from" do
    it "should extract metadata from a file" do
      findings = []

      subject.extract_from(file) do |*arguments|
        findings << arguments
      end

      findings.should =~ metadata
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-extractor-0.1.1 spec/extractor_spec.rb