test-factory 0.1.5 → 0.1.6

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- test-factory (0.1.5)
4
+ test-factory (0.1.6)
5
5
  watir-webdriver (>= 0.6.1)
6
6
 
7
7
  GEM
@@ -20,7 +20,7 @@ module Foundry
20
20
  block.call @current_page if block
21
21
  @current_page
22
22
  end
23
- alias on_page on
23
+ alias_method :on_page, :on
24
24
 
25
25
  # Use this for making a data object in your test steps
26
26
  #
@@ -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
@@ -14,17 +14,89 @@
14
14
  # Proper use of the #fit method requires following a particular coding
15
15
  # pattern, however:
16
16
  #
17
- # 1) In your Page Classes, define your radio buttons and checkboxes
18
- # directly. Do not define #set and/or #clear actions there.
19
- # 2) Your data object's instance variables for radio buttons and
20
- # checkboxes should have the values of :set or :clear. If they NEED to be
21
- # something else, then define a Hash transform method to easily
22
- # convert the custom values back to :set or :clear, then pass that
23
- # transform to the #fit method.
24
- # 3) Always remember to end your #edit methods with the #set_options()
25
- # method, from the DataFactory module. It automatically takes care
26
- # of updating your data object's instance variables with any
27
- # new values.
17
+ # 1. In your Page Classes, define your radio buttons and checkboxes
18
+ # directly. Do not define #set and/or #clear actions there.
19
+ # 2. Your data object's instance variables for radio buttons and
20
+ # checkboxes should have the values of +:set+ or +:clear+. If they *need* to be
21
+ # something else, then define a Hash transform method to easily
22
+ # convert the custom values back to +:set+ or +:clear+, then pass that
23
+ # transform to the #fit method.
24
+ # 3. Always remember to end your #edit methods with the #set_options()
25
+ # method, from the DataFactory module. It automatically takes care
26
+ # of updating your data object's instance variables with any
27
+ # new values.
28
+ #
29
+ # ==Example
30
+ #
31
+ # Let's take a look at how the proper use of #fit in your code can significantly
32
+ # clean things up.
33
+ #
34
+ # First, here's some code written without using #fit, and using
35
+ # actions for the checkbox page objects, and a Data Object
36
+ # instance variable that is either "YES" or "NO"...
37
+ #
38
+ # class MyPage < BasePage
39
+ # # ...
40
+ # action(:check_checkbox) { |b| b.checkbox(id: "checkbox").set }
41
+ # action(:clear_checkbox) { |b| b.checkbox(id: "checkbox").clear }
42
+ # # ...
43
+ # end
44
+ #
45
+ # class DataObject
46
+ # # ...
47
+ # def edit opts={}
48
+ # # ...
49
+ # if opts[:option] != @option
50
+ # on MyPage do |page|
51
+ # if opts[:option] == "NO"
52
+ # page.clear_checkbox
53
+ # else
54
+ # page.check_checkbox
55
+ # end
56
+ # end
57
+ # @option = opts[:option]
58
+ # end
59
+ # # ...
60
+ # end
61
+ # # ...
62
+ # end
63
+ #
64
+ # Now, let's take that same code, but this time use the #fit method, set up
65
+ # the data object's instance variable correctly as +:set+ or +:clear+, and
66
+ # end the #edit with #set_options ...
67
+ #
68
+ # class MyPage < BasePage
69
+ # # ...
70
+ # element(:checkbox) { |b| b.checkbox(id: "checkbox") }
71
+ # # ...
72
+ # end
73
+ #
74
+ # class DataObject
75
+ # # ...
76
+ # def edit opts={}
77
+ # # ...
78
+ # on MyPage do |page|
79
+ # # ...
80
+ # page.checkbox.fit opts[:option]
81
+ # # ...
82
+ # end
83
+ # # ...
84
+ # update_options opts
85
+ # end
86
+ # # ...
87
+ # end
88
+ #
89
+ # If you absolutely _must_ have your data object's instance variable be something
90
+ # other than +:set+ or +:clear+, then consider writing private a "transform" method
91
+ # in your data object class, like this:
92
+ #
93
+ # def checkbox_trans
94
+ # { "YES" => :set, "NO" => :clear }
95
+ # end
96
+ #
97
+ # Then use that transform with your #fit method, like this:
98
+ #
99
+ # page.checkbox.fit checkbox_trans[opts[:option]]
28
100
  #
29
101
  module Watir
30
102
  module UserEditable
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.1.5'
3
+ s.version = '0.1.6'
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.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: