capybara-page-object 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.travis.yml +5 -0
  2. data/Gemfile +8 -9
  3. data/Gemfile.lock +27 -17
  4. data/README.markdown +32 -12
  5. data/Rakefile +0 -7
  6. data/VERSION +1 -1
  7. data/capybara-page-object.gemspec +41 -34
  8. data/lib/capybara-page-object.rb +12 -11
  9. data/lib/capybara-page-object/collections.rb +4 -0
  10. data/lib/capybara-page-object/component.rb +5 -0
  11. data/lib/{delegators.rb → capybara-page-object/delegators.rb} +0 -0
  12. data/lib/capybara-page-object/element.rb +6 -0
  13. data/lib/capybara-page-object/elements.rb +15 -0
  14. data/lib/capybara-page-object/elements/anchor.rb +6 -0
  15. data/lib/{element → capybara-page-object/elements}/form.rb +8 -16
  16. data/lib/capybara-page-object/elements/form_field.rb +10 -0
  17. data/lib/capybara-page-object/elements/head.rb +7 -0
  18. data/lib/capybara-page-object/elements/image.rb +7 -0
  19. data/lib/{element → capybara-page-object/elements}/input.rb +5 -2
  20. data/lib/{element → capybara-page-object/elements}/list.rb +1 -1
  21. data/lib/{element → capybara-page-object/elements}/list_item.rb +1 -1
  22. data/lib/capybara-page-object/elements/meta.rb +6 -0
  23. data/lib/{element → capybara-page-object/elements}/select.rb +0 -0
  24. data/lib/{element → capybara-page-object/elements}/table.rb +1 -1
  25. data/lib/capybara-page-object/elements/table_header.rb +4 -0
  26. data/lib/{element → capybara-page-object/elements}/table_row.rb +1 -1
  27. data/lib/{element → capybara-page-object/elements}/text_based_input.rb +0 -0
  28. data/lib/{element → capybara-page-object/elements}/textarea.rb +1 -3
  29. data/lib/capybara-page-object/extensions/capybara.rb +7 -0
  30. data/lib/capybara-page-object/extensions/enumerable.rb +10 -0
  31. data/lib/{html5_data.rb → capybara-page-object/html5_data.rb} +0 -0
  32. data/lib/{key_value.rb → capybara-page-object/key_value.rb} +0 -0
  33. data/lib/{node.rb → capybara-page-object/node.rb} +14 -10
  34. data/lib/capybara-page-object/page.rb +77 -0
  35. data/spec/common_spec.rb +6 -6
  36. data/spec/element/anchor_spec.rb +8 -3
  37. data/spec/element/form_field_spec.rb +7 -1
  38. data/spec/element/form_spec.rb +27 -17
  39. data/spec/helper.rb +13 -0
  40. data/spec/node_spec.rb +9 -0
  41. data/spec/page_spec.rb +90 -30
  42. metadata +58 -43
  43. data/lib/collections.rb +0 -17
  44. data/lib/element.rb +0 -14
  45. data/lib/element/TODO.md +0 -11
  46. data/lib/element/anchor.rb +0 -7
  47. data/lib/element/form_field.rb +0 -15
  48. data/lib/element/head.rb +0 -15
  49. data/lib/element/image.rb +0 -15
  50. data/lib/element/meta.rb +0 -11
  51. data/lib/element/table_header.rb +0 -4
  52. data/lib/page.rb +0 -40
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-page-object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-08 00:00:00.000000000Z
12
+ date: 2012-04-22 00:00:00.000000000Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &2170430100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2170430100
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: capybara
16
- requirement: &2157133000 !ruby/object:Gem::Requirement
27
+ requirement: &2170421860 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ! '>='
@@ -21,32 +32,32 @@ dependencies:
21
32
  version: '0'
22
33
  type: :runtime
23
34
  prerelease: false
24
- version_requirements: *2157133000
35
+ version_requirements: *2170421860
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: bundler
27
- requirement: &2157129760 !ruby/object:Gem::Requirement
38
+ requirement: &2170421320 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ~>
31
42
  - !ruby/object:Gem::Version
32
- version: 1.0.0
43
+ version: 1.1.0
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *2157129760
46
+ version_requirements: *2170421320
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: jeweler
38
- requirement: &2157127200 !ruby/object:Gem::Requirement
49
+ requirement: &2170420800 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
42
53
  - !ruby/object:Gem::Version
43
- version: 1.6.4
54
+ version: 1.8.3
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *2157127200
57
+ version_requirements: *2170420800
47
58
  - !ruby/object:Gem::Dependency
48
- name: rcov
49
- requirement: &2157125680 !ruby/object:Gem::Requirement
59
+ name: simplecov
60
+ requirement: &2170420200 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *2157125680
68
+ version_requirements: *2170420200
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rspec
60
- requirement: &2157121880 !ruby/object:Gem::Requirement
71
+ requirement: &2170419660 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *2157121880
79
+ version_requirements: *2170419660
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: rake
71
- requirement: &2157115040 !ruby/object:Gem::Requirement
82
+ requirement: &2170419140 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 0.9.2.2
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *2157115040
90
+ version_requirements: *2170419140
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: rdoc
82
- requirement: &2157113260 !ruby/object:Gem::Requirement
93
+ requirement: &2170418620 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,7 +98,7 @@ dependencies:
87
98
  version: '3.12'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *2157113260
101
+ version_requirements: *2170418620
91
102
  description: Page Objects for Capybara
92
103
  email: andy@andywaite.com
93
104
  executables: []
@@ -97,6 +108,7 @@ extra_rdoc_files:
97
108
  - README.markdown
98
109
  files:
99
110
  - .document
111
+ - .travis.yml
100
112
  - Gemfile
101
113
  - Gemfile.lock
102
114
  - LICENSE.txt
@@ -105,29 +117,32 @@ files:
105
117
  - VERSION
106
118
  - capybara-page-object.gemspec
107
119
  - lib/capybara-page-object.rb
108
- - lib/collections.rb
109
- - lib/delegators.rb
110
- - lib/element.rb
111
- - lib/element/TODO.md
112
- - lib/element/anchor.rb
113
- - lib/element/form.rb
114
- - lib/element/form_field.rb
115
- - lib/element/head.rb
116
- - lib/element/image.rb
117
- - lib/element/input.rb
118
- - lib/element/list.rb
119
- - lib/element/list_item.rb
120
- - lib/element/meta.rb
121
- - lib/element/select.rb
122
- - lib/element/table.rb
123
- - lib/element/table_header.rb
124
- - lib/element/table_row.rb
125
- - lib/element/text_based_input.rb
126
- - lib/element/textarea.rb
127
- - lib/html5_data.rb
128
- - lib/key_value.rb
129
- - lib/node.rb
130
- - lib/page.rb
120
+ - lib/capybara-page-object/collections.rb
121
+ - lib/capybara-page-object/component.rb
122
+ - lib/capybara-page-object/delegators.rb
123
+ - lib/capybara-page-object/element.rb
124
+ - lib/capybara-page-object/elements.rb
125
+ - lib/capybara-page-object/elements/anchor.rb
126
+ - lib/capybara-page-object/elements/form.rb
127
+ - lib/capybara-page-object/elements/form_field.rb
128
+ - lib/capybara-page-object/elements/head.rb
129
+ - lib/capybara-page-object/elements/image.rb
130
+ - lib/capybara-page-object/elements/input.rb
131
+ - lib/capybara-page-object/elements/list.rb
132
+ - lib/capybara-page-object/elements/list_item.rb
133
+ - lib/capybara-page-object/elements/meta.rb
134
+ - lib/capybara-page-object/elements/select.rb
135
+ - lib/capybara-page-object/elements/table.rb
136
+ - lib/capybara-page-object/elements/table_header.rb
137
+ - lib/capybara-page-object/elements/table_row.rb
138
+ - lib/capybara-page-object/elements/text_based_input.rb
139
+ - lib/capybara-page-object/elements/textarea.rb
140
+ - lib/capybara-page-object/extensions/capybara.rb
141
+ - lib/capybara-page-object/extensions/enumerable.rb
142
+ - lib/capybara-page-object/html5_data.rb
143
+ - lib/capybara-page-object/key_value.rb
144
+ - lib/capybara-page-object/node.rb
145
+ - lib/capybara-page-object/page.rb
131
146
  - spec/common_spec.rb
132
147
  - spec/element/anchor_spec.rb
133
148
  - spec/element/base_spec.rb
@@ -162,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
177
  version: '0'
163
178
  segments:
164
179
  - 0
165
- hash: 4238477011080542478
180
+ hash: 2995033654392698381
166
181
  required_rubygems_version: !ruby/object:Gem::Requirement
