test-factory 0.1.11 → 0.2.0
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/README.md +1 -1
- data/lib/test-factory/data_factory.rb +29 -6
- data/lib/test-factory/foundry.rb +1 -1
- data/test-factory-0.1.11.gem +0 -0
- data/test-factory.gemspec +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -206,7 +206,7 @@ follow them probably [smells](http://en.wikipedia.org/wiki/Code_smell), and shou
|
|
206
206
|
|
207
207
|
```
|
208
208
|
|
209
|
-
* Updates to a data object's instance variables
|
209
|
+
* Updates to a data object's instance variables are handled *only* by the `set_options` method, *not* explicitly.
|
210
210
|
|
211
211
|
```ruby
|
212
212
|
# This is good
|
@@ -39,21 +39,44 @@ module DataFactory
|
|
39
39
|
|
40
40
|
# Use this method in your data object class for select list boxes that will have
|
41
41
|
# default values you may be interested in. The method will either set the select
|
42
|
-
# box to the value specified, or, if no value exists for the given variable in your
|
42
|
+
# box to the value specified, or, if no value exists for the given instance variable in your
|
43
43
|
# data object, it will get the value from the UI and set the data object's
|
44
44
|
# variable to that value. Note that this only supports select lists that allow
|
45
45
|
# a single selection.
|
46
|
-
# @param
|
46
|
+
# @param inst_var_sym [Symbol] A Symbol that _must_ match the instance variable that will either be set or be used to update the page
|
47
47
|
# @param select_list [Watir::Select] The relevant select list element on the page
|
48
48
|
#
|
49
49
|
# @example
|
50
50
|
#
|
51
|
-
#
|
52
|
-
def get_or_select(
|
53
|
-
|
51
|
+
# get_or_select! :@num_resubmissions, page.num_resubmissions
|
52
|
+
def get_or_select!(inst_var_sym, select_list)
|
53
|
+
value = instance_variable_get inst_var_sym
|
54
|
+
if value==nil
|
55
|
+
instance_variable_set inst_var_sym, select_list.selected_options[0].text
|
56
|
+
else
|
57
|
+
select_list.select value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# This method accomplishes the same thing as #get_or_select! but
|
62
|
+
# is used specifically when the instance variable being used/updated
|
63
|
+
# is a Hash. Pay close attention to the syntax differences between
|
64
|
+
# this method and @get_or_select!
|
65
|
+
#
|
66
|
+
# First, note that the returned value of this method must be
|
67
|
+
# passed to the relevant key in the Hash. Note also that unlike
|
68
|
+
# #get_or_select!, this method does not take a symbol representation
|
69
|
+
# of the instance variable.
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
#
|
73
|
+
# @open[:day] = get_or_select(@open[:day], page.open_day)
|
74
|
+
def get_or_select(hash_inst_var, select_list)
|
75
|
+
if hash_inst_var==nil
|
54
76
|
select_list.selected_options[0].text
|
55
77
|
else
|
56
|
-
select_list.select
|
78
|
+
select_list.select hash_inst_var
|
79
|
+
hash_inst_var
|
57
80
|
end
|
58
81
|
end
|
59
82
|
|
data/lib/test-factory/foundry.rb
CHANGED
@@ -36,7 +36,7 @@ module Foundry
|
|
36
36
|
# requires that your data object classes properly follow the design
|
37
37
|
# pattern and have a #create method available.
|
38
38
|
def create data_object_class, opts={}
|
39
|
-
data_object = make data_object_class, opts
|
39
|
+
data_object = make data_object_class, opts
|
40
40
|
data_object.create
|
41
41
|
data_object
|
42
42
|
end
|
Binary file
|
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.
|
3
|
+
s.version = '0.2.0'
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/test-factory/string_factory.rb
|
48
48
|
- lib/test-factory.rb
|
49
49
|
- README.md
|
50
|
+
- test-factory-0.1.11.gem
|
50
51
|
- test-factory.gemspec
|
51
52
|
homepage: https://github.com/rSmart
|
52
53
|
licenses: []
|