sarnesjo-twhere 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/twhere.rb +1 -1
- data/spec/hashtag_spec.rb +22 -10
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/twhere.rb
CHANGED
data/spec/hashtag_spec.rb
CHANGED
@@ -4,40 +4,52 @@ require 'spec_helper'
|
|
4
4
|
describe 'hashtag method' do
|
5
5
|
include TwhereHelperMethods
|
6
6
|
|
7
|
-
it 'should
|
8
|
-
# no hashtags
|
7
|
+
it 'should return nil when there are no hashtags' do
|
9
8
|
hashtag('').should == nil
|
10
9
|
hashtag('a').should == nil
|
11
10
|
hashtag('#').should == nil
|
12
11
|
hashtag('##').should == nil
|
12
|
+
end
|
13
13
|
|
14
|
-
|
14
|
+
it 'should find hashtags containing only lowercase letters' do
|
15
15
|
hashtag('#a').should == 'a'
|
16
16
|
hashtag('#aa').should == 'aa'
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
+
it 'should find hashtags containing only uppercase letters' do
|
19
20
|
hashtag('#A').should == 'A'
|
20
21
|
hashtag('#AA').should == 'AA'
|
22
|
+
end
|
21
23
|
|
22
|
-
|
24
|
+
it 'should find hashtags containing only digits' do
|
23
25
|
hashtag('#1').should == '1'
|
24
26
|
hashtag('#11').should == '11'
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
# mixed character classes
|
29
|
+
it 'should find hashtags containing mixed character classes' do
|
29
30
|
hashtag('#aA').should == 'aA'
|
30
31
|
hashtag('#Aa').should == 'Aa'
|
31
32
|
hashtag('#a1').should == 'a1'
|
32
33
|
hashtag('#1a').should == '1a'
|
33
34
|
hashtag('#A1').should == 'A1'
|
34
35
|
hashtag('#1A').should == '1A'
|
36
|
+
end
|
35
37
|
|
36
|
-
|
38
|
+
it 'should find hashtags in text' do
|
37
39
|
hashtag('a #b').should == 'b'
|
38
40
|
hashtag('#a b').should == 'a'
|
41
|
+
end
|
39
42
|
|
40
|
-
|
43
|
+
it 'should return the first hashtag found' do
|
41
44
|
hashtag('#a #b').should == 'a'
|
42
45
|
end
|
46
|
+
|
47
|
+
it 'should not include punctuation in hashtags' do
|
48
|
+
hashtag('#a.').should == 'a'
|
49
|
+
hashtag('#a,').should == 'a'
|
50
|
+
hashtag('#a:').should == 'a'
|
51
|
+
hashtag('#a;').should == 'a'
|
52
|
+
hashtag('#a!').should == 'a'
|
53
|
+
hashtag('#a?').should == 'a'
|
54
|
+
end
|
43
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sarnesjo-twhere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jesper S\xC3\xA4rnesj\xC3\xB6"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04
|
12
|
+
date: 2009-05-04 00:00:00 -07:00
|
13
13
|
default_executable: twhere
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|