ule_page 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ require 'singleton'
2
+
3
+ module UlePage
4
+ class PageMap
5
+ include Singleton
6
+
7
+ def initialize
8
+ @map = {}
9
+ end
10
+
11
+ def pages
12
+ @map
13
+ end
14
+ end
15
+ end
@@ -2,7 +2,7 @@ require 'site_prism'
2
2
 
3
3
  module UlePage
4
4
  module SitePrismExtender
5
- include SitePrism::ElementContainer
5
+ include SitePrism::DSL
6
6
  include SitePrism
7
7
 
8
8
  # why define this method?
@@ -10,7 +10,7 @@ module UlePage
10
10
  # I have not found one good method to solve the confliction.
11
11
  def element_collection(collection_name, *find_args)
12
12
  build collection_name, *find_args do
13
- define_method collection_name.to_s do |*runtime_args, &element_block|
13
+ define_method collection_name.to_s do |*_runtime_args, &element_block|
14
14
  self.class.raise_if_block(self, collection_name.to_s, !element_block.nil?)
15
15
  page.all(*find_args)
16
16
  end
@@ -26,15 +26,14 @@ module UlePage
26
26
  attributes = model_class.new.attributes.keys
27
27
 
28
28
  props = attributes if props.empty?
29
- props.map! { |x| x.to_s } unless props.empty?
29
+ props.map!(&:to_s) unless props.empty?
30
30
 
31
31
  attributes.each do |attri|
32
- if props.include? attri
33
- selector = "#"+"#{class_name(model_class)}_#{attri.to_s}"
32
+ next unless props.include? attri
34
33
 
35
- element attri, selector
36
- end
34
+ selector = '#' + "#{class_name(model_class)}_#{attri}"
37
35
 
36
+ element attri, selector
38
37
  end
39
38
  end
40
39
 
@@ -46,14 +45,14 @@ module UlePage
46
45
  attributes = submodel_class.new.attributes.keys
47
46
 
48
47
  props = attributes if props.empty?
49
- props.map! { |x| x.to_s } unless props.empty?
48
+ props.map!(&:to_s) unless props.empty?
50
49
 
51
50
  attributes.each do |attri|
52
- if props.include?(attri)
53
- selector = '#' + "#{class_name(model_class)}_#{class_name(submodel_class)}_attributes_#{attri.to_s}"
51
+ next unless props.include?(attri)
54
52
 
55
- element attri, selector
56
- end
53
+ selector = '#' + "#{class_name(model_class)}_#{class_name(submodel_class)}_attributes_#{attri}"
54
+
55
+ element attri, selector
57
56
  end
58
57
  end
59
58
 
@@ -67,12 +66,11 @@ module UlePage
67
66
  attributes = model_class.new.attributes.keys
68
67
 
69
68
  attributes.each do |attri|
70
- unless excluded_props.include? attri
71
- selector = "#"+attri
72
- # self.class.send "element", attri.to_sym, selector
73
- element attri, selector
74
- end
69
+ next if excluded_props.include? attri
75
70
 
71
+ selector = '#' + attri
72
+ # self.class.send "element", attri.to_sym, selector
73
+ element attri, selector
76
74
  end
77
75
  end
78
76
  end
@@ -1,3 +1,3 @@
1
1
  module UlePage
2
- VERSION = "0.0.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,18 +1,17 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'ule_page/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "ule_page"
6
+ spec.name = 'ule_page'
8
7
  spec.version = UlePage::VERSION
9
- spec.authors = ["Jeremy Cui"]
10
- spec.email = ["tsuijy@gmail.com"]
8
+ spec.authors = ['Jere Cui']
9
+ spec.email = ['tsuijy@gmail.com']
11
10
 
12
- spec.summary = %q{ Page model for cucumber test.}
13
- spec.description = %q{ Based on the siteprism gem, add more page methods.}
14
- spec.homepage = "https://github.com/jerecui/ule_page"
15
- spec.license = "MIT"
11
+ spec.summary = ' Page model for cucumber test.'
12
+ spec.description = ' Based on the siteprism gem, add more page methods and looking for page model via current_path.'
13
+ spec.homepage = 'https://github.com/hongshu/ule_page'
14
+ spec.license = 'MIT'
16
15
 
