slugity 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/slugity.rb +10 -17
- data/lib/slugity/convert.rb +31 -0
- data/lib/slugity/extend_string.rb +5 -5
- data/lib/slugity/matchers.rb +2 -2
- data/lib/slugity/version.rb +2 -2
- data/spec/lib/slugity/convert_spec.rb +31 -0
- data/spec/{string_spec.rb → lib/slugity/extend_string_spec.rb} +4 -4
- data/spec/{matchers → lib/slugity/matchers}/json_string_spec.rb +2 -2
- data/spec/{slugity → lib/slugity}/matchers_spec.rb +4 -4
- data/spec/lib/slugity/trim_string_spec.rb +14 -0
- data/spec/lib/slugity_accented_character_spec.rb +29 -0
- data/spec/lib/slugity_spec.rb +27 -0
- data/spec/{stringity_spec.rb → lib/stringity_spec.rb} +2 -2
- data/spec/support/accented_characters.rb +888 -0
- data/spec/support/test_strings.rb +15 -0
- metadata +36 -32
- data/spec/accented_character_spec.rb +0 -912
- data/spec/slugity/trim_string_spec.rb +0 -14
- data/spec/slugity_spec.rb +0 -39
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'slugity/utilities'
|
3
|
-
|
4
|
-
describe Slugity::Util do
|
5
|
-
|
6
|
-
describe "#trim_string" do
|
7
|
-
it "removes begining and ending spaces" do
|
8
|
-
Slugity::Util.trim_string( " hello world" ).should == "hello world"
|
9
|
-
Slugity::Util.trim_string( "hello world " ).should == "hello world"
|
10
|
-
Slugity::Util.trim_string( " hello world " ).should == "hello world"
|
11
|
-
Slugity::Util.trim_string( " hello world " ).should == "hello world"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/spec/slugity_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'slugity'
|
5
|
-
|
6
|
-
test_strings = {
|
7
|
-
"Hello World" => "hello-world",
|
8
|
-
"one Flew_South" => "one-flew_south",
|
9
|
-
"Attr: Halp" => "attr-halp",
|
10
|
-
"Freddie & Bananas" => "freddie-and-bananas",
|
11
|
-
"One + Two = Three" => "one-plus-two-equals-three",
|
12
|
-
" hello world" => "hello-world",
|
13
|
-
"hello world " => "hello-world",
|
14
|
-
"post id 1234" => "post-id-1234",
|
15
|
-
"124 post id" => "124-post-id"
|
16
|
-
}
|
17
|
-
|
18
|
-
describe Slugity do
|
19
|
-
|
20
|
-
include Slugity
|
21
|
-
|
22
|
-
describe "#slugity()" do
|
23
|
-
it "returns a properly formatted string" do
|
24
|
-
test_strings.each do |input,output|
|
25
|
-
slugity( input ).should == output
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it "handles non-strings like numbers" do
|
30
|
-
slugity( 42 ).should == "42"
|
31
|
-
slugity( 123.456 ).should == "123456"
|
32
|
-
end
|
33
|
-
|
34
|
-
it "strips unrecognized characters" do
|
35
|
-
slugity( "a…‡†i".encode("UTF-8") ).should == "ai"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|