Sha256: f6805af1b3f1f62a2d4f4626dc9af2724ce6b3ab74b8be1da4c96dc218874ceb

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: false

require 'spec_helper'

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

    it 'should return all officer flags but nothing else when given type :officer' do
      expect(USPSFlags::Helpers.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 'should correctly 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 'should correctly 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 'should raise USPSFlags::Errors::PNGConversionError with invalid parameters' do
      expect { USPSFlags::Helpers.resize_png('path/to/image.png', size: 100, size_key: 'thumb') }.to raise_error(USPSFlags::Errors::PNGConversionError)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
usps_flags-0.4.1 spec/usps_flags/helpers_spec.rb
usps_flags-0.4.0 spec/usps_flags/helpers_spec.rb