Sha256: 4183ff08b8b86cbe14ab38d103573535da90662fbf1d5b6dbda3905e181fa2e8
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
$:.unshift(File.dirname(__FILE__)) require 'spec_helper' describe 'hashtags method' do include TwhereHelperMethods it 'should return empty array when there are no hashtags' do hashtags('').should == [] hashtags('a').should == [] hashtags('#').should == [] hashtags('##').should == [] end it 'should find hashtags containing only lowercase letters' do hashtags('#a').should == ['a'] hashtags('#aa').should == ['aa'] end it 'should find hashtags containing only uppercase letters' do hashtags('#A').should == ['A'] hashtags('#AA').should == ['AA'] end it 'should find hashtags containing only digits' do hashtags('#1').should == ['1'] hashtags('#11').should == ['11'] end it 'should find hashtags containing mixed character classes' do hashtags('#aA').should == ['aA'] hashtags('#Aa').should == ['Aa'] hashtags('#a1').should == ['a1'] hashtags('#1a').should == ['1a'] hashtags('#A1').should == ['A1'] hashtags('#1A').should == ['1A'] end it 'should find hashtags in text' do hashtags('a #b').should == ['b'] hashtags('#a b').should == ['a'] end it 'should return all hashtags found' do hashtags('#a #b').should == ['a', 'b'] end it 'should only return each hashtag once' do hashtags('#a #a').should == ['a'] hashtags('#a #a #b').should == ['a', 'b'] end it 'should not include punctuation in hashtags' do hashtags('#a.').should == ['a'] hashtags('#a,').should == ['a'] hashtags('#a:').should == ['a'] hashtags('#a;').should == ['a'] hashtags('#a!').should == ['a'] hashtags('#a?').should == ['a'] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sarnesjo-twhere-0.0.12 | spec/hashtags_spec.rb |