renshi 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/lib/renshi.rb +1 -1
- data/spec/data/unless.ren +3 -0
- data/spec/unless_spec.rb +16 -2
- metadata +3 -2
data/lib/renshi.rb
CHANGED
data/spec/unless_spec.rb
CHANGED
@@ -3,11 +3,25 @@ require 'nokogiri'
|
|
3
3
|
|
4
4
|
describe Renshi::Parser do
|
5
5
|
it "should evaluate r:unless(false)" do
|
6
|
-
doc = Nokogiri::HTML("<span id='red' r:unless='
|
6
|
+
doc = Nokogiri::HTML("<span id='red' r:unless='foo'>hello</span>")
|
7
7
|
compiled = Renshi::Parser.parse(doc.root.to_s)
|
8
|
-
|
8
|
+
foo = false
|
9
9
|
out = eval(compiled, binding)
|
10
10
|
out = N(out)
|
11
11
|
(out/"span[@id='red']").text.strip.should eql "hello"
|
12
|
+
|
13
|
+
foo = true
|
14
|
+
out = eval(compiled, binding)
|
15
|
+
out = N(out)
|
16
|
+
(out/"span[@id='red']").text.strip.should eql ""
|
12
17
|
end
|
18
|
+
|
19
|
+
it "should ... " do
|
20
|
+
foo = true
|
21
|
+
compiled = compile_file("data/unless.ren")
|
22
|
+
puts compiled
|
23
|
+
out = eval compiled, binding
|
24
|
+
|
25
|
+
out.should_not =~ /hello/
|
26
|
+
end
|
13
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renshi
|
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
|
- Nicholas Faiz
|
@@ -9,7 +9,7 @@ autorequire: renshi
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-29 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -91,6 +91,7 @@ test_files:
|
|
91
91
|
- spec/data/multiple_statements.ren
|
92
92
|
- spec/data/quots.ren
|
93
93
|
- spec/data/quots2.ren
|
94
|
+
- spec/data/unless.ren
|
94
95
|
- spec/data/while.ren
|
95
96
|
- spec/data/while_lt.ren
|
96
97
|
- spec/data/white_space.ren
|