Sha256: 62a902ce965fcb7b0eb9823771508ab20ad1ab1738af39c4d9b44d58fb4f200c

Contents?: true

Size: 1.97 KB

Versions: 10

Compression:

Stored size: 1.97 KB

Contents

require 'spec_helper'

describe 'handling 7 slot stages' do

  let(:image) { ImageHelpers.inhs_stage_7_slot }
  let(:sqed) do
    Sqed.new(
      image: image,
      pattern: :seven_slot,
      boundary_color: :red,
      has_border: false )
  end

  let(:m) do
    { 0 => 'collecting_event_labels',
      1 => 'determination_labels',
      2 => 'other_labels',
      3 => 'image_registration',
      4 => 'curator_metadata',
      5 => 'identifier',
      6 => 'specimen' }
  end

  context 'parses' do
    specify 'new() without errors' do
      expect(sqed).to be_truthy
    end

    specify 'get result without errors' do
      expect(sqed.result).to be_truthy
    end
  end

  context 'trickier boundaries - without thumbnail' do
    let(:s) { Sqed.new(image: ImageHelpers.inhs_stage_7_slot2, metadata_map: m, use_thumbnail: false, layout: :seven_slot, boundary_color: :red, has_border: false ) }

    specify 'boundaries are reasonable' do
      s.result
      c = s.boundaries.coordinates
      c.each do |section, values|
        c[section].each_with_index do |v, i|
          msg = "section #{section}, index #{i} has a bad value '#{v}'"
          expect(v > -1).to be_truthy, msg
        end
      end
    end
  end

  context 'trickier boundaries - with_thumbnail' do
    let(:s) { Sqed.new(image: ImageHelpers.inhs_stage_7_slot2, use_thumbnail: true, pattern: :seven_slot, boundary_color: :red, has_border: false ) }


    specify 'boundaries are reasonable' do
      s.result
      c = s.boundaries.coordinates
      c.each do |section, values|
        c[section].each_with_index do |v, i|
          msg = "section #{section}, index #{i} has a bad value '#{v}'"
          expect(v > -1).to be_truthy, msg
        end
      end
    end
  end

  context 'another image' do
    let(:s) { Sqed.new(image: ImageHelpers.frost_seven_slot, use_thumbnail: true, pattern: :seven_slot, boundary_color: :red, has_border: false ) }

    specify '#result' do
      expect(s.result).to be_truthy
    end
  end 

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sqed-0.5.8 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.7 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.6 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.5 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.4 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.3 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.2 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.1 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.5.0 spec/lib/stage_handling/seven_slot_spec.rb
sqed-0.4.4 spec/lib/stage_handling/seven_slot_spec.rb