Sha256: 67cc3c9fbaa629e17cfdde77ac97d1afdc98c01d07dd04635c74c76e492c8f17

Contents?: true

Size: 1.23 KB

Versions: 18

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '../../spec_helper'))

describe J7W1::Util do
  subject{
    Object.new.tap{|o|o.extend J7W1::Util }
  }

  describe :symbolize_keys_recursive do

    context "should return the hash whose keys are converted to symbol recursively" do
      specify do
        expect(subject.symbolize_keys_recursive({'aaa' => 1, :bbb => 2, '3' => 4})).to eql({aaa: 1, bbb: 2, :'3' => 4})
      end

      specify do
        expect(subject.symbolize_keys_recursive({'aaa' => 1, :bbb => 2, '3' => {'aaa' => 5, :'bbb' => 10}})).to eql({aaa: 1, bbb: 2, :'3' => {aaa: 5, bbb: 10}})
      end
    end
  end

  describe :normalize_platform do
    context 'can normalize ios-like platform symbol to :ios' do

      shared_examples_for 'into ios' do
        specify{expect(subject.normalize_platform(platform_string)).to eql(:ios)}
      end

      context '"iPad OS" is given' do
        let(:platform_string){'iPad OS'}
        it_behaves_like 'into ios'
      end

      context '"iPhone OS" is given' do
        let(:platform_string){'iPhone OS'}
        it_behaves_like 'into ios'
      end

      context '"iOS" is given' do
        let(:platform_string){'iOS'}
        it_behaves_like 'into ios'
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
j7w1-0.0.27.2 spec/lib/j7w1/util_spec.rb
j7w1-0.0.27.1 spec/lib/j7w1/util_spec.rb
j7w1-0.0.27 spec/lib/j7w1/util_spec.rb
j7w1-0.0.26 spec/lib/j7w1/util_spec.rb
j7w1-0.0.25 spec/lib/j7w1/util_spec.rb
j7w1-0.0.24 spec/lib/j7w1/util_spec.rb
j7w1-0.0.23 spec/lib/j7w1/util_spec.rb
j7w1-0.0.22 spec/lib/j7w1/util_spec.rb
j7w1-0.0.21 spec/lib/j7w1/util_spec.rb
j7w1-0.0.20 spec/lib/j7w1/util_spec.rb
j7w1-0.0.19 spec/lib/j7w1/util_spec.rb
j7w1-0.0.18 spec/lib/j7w1/util_spec.rb
j7w1-0.0.17 spec/lib/j7w1/util_spec.rb
j7w1-0.0.16 spec/lib/j7w1/util_spec.rb
j7w1-0.0.15 spec/lib/j7w1/util_spec.rb
j7w1-0.0.14 spec/lib/j7w1/util_spec.rb
j7w1-0.0.13 spec/lib/j7w1/util_spec.rb
j7w1-0.0.12 spec/lib/j7w1/util_spec.rb