Sha256: 8aef2cdf9ac6ebb98afe001c483d4d41fc420cde9e58487a5f8aa4612b81dc2b

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: false

require 'spec_helper'

describe USPSFlags::Helpers do
  describe 'valid_flags' do
    it 'returns an Array' do
      expect(described_class.valid_flags).to be_an(Array)
    end

    it 'returns all officer flags but nothing else when given type :officer' do
      expect(described_class.valid_flags(:officer).sort).to eql(%w[
        PLTC PC PORTCAP FLEETCAP LT FLT 1LT LTC CDR PDLTC PDC DLT DAIDE
        DFLT D1LT DLTC DC PNFLT PSTFC PRC PVC PCC NAIDE NFLT STFC RC VC CC
      ].sort)
    end

    it 'correctlies generate the grid helper' do
      expect(USPSFlags::Helpers::Builders.grid).to include(
        "<circle cx=\"0\" cy=\"0\" r=\"#{USPSFlags::Config::BASE_FLY / 60}\" fill=\"#000000\" fill-opacity=\"0.4\" />"
      )
    end

    it 'correctlies generate the locator helper' do
      expect(USPSFlags::Helpers::Builders.locator).to include(
        "<rect x=\"0\" y=\"0\" width=\"#{USPSFlags::Config::BASE_FLY / 30}\" " \
        "height=\"#{USPSFlags::Config::BASE_FLY / 30}\" fill=\"#333333\" fill-opacity=\"0.6\" />"
      )
    end
  end

  describe 'resize_png' do
    it 'raises USPSFlags::Errors::PNGConversionError with invalid parameters' do
      expect do
        described_class.resize_png('path/to/image.png', size: 100, size_key: 'thumb')
      end.to raise_error(USPSFlags::Errors::PNGConversionError)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
usps_flags-0.6.4 spec/usps_flags/helpers_spec.rb
usps_flags-0.6.3 spec/usps_flags/helpers_spec.rb
usps_flags-0.6.2 spec/usps_flags/helpers_spec.rb
usps_flags-0.6.1 spec/usps_flags/helpers_spec.rb
usps_flags-0.6.0 spec/usps_flags/helpers_spec.rb