hom 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/hom.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'hom'
3
- s.version = '1.1.0'
3
+ s.version = '1.2.0'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ['Tim Craft']
6
6
  s.email = ['mail@timcraft.com']
@@ -9,7 +9,6 @@ Gem::Specification.new do |s|
9
9
  s.summary = 'See description'
10
10
  s.files = Dir.glob('{lib,spec}/**/*') + %w(Rakefile README.md hom.gemspec)
11
11
  s.add_development_dependency('rake', '~> 10.0.3')
12
- s.add_development_dependency('mocha', '~> 0.13.2')
13
12
  s.add_development_dependency('activesupport', ['>= 3.0.3'])
14
13
  s.require_path = 'lib'
15
14
 
data/lib/hom.rb CHANGED
@@ -38,6 +38,10 @@ module HOM
38
38
  @content != Undefined
39
39
  end
40
40
 
41
+ def html_safe?
42
+ true
43
+ end
44
+
41
45
  def to_s
42
46
  Encoding.safe_encode(self)
43
47
  end
@@ -48,6 +52,10 @@ module HOM
48
52
  @nodes = Array(nodes)
49
53
  end
50
54
 
55
+ def html_safe?
56
+ true
57
+ end
58
+
51
59
  def to_s
52
60
  Encoding.safe_encode(self)
53
61
  end
data/spec/element_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'minitest/autorun'
2
- require 'mocha/setup'
2
+ require 'active_support/core_ext/string/output_safety'
3
3
  require 'hom'
4
4
 
5
5
  describe 'HOM::Element' do
@@ -13,13 +13,17 @@ describe 'HOM::Element' do
13
13
  end
14
14
  end
15
15
 
16
- describe 'to_s method' do
17
- it 'safely encodes itself using the encoding module' do
18
- element = HOM::Element.new(:br)
19
-
20
- HOM::Encoding.expects(:safe_encode).with(element)
16
+ describe 'html_safe query method' do
17
+ it 'returns true' do
18
+ HOM::Element.new(:br).html_safe?.must_equal(true)
19
+ end
20
+ end
21
21
 
22
- element.to_s
22
+ describe 'to_s method' do
23
+ it 'returns an html safe string containing the encoded element' do
24
+ output = HOM::Element.new(:br).to_s
25
+ output.html_safe?.must_equal(true)
26
+ output.must_equal('<br>')
23
27
  end
24
28
  end
25
29
  end
@@ -3,10 +3,9 @@ require 'active_support/core_ext/string/output_safety'
3
3
  require 'hom'
4
4
 
5
5
  describe 'HOM::NodeList' do
6
- describe 'to_a method' do
7
- it 'returns the array of nodes passed to the constructor' do
8
- nodes = HOM::NodeList.new(%w(a b c))
9
- nodes.to_a.must_equal(%w(a b c))
6
+ describe 'html_safe query method' do
7
+ it 'returns true' do
8
+ HOM::NodeList.new([]).html_safe?.must_equal(true)
10
9
  end
11
10
  end
12
11
 
@@ -20,6 +19,13 @@ describe 'HOM::NodeList' do
20
19
  end
21
20
  end
22
21
 
22
+ describe 'to_a method' do
23
+ it 'returns the array of nodes passed to the constructor' do
24
+ nodes = HOM::NodeList.new(%w(a b c))
25
+ nodes.to_a.must_equal(%w(a b c))
26
+ end
27
+ end
28
+
23
29
  describe 'addition of two node lists' do
24
30
  it 'returns a new node list containing the items in each list' do
25
31
  nodes = HOM::NodeList.new(['one']) + HOM::NodeList.new(['two'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-30 00:00:00.000000000 Z
12
+ date: 2013-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 10.0.3
30
- - !ruby/object:Gem::Dependency
31
- name: mocha
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 0.13.2
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 0.13.2
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: activesupport
48
32
  requirement: !ruby/object:Gem::Requirement