167
182
  none: false
168
183
  requirements:
data/lib/collections.rb DELETED
@@ -1,17 +0,0 @@
1
- module CapybaraPageObject
2
- module Collections
3
- def tables
4
- all('table').each_with_object({}) do |e, hash|
5
- t = CapybaraPageObject::Table.new(e)
6
- hash[t.key] = t
7
- end
8
- end
9
-
10
- def forms
11
- all('form').each_with_object({}) do |e, hash|
12
- f = CapybaraPageObject::Form.new(e)
13
- hash[f.key] = f
14
- end
15
- end
16
- end
17
- end
data/lib/element.rb DELETED
@@ -1,14 +0,0 @@
1
- require 'element/anchor'
2
- require 'element/form'
3
- require 'element/image'
4
- require 'element/form_field'
5
- require 'element/head'
6
- require 'element/input'
7
- require 'element/list'
8
- require 'element/list_item'
9
- require 'element/meta'
10
- require 'element/select'
11
- require 'element/table'
12
- require 'element/table_row'
13
- require 'element/table_header'
14
- require 'element/textarea'
data/lib/element/TODO.md DELETED
@@ -1,11 +0,0 @@
1
- ## Planned Functionality ##
2
-
3
- * Support write access to form fields
4
-
5
- ## Testing ##
6
-
7
- * Add missing specs for table_row, table_header
8
-
9
- ## Tags Not Yet Supported ##
10
-
11
- * dl (dt/dd)
@@ -1,7 +0,0 @@
1
- module CapybaraPageObject
2
- class Anchor < CapybaraPageObject::Node
3
- def link
4
- URI(source[:href])
5
- end
6
- end
7
- end
@@ -1,15 +0,0 @@
1
- module CapybaraPageObject
2
- class FormField < CapybaraPageObject::Node
3
- def key
4
- source[:name]
5
- end
6
-
7
- def value
8
- source.value
9
- end
10
-
11
- def blank?
12
- value.nil? || '' == value
13
- end
14
- end
15
- end
data/lib/element/head.rb DELETED
@@ -1,15 +0,0 @@
1
- module CapybaraPageObject
2
- class Head < CapybaraPageObject::Node
3
- def title
4
- find('title').text
5
- end
6
-
7
- def meta_description
8
- find('meta[@name="description"]')['content']
9
- end
10
-
11
- def meta_keywords
12
- find('meta[@name="keywords"]')['content'].split(',').collect(&:strip)
13
- end
14
- end
15
- end
data/lib/element/image.rb DELETED
@@ -1,15 +0,0 @@
1
- module CapybaraPageObject
2
- class Image < CapybaraPageObject::Node
3
- def key
4
- alt
5
- end
6
-
7
- def value
8
- URI(source[:src])
9
- end
10
-
11
- def alt
12
- source[:alt].strip
13
- end
14
- end
15
- end
data/lib/element/meta.rb DELETED
@@ -1,11 +0,0 @@
1
- module CapybaraPageObject
2
- class Meta < CapybaraPageObject::Node
3
- def key
4
- source[:name]
5
- end
6
-
7
- def value
8
- source[:content]
9
- end
10
- end
11
- end
@@ -1,4 +0,0 @@
1
- module CapybaraPageObject
2
- class TableHeader < CapybaraPageObject::Node
3
- end
4
- end
data/lib/page.rb DELETED
@@ -1,40 +0,0 @@
1
- module CapybaraPageObject
2
- class Page < CapybaraPageObject::Node
3
-
4
- def initialize(attr={}, source=nil)
5
- super(source)
6
- @attr = attr
7
- visit
8
- self
9
- end
10
-
11
- def path(*args)
12
- raise MissingPath, "You need to override #path in #{self.class}"
13
- end
14
-
15
- def refresh
16
- visit
17
- end
18
-
19
- def prefix
20
- ''
21
- end
22
-
23
- private
24
-
25
- def visit
26
- target = prefix + path
27
- if @attr
28
- pairs = []
29
- @attr.each do |k, v|
30
- pairs << "#{k}=#{v}"
31
- end
32
- target += '?' + pairs.join('&') if pairs.any?
33
- end
34
- if target == source.current_path
35
- raise "Detected repeat of page load - use #reload instead"
36
- end
37
- source.visit target
38
- end
39
- end
40
- end