Sha256: 59e83a52909ad625a72f740c0dd83a2d5407eb24c14168caee8828d7dae061f5

Contents?: true

Size: 1.63 KB

Versions: 10

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

module BerkeleyLibrary
  module Util
    module ODS
      module XML
        module Style
          describe Family do
            describe :ensure_family do
              it "returns a #{Family} as itself" do
                Family.each do |f|
                  expect(Family.ensure_family(f)).to be(f)
                end
              end

              it 'finds a family by key' do
                Family.each do |f|
                  variants = [
                    f.key.to_s,
                    f.key.to_sym,
                    f.key.to_s.upcase,
                    f.key.to_s.upcase.to_sym,
                    f.key.to_s.downcase,
                    f.key.to_s.downcase.to_sym
                  ]
                  variants.each do |k|
                    expect(Family.ensure_family(k)).to be(f)
                  end
                end
              end

              it 'finds a family by value' do
                Family.each do |f|
                  variants = [
                    f.value.to_s,
                    f.value.to_sym,
                    f.value.to_s.upcase,
                    f.value.to_s.upcase.to_sym,
                    f.value.to_s.downcase,
                    f.value.to_s.downcase.to_sym
                  ]
                  variants.each do |v|
                    expect(Family.ensure_family(v)).to be(f)
                  end
                end
              end

              it 'rejects invalid families' do
                expect { Family.ensure_family(:not_a_family) }.to raise_error(ArgumentError)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.7.1 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.7.0 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.6.0 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.5.1 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.5.0 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.4.3 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.4.2 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.4.1 spec/berkeley_library/util/ods/xml/style/family_spec.rb
berkeley_library-tind-0.4.0 spec/berkeley_library/util/ods/xml/style/family_spec.rb