Sha256: 079adde74121e4acc4975a5b75d616fea8576d2d7c50fcf742eec4fa130b170f

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe BDDGen::Extensions::String do
  it "adds a #camelize method to all strings" do
    "my string".methods.should include(:camelize)
    "your string".methods.should include(:camelize)
    "our string".methods.should include(:camelize)
  end
  
  describe '#camelize' do
    it "returns a capitilzed version of a simple string" do
      "yo".camelize.should == "Yo"
      "skullcrusher".camelize.should == "Skullcrusher"
    end
    
    it "returns a camel-cased version of an underscored string" do
      "voices_that_control_me".camelize.should == "VoicesThatControlMe"
      "fashion_police".camelize.should == "FashionPolice"
    end
    
    it "returns a camel-cased version of a dashed string" do
      "use-passenger".camelize.should == "UsePassenger"
      "send-my-regards".camelize.should == "SendMyRegards"
    end
    
    it "returns a camel-cased version of a string with spaces" do
      "the youth fountain".camelize.should == "TheYouthFountain"
      "it hurts".camelize.should == "ItHurts"
    end
    
    it "returns a camel-cased version of a string with underscores, dashes, and spaces" do
      "shuffled up-sixth_street".camelize.should == "ShuffledUpSixthStreet"
    end
    
    it "doesn't choke on multiple sequential dashes, spaces, or underscores" do
      " they___come-_ out  to__-smoke".camelize.should == "TheyComeOutToSmoke"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bddgen-0.3.0 spec/bddgen/extensions/string_spec.rb
bddgen-0.2.1 spec/bddgen/extensions/string_spec.rb
bddgen-0.2.0 spec/bddgen/extensions/string_spec.rb
bddgen-0.1.0 spec/bddgen/extensions/string_spec.rb