Sha256: 7194342775b033b86eaa8b427ccc88c5f379584195987de22e9ecfbaddd9decc

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 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 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

9 entries across 9 versions & 1 rubygems

Version Path
usps_flags-0.5.9 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.8 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.7 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.6 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.5 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.4 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.3 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.2 spec/usps_flags/helpers_spec.rb
usps_flags-0.5.1 spec/usps_flags/helpers_spec.rb