17
16
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
17
  # delete this section to allow pushing this gem to any host.
@@ -23,33 +22,27 @@ Gem::Specification.new do |spec|
23
22
  # end
24
23
 
25
24
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
25
+ spec.bindir = 'exe'
27
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
27
+ spec.require_paths = ['lib']
29
28
 
30
- spec.add_development_dependency "bundler", "~> 1.11"
31
- spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_development_dependency("activesupport")
29
+ spec.required_ruby_version = '>= 2.5.0'
30
+ spec.platform = Gem::Platform::RUBY
33
31
 
32
+ spec.add_development_dependency 'bundler', '~> 1.11'
33
+ spec.add_development_dependency 'rake', '~> 10.0'
34
34
 
35
- spec.add_dependency("site_prism")
36
- spec.add_dependency("capybara")
37
- spec.add_dependency("capybara-webkit")
38
- spec.add_dependency("rspec", "~> 3.0")
39
- spec.add_dependency("activesupport")
40
- spec.add_dependency("activerecord")
35
+ spec.add_dependency 'activerecord', '> 4.0'
36
+ spec.add_dependency 'activesupport', '> 4.0'
37
+ spec.add_dependency 'capybara', ['>= 2.1', '< 3.0']
38
+ spec.add_dependency 'rspec', '~> 3.0'
39
+ spec.add_dependency 'site_prism', '> 2.1'
41
40
 
42
- spec.add_development_dependency("rails")
43
- spec.add_development_dependency("rspec-rails")
44
-
45
- spec.add_development_dependency("rspec-its", "~> 1.0")
46
- spec.add_development_dependency("cucumber", "~> 1.3.15")
47
- spec.add_development_dependency("simplecov")
48
- # spec.add_development_dependency("aruba")
49
- # spec.add_development_dependency("mocha", ">= 0.12.8")
50
- # spec.add_development_dependency("bourne")
51
- # spec.add_development_dependency("appraisal", "~> 2.1.0")
52
- spec.add_development_dependency("activerecord", ">= 3.0.0")
53
- spec.add_development_dependency("yard")
41
+ spec.add_development_dependency 'rails'
42
+ spec.add_development_dependency 'rspec-rails'
54
43
 
44
+ spec.add_development_dependency 'cucumber', '~> 1.3.15'
45
+ spec.add_development_dependency 'rspec-its', '~> 1.0'
46
+ spec.add_development_dependency 'simplecov'
47
+ spec.add_development_dependency 'yard'
55
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ule_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Jeremy Cui
8
- autorequire:
7
+ - Jere Cui
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,61 +39,53 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: activesupport
42
+ name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
47
+ version: '4.0'
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '4.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: site_prism
56
+ name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ">"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '4.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ">"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '4.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: capybara
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: capybara-webkit
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
75
+ version: '2.1'
76
+ - - "<"
88
77
  - !ruby/object:Gem::Version
89
- version: '0'
78
+ version: '3.0'
90
79
  type: :runtime
91
80
  prerelease: false
92
81
  version_requirements: !ruby/object:Gem::Requirement
93
82
  requirements:
94
83
  - - ">="
95
84
  - !ruby/object:Gem::Version
96
- version: '0'
85
+ version: '2.1'
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
97
89
  - !ruby/object:Gem::Dependency
98
90
  name: rspec
99
91
  requirement: !ruby/object:Gem::Requirement
@@ -109,33 +101,19 @@ dependencies:
109
101
  - !ruby/object:Gem::Version
110
102
  version: '3.0'
111
103
  - !ruby/object:Gem::Dependency
112
- name: activesupport
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
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: activerecord
104
+ name: site_prism
127
105
  requirement: !ruby/object:Gem::Requirement
128
106
  requirements:
129
- - - ">="
107
+ - - ">"
130
108
  - !ruby/object:Gem::Version
131
- version: '0'
109
+ version: '2.1'
132
110
  type: :runtime
133
111
  prerelease: false
134
112
  version_requirements: !ruby/object:Gem::Requirement
135
113
  requirements:
136
- - - ">="
114
+ - - ">"
137
115
  - !ruby/object:Gem::Version
