dill 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/dill.rb +4 -0
- data/lib/dill/cucumber.rb +2 -1
- data/lib/dill/dsl.rb +40 -0
- data/lib/dill/matchers.rb +7 -0
- data/lib/dill/rails.rb +5 -0
- data/lib/dill/rails/role.rb +9 -0
- data/lib/dill/role.rb +19 -0
- data/lib/dill/version.rb +1 -1
- data/lib/dill/widgets.rb +16 -12
- data/lib/dill/widgets/dsl.rb +47 -0
- data/lib/dill/widgets/field.rb +2 -6
- data/lib/dill/widgets/form.rb +2 -0
- data/lib/dill/widgets/list.rb +8 -16
- data/lib/dill/widgets/parts/container.rb +6 -0
- data/lib/dill/widgets/select.rb +7 -3
- data/lib/dill/widgets/widget.rb +47 -120
- data/lib/dill/widgets/widget/node_filter.rb +35 -0
- metadata +95 -67
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7868bfe9fa6361d88848300bfecc8865641aa20d
|
4
|
+
data.tar.gz: c9ef7dcdd55253ba2bd4c2c13b573e9ddce90fda
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a60a3f55322d125cb64522d7bfc8c8c8e2235f7a1c70bf7d64763286e22a1e6e296e057ad5886392fbf26b2f06e7cb892fdc03379c66f8a174578244cf211291
|
7
|
+
data.tar.gz: bc94abaf53d82cc1d2b231c8fe4ad1fc47fff52724249e9b00f8a3f42c028047886722be6c7658779f5d059398fd74c823c346ff24d25a48fb30816a771d0df7
|
data/lib/dill.rb
CHANGED
@@ -13,8 +13,12 @@ require 'dill/text_table/transformations'
|
|
13
13
|
require 'dill/text_table/cell_text'
|
14
14
|
require 'dill/capybara'
|
15
15
|
require 'dill/dsl'
|
16
|
+
require 'dill/matchers'
|
16
17
|
|
17
18
|
module Dill
|
18
19
|
# An exception that signals that something is missing.
|
19
20
|
class Missing < StandardError; end
|
21
|
+
class MissingWidget < StandardError; end
|
22
|
+
class AmbiguousWidget < StandardError; end
|
23
|
+
class InvalidOption < StandardError; end
|
20
24
|
end
|
data/lib/dill/cucumber.rb
CHANGED
data/lib/dill/dsl.rb
CHANGED
@@ -2,6 +2,21 @@ module Dill
|
|
2
2
|
module DSL
|
3
3
|
attr_writer :widget_lookup_scope
|
4
4
|
|
5
|
+
# Clicks the widget defined by +name+ and optional +args+.
|
6
|
+
#
|
7
|
+
# Makes no distinction between links or buttons.
|
8
|
+
#
|
9
|
+
# class MyWidget < Dill::Widget
|
10
|
+
# root { |text| ['.my-widget', text: text] }
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# # <a href="#one" class="my-widget">One</li>
|
14
|
+
# # <a href="#two" class="my-widget">Two</li> <!-- clicks this node -->
|
15
|
+
# click :my_widget, 'Two'
|
16
|
+
def click(name, *args)
|
17
|
+
widget(name, *args).click
|
18
|
+
end
|
19
|
+
|
5
20
|
# @return [Document] the current document with the class of the
|
6
21
|
# current object set as the widget lookup scope.
|
7
22
|
def document
|
@@ -14,10 +29,28 @@ module Dill
|
|
14
29
|
document.has_widget?(name, *args)
|
15
30
|
end
|
16
31
|
|
32
|
+
alias_method :widget?, :has_widget?
|
33
|
+
|
34
|
+
def set(name, fields)
|
35
|
+
widget(name).set fields
|
36
|
+
end
|
37
|
+
|
38
|
+
def submit(name, fields = {})
|
39
|
+
widget(name).submit_with fields
|
40
|
+
end
|
41
|
+
|
17
42
|
def value(name, *args)
|
18
43
|
widget(name, *args).value
|
19
44
|
end
|
20
45
|
|
46
|
+
def values(name, *args)
|
47
|
+
widgets(name, *args).map(&:value)
|
48
|
+
end
|
49
|
+
|
50
|
+
def visit(path)
|
51
|
+
Capybara.current_session.visit path
|
52
|
+
end
|
53
|
+
|
21
54
|
# Returns a widget instance for the given name.
|
22
55
|
#
|
23
56
|
# @param name [String, Symbol]
|
@@ -25,6 +58,13 @@ module Dill
|
|
25
58
|
document.widget(name, *args)
|
26
59
|
end
|
27
60
|
|
61
|
+
# Returns a list of widget instances for the given name.
|
62
|
+
#
|
63
|
+
# @param name [String, Symbol]
|
64
|
+
def widgets(name, *args)
|
65
|
+
document.widgets(name, *args)
|
66
|
+
end
|
67
|
+
|
28
68
|
def widget_lookup_scope
|
29
69
|
@widget_lookup_scope ||= default_widget_lookup_scope
|
30
70
|
end
|
data/lib/dill/rails.rb
ADDED
data/lib/dill/role.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dill
|
2
|
+
class Role < Dill::Rails::Role
|
3
|
+
extend Widgets::DSL
|
4
|
+
|
5
|
+
include Dill::DSL
|
6
|
+
|
7
|
+
def see?(name, *args)
|
8
|
+
if respond_to?("see_#{name}?")
|
9
|
+
send("see_#{name}?", *args)
|
10
|
+
else
|
11
|
+
widget?(name, *args)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def inspect
|
16
|
+
self.class.name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/dill/version.rb
CHANGED
data/lib/dill/widgets.rb
CHANGED
@@ -6,28 +6,30 @@
|
|
6
6
|
module Dill
|
7
7
|
module Constructors
|
8
8
|
def Widget(*selector, &block)
|
9
|
-
|
9
|
+
if block_given?
|
10
|
+
WidgetClass.new(selector.flatten) do
|
11
|
+
define_method :value do
|
12
|
+
block.call(text)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
else
|
16
|
+
WidgetClass.new(selector.flatten)
|
17
|
+
end
|
10
18
|
end
|
11
19
|
|
12
20
|
alias_method :String, :Widget
|
13
21
|
|
14
22
|
def Integer(*selector)
|
15
|
-
Widget(selector)
|
16
|
-
def value
|
17
|
-
Integer(text)
|
18
|
-
end
|
19
|
-
end
|
23
|
+
Widget(selector) { |text| Kernel::Integer(text) }
|
20
24
|
end
|
21
25
|
|
22
26
|
require 'bigdecimal'
|
23
27
|
|
24
28
|
def Decimal(*selector)
|
25
|
-
Widget(selector)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
29
|
+
Widget(selector) { |text|
|
30
|
+
# ensure we can convert to float first
|
31
|
+
Float(text) && BigDecimal.new(text)
|
32
|
+
}
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
@@ -39,9 +41,11 @@ module Dill::WidgetParts; end
|
|
39
41
|
require 'dill/widgets/parts/struct'
|
40
42
|
require 'dill/widgets/parts/container'
|
41
43
|
|
44
|
+
require 'dill/widgets/dsl'
|
42
45
|
require 'dill/widgets/widget_class'
|
43
46
|
require 'dill/widgets/widget_name'
|
44
47
|
require 'dill/widgets/widget'
|
48
|
+
require 'dill/widgets/widget/node_filter'
|
45
49
|
require 'dill/widgets/list_item'
|
46
50
|
require 'dill/widgets/list'
|
47
51
|
require 'dill/widgets/base_table'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Dill
|
2
|
+
module Widgets
|
3
|
+
module DSL
|
4
|
+
# Declares a new form widget.
|
5
|
+
#
|
6
|
+
# See features/role.feature.
|
7
|
+
def form(name, *rest, &block)
|
8
|
+
widget name, *rest, Dill::Form, &block
|
9
|
+
end
|
10
|
+
|
11
|
+
# Declares a new list widget.
|
12
|
+
#
|
13
|
+
# See features/roles/list.feature.
|
14
|
+
def list(name, *rest, &block)
|
15
|
+
widget name, *rest, Dill::List, &block
|
16
|
+
end
|
17
|
+
|
18
|
+
# Declares a new child widget.
|
19
|
+
#
|
20
|
+
# See https://github.com/mojotech/dill/blob/master/features/roles/widget.feature
|
21
|
+
def widget(name, selector_or_parent, parent = Widget, &block)
|
22
|
+
raise ArgumentError, "`#{name}' is a reserved name" \
|
23
|
+
if WidgetParts::Container.instance_methods.include?(name.to_sym)
|
24
|
+
|
25
|
+
case selector_or_parent
|
26
|
+
when String, Array, Proc
|
27
|
+
selector, type = selector_or_parent, parent
|
28
|
+
when Class
|
29
|
+
selector, type = selector_or_parent.selector, selector_or_parent
|
30
|
+
else
|
31
|
+
raise ArgumentError, "wrong number of arguments (#{rest.size} for 1)"
|
32
|
+
end
|
33
|
+
|
34
|
+
raise TypeError, "can't convert `#{type}' to Widget" \
|
35
|
+
unless type.methods.include?(:selector)
|
36
|
+
|
37
|
+
raise ArgumentError, "missing selector" unless selector || type.selector
|
38
|
+
|
39
|
+
child = WidgetClass.new(selector, type, &block)
|
40
|
+
|
41
|
+
const_set(Dill::WidgetName.new(name).to_sym, child)
|
42
|
+
|
43
|
+
child
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/dill/widgets/field.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
module Dill
|
2
2
|
# A form field.
|
3
3
|
class Field < Widget
|
4
|
-
def self.
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.present_in?(parent)
|
9
|
-
parent.root.has_field?(*selector)
|
4
|
+
def self.root(*selector)
|
5
|
+
@filter = NodeFilter.new([:field] + selector)
|
10
6
|
end
|
11
7
|
|
12
8
|
# @return This field's value.
|
data/lib/dill/widgets/form.rb
CHANGED
data/lib/dill/widgets/list.rb
CHANGED
@@ -64,9 +64,9 @@ module Dill
|
|
64
64
|
# parent and child selectors.
|
65
65
|
#
|
66
66
|
# <div id="not-a-list-colors">
|
67
|
-
# <div class="
|
68
|
-
# <div class="
|
69
|
-
# <div class="
|
67
|
+
# <div class="child">Red</div>
|
68
|
+
# <div class="child">Green</div>
|
69
|
+
# <div class="child">Blue</div>
|
70
70
|
# </div>
|
71
71
|
#
|
72
72
|
# You can define the following widget:
|
@@ -80,6 +80,8 @@ module Dill
|
|
80
80
|
|
81
81
|
def_delegators :items, :each, :first, :last
|
82
82
|
|
83
|
+
root 'ul' unless filter?
|
84
|
+
|
83
85
|
class << self
|
84
86
|
# Configures the List item selector and class.
|
85
87
|
#
|
@@ -140,16 +142,6 @@ module Dill
|
|
140
142
|
def item_factory
|
141
143
|
@item_factory ||= WidgetClass.new('li', ListItem)
|
142
144
|
end
|
143
|
-
|
144
|
-
def selector
|
145
|
-
begin
|
146
|
-
super
|
147
|
-
rescue Widget::MissingSelector
|
148
|
-
root 'ul'
|
149
|
-
|
150
|
-
super
|
151
|
-
end
|
152
|
-
end
|
153
145
|
end
|
154
146
|
|
155
147
|
def count
|
@@ -197,12 +189,12 @@ module Dill
|
|
197
189
|
item_factory.new(node)
|
198
190
|
end
|
199
191
|
|
200
|
-
def
|
201
|
-
item_factory.
|
192
|
+
def item_filter
|
193
|
+
item_factory.filter
|
202
194
|
end
|
203
195
|
|
204
196
|
def items
|
205
|
-
|
197
|
+
item_filter.nodes(self).map { |node| item_for(node) }
|
206
198
|
end
|
207
199
|
end
|
208
200
|
end
|
@@ -9,10 +9,16 @@ module Dill
|
|
9
9
|
widget(name, *args).present?
|
10
10
|
end
|
11
11
|
|
12
|
+
alias_method :widget?, :has_widget?
|
13
|
+
|
12
14
|
def widget(name, *args)
|
13
15
|
widget_class(name).find_in(self, *args)
|
14
16
|
end
|
15
17
|
|
18
|
+
def widgets(name, *args)
|
19
|
+
widget_class(name).find_all_in(self, *args)
|
20
|
+
end
|
21
|
+
|
16
22
|
private
|
17
23
|
|
18
24
|
attr_writer :widget_lookup_scope
|
data/lib/dill/widgets/select.rb
CHANGED
@@ -12,9 +12,13 @@ module Dill
|
|
12
12
|
#
|
13
13
|
# You may pass in the option text or value.
|
14
14
|
def set(option)
|
15
|
-
root.
|
16
|
-
|
17
|
-
|
15
|
+
root.find(:option, option).select_option
|
16
|
+
rescue
|
17
|
+
begin
|
18
|
+
root.find("option[value = #{option.inspect}]").select_option
|
19
|
+
rescue Capybara::ElementNotFound => e
|
20
|
+
raise wrap_exception(e, InvalidOption)
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
# @!method to_s
|
data/lib/dill/widgets/widget.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Dill
|
2
2
|
class Widget
|
3
3
|
extend Forwardable
|
4
|
+
extend Widgets::DSL
|
4
5
|
|
5
6
|
include WidgetParts::Struct
|
6
7
|
include WidgetParts::Container
|
@@ -42,110 +43,18 @@ module Dill
|
|
42
43
|
#
|
43
44
|
# @param name the name of the action
|
44
45
|
# @param selector the selector for the widget that will be clicked
|
45
|
-
def self.action(name, selector)
|
46
|
-
|
46
|
+
def self.action(name, selector = nil)
|
47
|
+
block = if selector
|
48
|
+
wname = :"#{name}_widget"
|
47
49
|
|
48
|
-
|
50
|
+
widget wname, selector
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
+
-> { widget(wname).click; self }
|
53
|
+
else
|
54
|
+
-> { click; self }
|
55
|
+
end
|
52
56
|
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Declares a new child widget.
|
58
|
-
#
|
59
|
-
# Child widgets are accessible inside the container widget using the
|
60
|
-
# {#widget} message, or by sending a message +name+. They
|
61
|
-
# are automatically scoped to the parent widget's root node.
|
62
|
-
#
|
63
|
-
# @example Defining a widget
|
64
|
-
# # Given the following HTML:
|
65
|
-
# #
|
66
|
-
# # <div id="root">
|
67
|
-
# # <span id="child">Child</span>
|
68
|
-
# # </div>
|
69
|
-
# class Container < Dill::Widget
|
70
|
-
# root '#root'
|
71
|
-
#
|
72
|
-
# widget :my_widget, '#child'
|
73
|
-
# end
|
74
|
-
#
|
75
|
-
# container = widget(:container)
|
76
|
-
#
|
77
|
-
# # accessing using #widget
|
78
|
-
# my_widget = container.widget(:my_widget)
|
79
|
-
#
|
80
|
-
# # accessing using #my_widget
|
81
|
-
# my_widget = container.my_widget
|
82
|
-
#
|
83
|
-
# @overload widget(name, selector, type = Widget)
|
84
|
-
#
|
85
|
-
# The most common form, it allows you to pass in a selector as well as a
|
86
|
-
# type for the child widget. The selector will override +type+'s
|
87
|
-
# root selector, if +type+ has one defined.
|
88
|
-
#
|
89
|
-
# @param name the child widget's name.
|
90
|
-
# @param selector the child widget's selector. You can pass either a
|
91
|
-
# String or, if you want to use a composite selector, an Array.
|
92
|
-
# @param type the child widget's parent class.
|
93
|
-
#
|
94
|
-
# @overload widget(name, type)
|
95
|
-
#
|
96
|
-
# This form allows you to omit +selector+ from the arguments. It will
|
97
|
-
# reuse +type+'s root selector.
|
98
|
-
#
|
99
|
-
# @param name the child widget's name.
|
100
|
-
# @param type the child widget's parent class.
|
101
|
-
#
|
102
|
-
# @raise ArgumentError if +type+ has no root selector defined.
|
103
|
-
#
|
104
|
-
# @yield A block allowing you to further customize the widget behavior.
|
105
|
-
#
|
106
|
-
# @see #widget
|
107
|
-
def self.widget(name, *rest, &block)
|
108
|
-
raise ArgumentError, "`#{name}' is a reserved name" \
|
109
|
-
if WidgetParts::Container.instance_methods.include?(name.to_sym)
|
110
|
-
|
111
|
-
case rest.first
|
112
|
-
when Class
|
113
|
-
arg_count = rest.size + 1
|
114
|
-
raise ArgumentError, "wrong number of arguments (#{arg_count} for 2)" \
|
115
|
-
unless arg_count == 2
|
116
|
-
|
117
|
-
type = rest.first
|
118
|
-
raise TypeError, "can't convert `#{type}' to Widget" \
|
119
|
-
unless type.methods.include?(:selector)
|
120
|
-
raise ArgumentError, "missing root selector for `#{type}'" \
|
121
|
-
unless type.selector
|
122
|
-
|
123
|
-
selector = type.selector
|
124
|
-
when String, Array, Proc
|
125
|
-
arg_count = rest.size + 1
|
126
|
-
|
127
|
-
case arg_count
|
128
|
-
when 0, 1
|
129
|
-
raise ArgumentError, "wrong number of arguments (#{arg_count} for 2)"
|
130
|
-
when 2
|
131
|
-
selector, type = [*rest, Widget]
|
132
|
-
when 3
|
133
|
-
selector, type = rest
|
134
|
-
|
135
|
-
raise TypeError, "can't convert `#{type}' to Widget" \
|
136
|
-
unless Class === type
|
137
|
-
else
|
138
|
-
raise ArgumentError, "wrong number of arguments (#{arg_count} for 3)"
|
139
|
-
end
|
140
|
-
else
|
141
|
-
raise ArgumentError, "unknown method signature: #{rest.inspect}"
|
142
|
-
end
|
143
|
-
|
144
|
-
child = WidgetClass.new(selector, type, &block)
|
145
|
-
|
146
|
-
const_set(Dill::WidgetName.new(name).to_sym, child)
|
147
|
-
|
148
|
-
child
|
57
|
+
define_method name, &block
|
149
58
|
end
|
150
59
|
|
151
60
|
# Creates a delegator for one child widget message.
|
@@ -181,7 +90,11 @@ module Dill
|
|
181
90
|
#
|
182
91
|
# @raise [Capybara::ElementNotFoundError] if the widget can't be found
|
183
92
|
def self.find_in(parent, *args)
|
184
|
-
new
|
93
|
+
new(filter.query(parent, *args))
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.find_all_in(parent, *args)
|
97
|
+
filter.nodes(parent, *args).map { |e| new(e) }
|
185
98
|
end
|
186
99
|
|
187
100
|
# Determines if an instance of this widget class exists in
|
@@ -248,30 +161,28 @@ module Dill
|
|
248
161
|
# root :xpath, '//some/node'
|
249
162
|
# end
|
250
163
|
def self.root(*selector, &block)
|
251
|
-
@
|
164
|
+
@filter = NodeFilter.new(block || selector)
|
252
165
|
end
|
253
166
|
|
254
167
|
class MissingSelector < StandardError
|
255
168
|
end
|
256
169
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
170
|
+
def self.filter
|
171
|
+
@filter || superclass.filter
|
172
|
+
rescue NoMethodError
|
173
|
+
raise MissingSelector, 'no selector defined'
|
174
|
+
end
|
261
175
|
|
262
|
-
|
263
|
-
|
264
|
-
if superclass.respond_to?(:selector)
|
265
|
-
superclass.selector
|
266
|
-
else
|
267
|
-
raise MissingSelector, 'no selector defined'
|
268
|
-
end
|
269
|
-
end
|
176
|
+
def self.filter?
|
177
|
+
filter rescue false
|
270
178
|
end
|
271
179
|
|
272
|
-
def
|
273
|
-
|
274
|
-
|
180
|
+
def self.selector
|
181
|
+
filter.selector
|
182
|
+
end
|
183
|
+
|
184
|
+
def initialize(node)
|
185
|
+
self.query = node.respond_to?(:call) ? node : -> { node }
|
275
186
|
end
|
276
187
|
|
277
188
|
# Alias for #gone?
|
@@ -345,6 +256,14 @@ module Dill
|
|
345
256
|
has_widget?(:"#{name}_widget")
|
346
257
|
end
|
347
258
|
|
259
|
+
def id
|
260
|
+
root['id']
|
261
|
+
end
|
262
|
+
|
263
|
+
def classes
|
264
|
+
root['class'].split
|
265
|
+
end
|
266
|
+
|
348
267
|
def inspect
|
349
268
|
inspection = "<!-- #{self.class.name}: -->\n"
|
350
269
|
|
@@ -355,7 +274,7 @@ module Dill
|
|
355
274
|
inspection << Nokogiri::XML(xml, &:noblanks).to_xhtml
|
356
275
|
rescue Capybara::NotSupportedByDriverError
|
357
276
|
inspection << "<#{root.tag_name}>\n#{to_s}"
|
358
|
-
rescue
|
277
|
+
rescue Dill::MissingWidget, *page.driver.invalid_element_errors
|
359
278
|
"#<DETACHED>"
|
360
279
|
end
|
361
280
|
end
|
@@ -366,7 +285,11 @@ module Dill
|
|
366
285
|
end
|
367
286
|
|
368
287
|
def root
|
369
|
-
|
288
|
+
query.()
|
289
|
+
rescue Capybara::Ambiguous => e
|
290
|
+
raise wrap_exception(e, AmbiguousWidget)
|
291
|
+
rescue Capybara::ElementNotFound => e
|
292
|
+
raise wrap_exception(e, MissingWidget)
|
370
293
|
end
|
371
294
|
|
372
295
|
def text
|
@@ -400,5 +323,9 @@ module Dill
|
|
400
323
|
def page
|
401
324
|
Capybara.current_session
|
402
325
|
end
|
326
|
+
|
327
|
+
def wrap_exception(e, wrapper_class)
|
328
|
+
wrapper_class.new(e.message).tap { |x| x.set_backtrace e.backtrace }
|
329
|
+
end
|
403
330
|
end
|
404
331
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Dill
|
2
|
+
class Widget
|
3
|
+
class NodeFilter
|
4
|
+
attr_reader :selector
|
5
|
+
|
6
|
+
def initialize(*selector)
|
7
|
+
@selector = selector.flatten
|
8
|
+
end
|
9
|
+
|
10
|
+
def node(parent_widget, *args)
|
11
|
+
parent_widget.root.find(*capybara_selector(*args))
|
12
|
+
end
|
13
|
+
|
14
|
+
def nodes(parent_widget, *args)
|
15
|
+
parent_widget.root.all(*capybara_selector(*args))
|
16
|
+
end
|
17
|
+
|
18
|
+
def query(parent, *args)
|
19
|
+
-> { node(parent, *args) }
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def capybara_selector(*args)
|
25
|
+
# TODO detect signature errors (e.g., passing a different arity than the
|
26
|
+
# one required by the selector proc, etc)
|
27
|
+
if @selector.first.respond_to?(:call)
|
28
|
+
@selector.first.call(*args)
|
29
|
+
else
|
30
|
+
@selector
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,160 +1,183 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.6.0
|
4
|
+
version: 0.7.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Leal
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
14
|
+
name: chronic
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
none: false
|
21
|
-
name: chronic
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
|
-
- -
|
24
|
+
- - '>='
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '0'
|
29
|
-
none: false
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
28
|
+
name: capybara
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
32
30
|
requirements:
|
33
|
-
- -
|
31
|
+
- - '>='
|
34
32
|
- !ruby/object:Gem::Version
|
35
33
|
version: '2.0'
|
36
|
-
none: false
|
37
|
-
name: capybara
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '2.0'
|
45
|
-
none: false
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
48
44
|
requirements:
|
49
|
-
- -
|
45
|
+
- - <
|
50
46
|
- !ruby/object:Gem::Version
|
51
47
|
version: 3.0.0
|
52
|
-
|
53
|
-
name: rspec-given
|
54
|
-
type: :development
|
48
|
+
type: :runtime
|
55
49
|
prerelease: false
|
56
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - <
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: 3.0.0
|
61
|
-
none: false
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
56
|
+
name: rspec-given
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- -
|
59
|
+
- - ~>
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
68
|
-
none: false
|
69
|
-
name: sinatra
|
61
|
+
version: 3.0.0
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
65
|
requirements:
|
74
|
-
- -
|
66
|
+
- - ~>
|
75
67
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
77
|
-
none: false
|
68
|
+
version: 3.0.0
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
70
|
+
name: capybara-webkit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
80
72
|
requirements:
|
81
73
|
- - ~>
|
82
74
|
- !ruby/object:Gem::Version
|
83
75
|
version: 1.0.0
|
84
|
-
none: false
|
85
|
-
name: capybara-webkit
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
79
|
requirements:
|
90
80
|
- - ~>
|
91
81
|
- !ruby/object:Gem::Version
|
92
82
|
version: 1.0.0
|
93
|
-
none: false
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
|
-
|
84
|
+
name: poltergeist
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
96
86
|
requirements:
|
97
87
|
- - ~>
|
98
88
|
- !ruby/object:Gem::Version
|
99
89
|
version: 1.3.0
|
100
|
-
none: false
|
101
|
-
name: poltergeist
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
|
-
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
93
|
requirements:
|
106
94
|
- - ~>
|
107
95
|
- !ruby/object:Gem::Version
|
108
96
|
version: 1.3.0
|
109
|
-
none: false
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
|
-
|
98
|
+
name: cucumber
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
112
100
|
requirements:
|
113
101
|
- - ~>
|
114
102
|
- !ruby/object:Gem::Version
|
115
103
|
version: 1.3.0
|
116
|
-
none: false
|
117
|
-
name: cucumber
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
|
-
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - ~>
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 1.3.0
|
125
|
-
none: false
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
|
-
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - '>='
|
130
116
|
- !ruby/object:Gem::Version
|
131
117
|
version: '0'
|
132
|
-
none: false
|
133
|
-
name: pry
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry-nav
|
136
127
|
requirement: !ruby/object:Gem::Requirement
|
137
128
|
requirements:
|
138
|
-
- -
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
139
137
|
- !ruby/object:Gem::Version
|
140
138
|
version: '0'
|
141
|
-
none: false
|
142
139
|
- !ruby/object:Gem::Dependency
|
140
|
+
name: sinatra
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
143
148
|
version_requirements: !ruby/object:Gem::Requirement
|
144
149
|
requirements:
|
145
|
-
- -
|
150
|
+
- - '>='
|
146
151
|
- !ruby/object:Gem::Version
|
147
152
|
version: '0'
|
148
|
-
|
149
|
-
name:
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ~>
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 4.0.0
|
150
160
|
type: :development
|
151
161
|
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 4.0.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: codeclimate-test-reporter
|
152
169
|
requirement: !ruby/object:Gem::Requirement
|
153
170
|
requirements:
|
154
|
-
- -
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
155
179
|
- !ruby/object:Gem::Version
|
156
180
|
version: '0'
|
157
|
-
none: false
|
158
181
|
description: See https://github.com/mojotech/dill/README.md
|
159
182
|
email:
|
160
183
|
- dleal@mojotech.com
|
@@ -169,6 +192,10 @@ files:
|
|
169
192
|
- lib/dill/cucumber.rb
|
170
193
|
- lib/dill/dsl.rb
|
171
194
|
- lib/dill/instance_conversions.rb
|
195
|
+
- lib/dill/matchers.rb
|
196
|
+
- lib/dill/rails.rb
|
197
|
+
- lib/dill/rails/role.rb
|
198
|
+
- lib/dill/role.rb
|
172
199
|
- lib/dill/text_table.rb
|
173
200
|
- lib/dill/text_table/cell_text.rb
|
174
201
|
- lib/dill/text_table/mapping.rb
|
@@ -180,6 +207,7 @@ files:
|
|
180
207
|
- lib/dill/widgets/base_table.rb
|
181
208
|
- lib/dill/widgets/check_box.rb
|
182
209
|
- lib/dill/widgets/document.rb
|
210
|
+
- lib/dill/widgets/dsl.rb
|
183
211
|
- lib/dill/widgets/field.rb
|
184
212
|
- lib/dill/widgets/field_group.rb
|
185
213
|
- lib/dill/widgets/form.rb
|
@@ -191,32 +219,32 @@ files:
|
|
191
219
|
- lib/dill/widgets/table.rb
|
192
220
|
- lib/dill/widgets/text_field.rb
|
193
221
|
- lib/dill/widgets/widget.rb
|
222
|
+
- lib/dill/widgets/widget/node_filter.rb
|
194
223
|
- lib/dill/widgets/widget_class.rb
|
195
224
|
- lib/dill/widgets/widget_name.rb
|
196
225
|
homepage: https://github.com/mojotech/dill
|
197
226
|
licenses:
|
198
227
|
- MIT
|
228
|
+
metadata: {}
|
199
229
|
post_install_message:
|
200
230
|
rdoc_options: []
|
201
231
|
require_paths:
|
202
232
|
- lib
|
203
233
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
234
|
requirements:
|
205
|
-
- -
|
235
|
+
- - '>='
|
206
236
|
- !ruby/object:Gem::Version
|
207
237
|
version: '0'
|
208
|
-
none: false
|
209
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
239
|
requirements:
|
211
|
-
- -
|
240
|
+
- - '>='
|
212
241
|
- !ruby/object:Gem::Version
|
213
242
|
version: '0'
|
214
|
-
none: false
|
215
243
|
requirements: []
|
216
|
-
rubyforge_project:
|
217
|
-
rubygems_version:
|
244
|
+
rubyforge_project: '[none]'
|
245
|
+
rubygems_version: 2.2.1
|
218
246
|
signing_key:
|
219
|
-
specification_version:
|
247
|
+
specification_version: 4
|
220
248
|
summary: A set of helpers to ease integration testing
|
221
249
|
test_files: []
|
222
250
|
has_rdoc:
|