semantictext 0.2.3 → 0.2.4
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/CHANGELOG.rdoc +3 -1
- data/lib/semantictext/default_tag_factory.rb +5 -0
- data/test/test_default_tag_factory.rb +13 -1
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -22,5 +22,10 @@ module SemanticText
|
|
22
22
|
end
|
23
23
|
target.new(name,value)
|
24
24
|
end
|
25
|
+
|
26
|
+
def register_tag(name, tagclass)
|
27
|
+
throw ArgumentError.new("must register a tag class with a String key, but was #{name.class}") unless name.class.equal? String
|
28
|
+
@taglookup[name]=tagclass
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'semantictext/default_tag_factory'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'mocha'
|
3
5
|
|
4
6
|
class DefaultTagFactoryTest < Test::Unit::TestCase
|
5
7
|
|
@@ -31,5 +33,15 @@ class DefaultTagFactoryTest < Test::Unit::TestCase
|
|
31
33
|
@factory.create_tag('c2','RecentChanges')
|
32
34
|
}
|
33
35
|
end
|
36
|
+
|
37
|
+
def test_register_tag
|
38
|
+
SemanticText::MailToTag.expects(:new).once().with('bigfoo','tag content text')
|
39
|
+
@factory.register_tag('bigfoo',SemanticText::MailToTag)
|
40
|
+
@factory.create_tag('bigfoo','tag content text')
|
41
|
+
end
|
34
42
|
|
35
|
-
|
43
|
+
def test_register_tag_with_nonstring_key
|
44
|
+
assert_throws(:"must register a tag class with a String key, but was Array") { @factory.register_tag([],SemanticText::MailToTag) }
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantictext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dafydd Rees
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-27 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|