138
- version: '0'
116
+ version: '2.1'
139
117
  - !ruby/object:Gem::Dependency
140
118
  name: rails
141
119
  requirement: !ruby/object:Gem::Requirement
@@ -165,33 +143,33 @@ dependencies:
165
143
  - !ruby/object:Gem::Version
166
144
  version: '0'
167
145
  - !ruby/object:Gem::Dependency
168
- name: rspec-its
146
+ name: cucumber
169
147
  requirement: !ruby/object:Gem::Requirement
170
148
  requirements:
171
149
  - - "~>"
172
150
  - !ruby/object:Gem::Version
173
- version: '1.0'
151
+ version: 1.3.15
174
152
  type: :development
175
153
  prerelease: false
176
154
  version_requirements: !ruby/object:Gem::Requirement
177
155
  requirements:
178
156
  - - "~>"
179
157
  - !ruby/object:Gem::Version
180
- version: '1.0'
158
+ version: 1.3.15
181
159
  - !ruby/object:Gem::Dependency
182
- name: cucumber
160
+ name: rspec-its
183
161
  requirement: !ruby/object:Gem::Requirement
184
162
  requirements:
185
163
  - - "~>"
186
164
  - !ruby/object:Gem::Version
187
- version: 1.3.15
165
+ version: '1.0'
188
166
  type: :development
189
167
  prerelease: false
190
168
  version_requirements: !ruby/object:Gem::Requirement
191
169
  requirements:
192
170
  - - "~>"
193
171
  - !ruby/object:Gem::Version
194
- version: 1.3.15
172
+ version: '1.0'
195
173
  - !ruby/object:Gem::Dependency
196
174
  name: simplecov
197
175
  requirement: !ruby/object:Gem::Requirement
@@ -206,20 +184,6 @@ dependencies:
206
184
  - - ">="
207
185
  - !ruby/object:Gem::Version
208
186
  version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: activerecord
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: 3.0.0
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: 3.0.0
223
187
  - !ruby/object:Gem::Dependency
224
188
  name: yard
225
189
  requirement: !ruby/object:Gem::Requirement
@@ -234,13 +198,15 @@ dependencies:
234
198
  - - ">="
235
199
  - !ruby/object:Gem::Version
236
200
  version: '0'
237
- description: " Based on the siteprism gem, add more page methods."
201
+ description: " Based on the siteprism gem, add more page methods and looking for page
202
+ model via current_path."
238
203
  email:
239
204
  - tsuijy@gmail.com
240
205
  executables: []
241
206
  extensions: []
242
207
  extra_rdoc_files: []
243
208
  files:
209
+ - ".coveralls.yml"
244
210
  - ".gitignore"
245
211
  - ".rspec"
246
212
  - ".travis.yml"
@@ -260,14 +226,15 @@ files:
260
226
  - lib/ule_page/models/detail.rb
261
227
  - lib/ule_page/models/index.rb
262
228
  - lib/ule_page/page.rb
229
+ - lib/ule_page/page_map.rb
263
230
  - lib/ule_page/site_prism_extender.rb
264
231
  - lib/ule_page/version.rb
265
232
  - ule_page.gemspec
266
- homepage: https://github.com/jerecui/ule_page
233
+ homepage: https://github.com/hongshu/ule_page
267
234
  licenses:
268
235
  - MIT
269
236
  metadata: {}
270
- post_install_message:
237
+ post_install_message:
271
238
  rdoc_options: []
272
239
  require_paths:
273
240
  - lib
@@ -275,17 +242,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
242
  requirements:
276
243
  - - ">="
277
244
  - !ruby/object:Gem::Version
278
- version: '0'
245
+ version: 2.5.0
279
246
  required_rubygems_version: !ruby/object:Gem::Requirement
280
247
  requirements:
281
248
  - - ">="
282
249
  - !ruby/object:Gem::Version
283
250
  version: '0'
284
251
  requirements: []
285
- rubyforge_project:
286
- rubygems_version: 2.5.1
287
- signing_key:
252
+ rubyforge_project:
253
+ rubygems_version: 2.7.7
254
+ signing_key:
288
255
  specification_version: 4
289
256
  summary: Page model for cucumber test.
290
257
  test_files: []
291
- has_rdoc: