azebiki 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -206,14 +206,15 @@ module Azebiki
206
206
 
207
207
  end
208
208
 
209
- attr_accessor :content, :have_matchers, :errors
209
+ attr_accessor :content, :have_matchers, :errors, :parent_checker
210
210
 
211
- def initialize(content, &block)
211
+ def initialize(content, parent_checker=nil, &block)
212
212
  @content = content
213
213
  @errors = []
214
214
  @have_matchers = []
215
215
  @self_before_instance_eval = eval "self", block.binding
216
216
  @matcher_builder = MatcherBuilder.new(&block)
217
+ @parent_checker = parent_checker
217
218
  build_contents
218
219
  build_matchers
219
220
  run_matchers
@@ -228,9 +229,9 @@ module Azebiki
228
229
 
229
230
  def matches(name, attributes = {}, &block)
230
231
  if block_given?
231
-
232
+ parent_checker = self
232
233
  have = MyHaveSelector.new(name, attributes) do |n|
233
- Azebiki::Checker.new(n, &block).success?
234
+ Azebiki::Checker.new(n, parent_checker, &block).success?
234
235
  end
235
236
 
236
237
  selector = MatcherProxy.new(have)
@@ -274,7 +275,11 @@ module Azebiki
274
275
  return true if @have_matchers.empty?
275
276
  @have_matchers.each do |selector|
276
277
  if !selector.matches?(@content)
277
- @errors << selector.message
278
+ if @parent_checker != nil
279
+ @parent_checker.errors << selector.message
280
+ else
281
+ @errors << selector.message
282
+ end
278
283
  end
279
284
  end
280
285
 
@@ -1,3 +1,3 @@
1
1
  module Azebiki
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azebiki
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 3
9
- version: 0.0.3
4
+ prerelease:
5
+ version: 0.0.4
10
6
  platform: ruby
11
7
  authors:
12
8
  - Eric Allam
@@ -14,21 +10,19 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-03-07 00:00:00 -05:00
13
+ date: 2011-08-16 00:00:00 -04:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: webrat
18
+ prerelease: false
22
19
  requirement: &id001 !ruby/object:Gem::Requirement
23
20
  none: false
24
21
  requirements:
25
22
  - - ">="
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
24
  version: "0"
30
25
  type: :runtime
31
- prerelease: false
32
26
  version_requirements: *id001
33
27
  description: ""
34
28
  email:
@@ -61,24 +55,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
55
  requirements:
62
56
  - - ">="
63
57
  - !ruby/object:Gem::Version
64
- hash: -3314863436418873415
65
- segments:
66
- - 0
67
58
  version: "0"
68
59
  required_rubygems_version: !ruby/object:Gem::Requirement
69
60
  none: false
70
61
  requirements:
71
62
  - - ">="
72
63
  - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 3
76
- - 6
77
64
  version: 1.3.6
78
65
  requirements: []
79
66
 
80
67
  rubyforge_project: azebiki
81
- rubygems_version: 1.3.7
68
+ rubygems_version: 1.3.9.1
82
69
  signing_key:
83
70
  specification_version: 3
84
71
  summary: A DSL for validating HTML