azebiki 0.0.1 → 0.0.2
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.md +2 -0
- data/README.md +2 -0
- data/lib/azebiki/azebiki.rb +29 -0
- data/lib/azebiki/version.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/azebiki/azebiki.rb
CHANGED
@@ -2,6 +2,12 @@ require 'webrat/core/matchers/have_selector'
|
|
2
2
|
require 'webrat/core/matchers/have_content'
|
3
3
|
require 'nokogiri'
|
4
4
|
|
5
|
+
begin
|
6
|
+
require 'builder'
|
7
|
+
rescue LoadError => e
|
8
|
+
end
|
9
|
+
|
10
|
+
|
5
11
|
# This class is useful for making sure an HTML text has certain tags/content
|
6
12
|
# It supports both XML and HTML. For example, if you want to make sure someone has included
|
7
13
|
# a link that points to google, has no follow, with the text 'Google Sucks!':
|
@@ -29,6 +35,17 @@ require 'nokogiri'
|
|
29
35
|
# end
|
30
36
|
#
|
31
37
|
# which will succeed only if the img tag is nested below the a tag. You can nest matchers pretty deep
|
38
|
+
#
|
39
|
+
#
|
40
|
+
|
41
|
+
unless defined?(BasicObject)
|
42
|
+
if defined?(Builder::BlankSlate)
|
43
|
+
BasicObject = Builder::BlankSlate
|
44
|
+
else
|
45
|
+
raise 'Azebiki only supported on 1.8.7 when used in a rails application, otherwise, use 1.9.2'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
32
49
|
module Azebiki
|
33
50
|
class Checker
|
34
51
|
|
@@ -108,7 +125,18 @@ module Azebiki
|
|
108
125
|
@contents << text
|
109
126
|
end
|
110
127
|
|
128
|
+
# special case for BlankSlate
|
129
|
+
def p(*args, &block)
|
130
|
+
handle_tag(:p, *args, &block)
|
131
|
+
end
|
132
|
+
|
111
133
|
def method_missing(method, *args, &block)
|
134
|
+
handle_tag(method, *args, &block)
|
135
|
+
end
|
136
|
+
|
137
|
+
private
|
138
|
+
|
139
|
+
def handle_tag(method, *args, &block)
|
112
140
|
tag = {:tag_name => method.to_s}
|
113
141
|
|
114
142
|
if args.first.is_a?(::String)
|
@@ -153,6 +181,7 @@ module Azebiki
|
|
153
181
|
|
154
182
|
return tag
|
155
183
|
end
|
184
|
+
|
156
185
|
end
|
157
186
|
|
158
187
|
attr_accessor :content, :have_matchers, :errors
|
data/lib/azebiki/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eric Allam
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-16 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|