sentence_with_links 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +0 -0
- data/Manifest.txt +9 -0
- data/README.txt +3 -0
- data/Rakefile +54 -0
- data/lib/sentence_with_links.rb +26 -0
- data/lib/sentence_with_links/version.rb +9 -0
- data/setup.rb +1585 -0
- data/test/sentence_with_links_test.rb +27 -0
- data/test/test_helper.rb +2 -0
- metadata +62 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class SentenceWithLinksTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@sentence = "There are many links"
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_no_links
|
10
|
+
new_sentence = @sentence.with_links([])
|
11
|
+
assert_equal(@sentence, new_sentence)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_some_links
|
15
|
+
@links = ['http://test.com', 'http://test2.com']
|
16
|
+
new_sentence = @sentence.with_links(@links)
|
17
|
+
assert_equal("There are <a href='#{@links[0]}'>many</a> <a href='#{@links[1]}'>links</a>", new_sentence)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_too_many_links
|
21
|
+
@links = (1..7).to_a.collect {|i| "http://test#{i}.com"}
|
22
|
+
new_sentence = @sentence.with_links(@links)
|
23
|
+
expected = "<a href='http://test1.com'>There</a> <a href='http://test2.com'>are</a> <a href='http://test3.com'>many</a> <a href='http://test4.com'>links</a>" +
|
24
|
+
" (also <a href='http://test5.com'>here</a>, <a href='http://test6.com'>here</a>, and <a href='http://test7.com'>here</a>)"
|
25
|
+
assert_equal(expected, new_sentence)
|
26
|
+
end
|
27
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: sentence_with_links
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-02-11 00:00:00 +01:00
|
8
|
+
summary: Embeds urls into a sentence for use in blogs
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: drnicwilliams@gmail.com
|
12
|
+
homepage: http://sentence_with_links.rubyforge.org
|
13
|
+
rubyforge_project: sentence_with_links
|
14
|
+
description: Embeds urls into a sentence for use in blogs
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Nic Williams
|
31
|
+
files:
|
32
|
+
- Rakefile
|
33
|
+
- README.txt
|
34
|
+
- CHANGELOG.txt
|
35
|
+
- Manifest.txt
|
36
|
+
- setup.rb
|
37
|
+
- lib/sentence_with_links/version.rb
|
38
|
+
- lib/sentence_with_links.rb
|
39
|
+
- test/test_helper.rb
|
40
|
+
- test/sentence_with_links_test.rb
|
41
|
+
test_files:
|
42
|
+
- test/sentence_with_links_test.rb
|
43
|
+
rdoc_options: []
|
44
|
+
|
45
|
+
extra_rdoc_files: []
|
46
|
+
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
requirements: []
|
52
|
+
|
53
|
+
dependencies:
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: activesupport
|
56
|
+
version_requirement:
|
57
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.0
|
62
|
+
version:
|