Sha256: 3b0a539d75dcd3362fbc2ff9a5804d75aa5301c1ec93c1c5a4e4d492cb969bb9

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

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

19 entries across 19 versions & 1 rubygems

Version Path
usps_flags-0.3.26 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.25 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.24 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.23 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.22 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.21 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.20 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.19 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.18 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.17 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.16 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.15 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.14 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.13 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.12 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.11 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.10 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.9 spec/usps_flags/helpers_spec.rb
usps_flags-0.3.8 spec/usps_flags/helpers_spec.rb