Sha256: a0af0b1c07a1067ac871a4f63d7af96d6cb1f26a71525fc5eb5a58fb7c9aacc3

Contents?: true

Size: 938 Bytes

Versions: 14

Compression:

Stored size: 938 Bytes

Contents

require 'spec_helper'

module TestModule
  module TestSubModule
    class TestClass
    end
  end
end

describe do
  context "#all_the_modules" do
    it "should return all the modules and classes for a object recursivley" do
      expect(TestModule.all_the_modules).
        to eq([TestModule, TestModule::TestSubModule, TestModule::TestSubModule::TestClass])
    end
  end
  context "#keys_to_sym" do
    it "should convert all hash keys to symbols" do
      expect({ 'key' => 'val' }.keys_to_sym).to eq({ key: 'val' })
    end
  end
  context "#keys_to_string" do
    it "should convert all hash keys to string" do
      expect({ key: 'val' }.keys_to_s).to eq({ 'key' => 'val' })
    end
  end
  context "#underscore" do
    it "should convert camel case to snack case" do
      expect('TestCamelCase123'.underscore).to eq('test_camel_case123')
      expect('Test123CamelCase'.underscore).to eq('test123_camel_case')
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
outliers-0.6.0 spec/mixins_spec.rb
outliers-0.5.1 spec/mixins_spec.rb
outliers-0.5.0 spec/mixins_spec.rb
outliers-0.5.0.beta3 spec/mixins_spec.rb
outliers-0.5.0.beta2 spec/mixins_spec.rb
outliers-0.5.0.beta1 spec/mixins_spec.rb
outliers-0.3.3 spec/mixins_spec.rb
outliers-0.3.2 spec/mixins_spec.rb
outliers-0.3.1 spec/mixins_spec.rb
outliers-0.3.0 spec/mixins_spec.rb
outliers-0.2.0 spec/mixins_spec.rb
outliers-0.1.1 spec/mixins_spec.rb
outliers-0.1.0 spec/mixins_spec.rb
outliers-0.0.1 spec/mixins_spec.rb