Sha256: d16154f8c5d30380ed76f0b3c4b673dd894ce446823bf03e5424732e4276f5ef

Contents?: true

Size: 914 Bytes

Versions: 19

Compression:

Stored size: 914 Bytes

Contents

require "spec_helper"

class MyOtherClass
  include Frenchy::Model
end

class MyClass
  include Frenchy::Model

  field :other, type: "my_other_class"
end

describe Hash do
  describe "#stringify_keys" do
    it "converts symbol keyed has to string keyed" do
      expect({a: 1, b: 2}.stringify_keys!).to eql({"a" => 1, "b" => 2})
    end
  end
end

describe String do
  describe "#constantize" do
    it "properly constantizes a string" do
      expect("MyClass".constantize).to eql(MyClass)
    end
  end

  describe "#camelize" do
    it "converts under_score to CamelCase" do
      expect("my_class".camelize).to eql("MyClass")
      expect("just_a_model".camelize).to eql("JustAModel")
    end
  end

  describe "#underscore" do
    it "converts CamelCase to under_score" do
      expect("MyClass".underscore).to eql("my_class")
      expect("JustAModel".underscore).to eql("just_a_model")
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
frenchy-0.7.0 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.6.3 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.6.2 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.6.1 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.6.0 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.5.2 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.5.1 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.5.0 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.4.0 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.3.0 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.9 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.8 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.7 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.6 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.5 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.4 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.3 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.2 spec/lib/frenchy/core_ext_spec.rb
frenchy-0.2.1 spec/lib/frenchy/core_ext_spec.rb