Sha256: 1d635849689f3765bac889b90967d44886e6a478d42bba32fa2e09589f28e339

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
require 'ziya/core_ext/string'

describe String do  
  describe "#camelize_it" do
    describe "it should strip module info and camelize string correctly" do
      "fred/blee/hello_world".camelize_it.should == "Fred::Blee::HelloWorld"
    end
  
    describe "it should camelize a string correctly" do
      "hello_world".camelize_it.should == "HelloWorld"
    end
    
    describe "it should camelize a plural class correctly" do
      "axis_ticks".camelize_it.should == "AxisTicks"
    end
  end
  
  describe "#underscore" do
    describe "it should underscore a class name correctly" do
      "Fred::Blee::HelloWorld".underscore.should == "fred/blee/hello_world"
    end

    describe "it should underscore a name correctly" do
      "HelloWorld".underscore.should == "hello_world"
    end    
  end
  
  describe "#classify" do
    it "should create a class name correctly" do
      "/fred.blee.hello_world".classify.should == "HelloWorld"
    end
  end
  
  describe "#demodulize" do
    it "should strip module info correctly" do
      "Fred::Blee::HelloWorld".demodulize.should == "HelloWorld"
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
derailed-ziya-2.1.0 spec/core_ext/string_spec.rb
derailed-ziya-2.1.1 spec/core_ext/string_spec.rb
derailed-ziya-2.1.2 spec/core_ext/string_spec.rb
derailed-ziya-2.1.3 spec/core_ext/string_spec.rb
derailed-ziya-2.1.4 spec/core_ext/string_spec.rb
derailed-ziya-2.1.5 spec/core_ext/string_spec.rb
ziya-2.1.6 spec/core_ext/string_spec.rb