test-factory 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODQ2MDNiODE1ZWVlMTEyNDBiNWYxMzUyOGU5ZjczNjM5MGNjNjExYQ==
4
+ OGYwODM3ZDNiZjhjYTFiZjBiNDYxZjU0M2ZiNTljYTJkZmNiZjJhOA==
5
5
  data.tar.gz: !binary |-
6
- ZTc3YmZiMzBiY2E4ZDFiZmI0N2I4MjFjMTE5MDNkY2I3NTk2NzI0Mw==
6
+ ZThmZjAwOGNkN2IyODI2NTcxMjIyZjVkOGY5NGVmZWY4ZmE4ZDJmZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2M2NTBiNjYyM2U2ZTdkMWNlYTdjNDBlYjM3ODVmMjNiMTA2NWNlODQ3MzFi
10
- NGFmNGE1Y2ZiNDI0ZjA1OGNjMzFiMjBkMmQxNWUxNTRlOTBmNDAwZDJmN2I4
11
- YzJiYmU5ZjZiOTdjYTE2MDEwZTUwOTFlNmE3OTM5YzI4YzBiMjE=
9
+ MDk2Y2M4NDUzNjFmZjkwMjE4OWM1OWJiZThlZWJjZTUzZWY5ZTJkYTcwZTQx
10
+ NzllNjY0OGU1NTg0YTQyNWI3NTQ5YzE5MmRlNjQxMDBjYzhkOTc4OTUzYTNm
11
+ NzY4MjUyYTlkMjNkOTNhNGYwMGZjOTg4YjkzMWNkMzdhNGMzMzk=
12
12
  data.tar.gz: !binary |-
13
- OTBkZjAzN2I5ZDQwOWQ2ZDQ5ZDM2ZDkwMGExYmZkM2ViMGZhOWJhMDA1MmU1
14
- NDc1NGFlNzZlNTMwMDc1OWJhYmVlYTIxYTllOWM1M2IwM2MzMGFlYjdjN2Uw
15
- NDM0Mjc1NzcyMWNlNmIxMDQ0ZWIxMDU5ZDRjYjkxMDBiY2ZkOWE=
13
+ OGFkNDdiMzI5NmU0NDQ1ZGIxMDdhYjMxZDViM2I1Y2RkZDU2ZmU0NDk5NDVl
14
+ Njg0ZGQ1NzVjMWE3OTgxOTNiOTAwZTY2YjQwMzE3NTNkMzVmNTMwMjM3Njdk
15
+ NjA4MmI1NDQxZjc0MWUwZTEwZDQ4YjMxZmRkOWU0MTFiODA4ZTc=
@@ -154,6 +154,34 @@ module DataFactory
154
154
  f_o_i false, name, page, *fields
155
155
  end
156
156
 
157
+ # Equivalent to #ordered_fill, except that it's used
158
+ # in the context of a Data Object's #edit method(s). As such, it
159
+ # requires the #edit method's hash to be passed as its own
160
+ # first parameter.
161
+ #
162
+ # @example
163
+ # on PageClass do |page|
164
+ # edit_fields opts, page, :text_field_name, :radio_name, :select_list_name, :checkbox_name
165
+ # end
166
+ #
167
+ def edit_fields(opts, page, *fields)
168
+ edit_item_fields opts, nil, page, *fields
169
+ end
170
+
171
+ # Equivalent to #ordered_item_fill, except that it's used
172
+ # in the context of a Data Object's #edit method(s). As such, it
173
+ # requires the #edit method's hash to be passed as its own
174
+ # first parameter.
175
+ #
176
+ # @example
177
+ # on PageClass do |page|
178
+ # edit_item_fields opts, 'Joe Schmoe', page, :text_field_name, :radio_name, :select_list_name, :checkbox_name
179
+ # end
180
+ #
181
+ def edit_item_fields(opts, name, page, *fields)
182
+ parse_fields(opts, name, page, *fields)
183
+ end
184
+
157
185
  # This is a specialized method for use with any select list boxes
158
186
  # that exist in the site you're testing and will contain
159
187
  # unpredictable default values.
@@ -233,9 +261,15 @@ module DataFactory
233
261
  #
234
262
  def f_o_i(shuffle, name, page, *fields)
235
263
  shuffle ? fields.shuffle! : fields
264
+ parse_fields(nil, name, page, *fields)
265
+ end
266
+
267
+ # Do not use this method directly.
268
+ #
269
+ def parse_fields(opts, name, page, fields)
236
270
  fields.each do |field|
237
271
  lmnt = page.send(*[field, name].compact)
238
- var = instance_variable_get "@#{field}"
272
+ var = opts.nil? ? instance_variable_get("@#{field}") : opts[field]
239
273
  lmnt.class.to_s == 'Watir::Select' ? lmnt.pick!(var) : lmnt.fit(var)
240
274
  end
241
275
  end
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # The Superclass for all of your data objects.
16
- class DataObject
16
+ class DataObjectFactory
17
17
 
18
18
  include Foundry
19
19
  include DataFactory
@@ -47,4 +47,7 @@ class DataObject
47
47
  self.class.new(@browser, opts)
48
48
  end
49
49
 
50
- end
50
+ end
51
+
52
+ # Empty alias class
53
+ class DataObject < DataObjectFactory; end
data/test-factory.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'test-factory'
3
- s.version = '0.4.0'
3
+ s.version = '0.4.1'
4
4
  s.summary = %q{rSmart's framework for creating automated testing scripts}
5
5
  s.description = %q{This gem provides a set of modules and methods to help quickly and DRYly create a test automation framework using Ruby and Watir (or watir-webdriver).}
6
6
  s.files = Dir.glob("**/**/**")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abraham Heward
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-06 00:00:00.000000000 Z
11
+ date: 2013-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver