screengem 0.10.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ec41ff74a250109543e742c6ecd2a0ca79d1d1e9f3f7bdb14eca7ffc8c992d0
4
- data.tar.gz: deb4e91553f86e93053b00cd4e9563ca6b33fd9615c4786958e2c18edbb1cd19
3
+ metadata.gz: 2bb54d35b1502539350c3381b79da394fd82e2eb2857f034d2434491f2c4e61b
4
+ data.tar.gz: 4afaca0e2dd7978acb5b8eae44fb94e8d9e875a7fb543d4a6cead41ddf65330b
5
5
  SHA512:
6
- metadata.gz: 5ee82906dcdec034c242ed77982d894ce7f03c3981566871be379d6259a8b63eff0bc4386976d27c41633314b66e254393eb463d6a4c80b5e08192ef51552027
7
- data.tar.gz: 90723b078fe87cb3a4ce29bd744b8337c5e6eb6724b0ce6cbee143cab6fb85969720f760211e1f838a298688150019c84f356686786a9ce966d7520a1a415e21
6
+ metadata.gz: 66ba5384906e5346b9bf60a60499a0f0813adc4a686c3033dbb88cea7ac5ca0c385b77fac58e25451ef1ff53df0c89701b9e50ed74f62947e7ca5e883603418d
7
+ data.tar.gz: 3042e522c6dd5474e3802cbdba1a3fadde37478b52ce2251640848ed4b5c2d5e65b41d7a8b67cd7f901b12ed7ffccc5ef70c549a8c946016f6242141d4327a99
data/.rubocop.yml CHANGED
@@ -1,20 +1,44 @@
1
1
  require: rubocop-rspec
2
2
 
3
+ AllCops:
4
+ NewCops: enable
5
+ TargetRubyVersion: 2.7
6
+
7
+ Gemspec/RequireMFA:
8
+ Enabled: false
9
+
10
+ Lint/ConstantDefinitionInBlock:
11
+ Exclude:
12
+ - spec/**/*_spec.rb
13
+
14
+ Layout/LineLength:
15
+ Max: 120
16
+
17
+ Layout/SpaceAroundMethodCallOperator:
18
+ Enabled: false
19
+
20
+ Lint/RaiseException:
21
+ Enabled: false
22
+
23
+ Lint/StructNewOverride:
24
+ Enabled: false
25
+
3
26
  Metrics/AbcSize:
4
27
  Enabled: false
5
28
 
6
29
  Metrics/BlockLength:
7
30
  Enabled: false
8
31
 
9
- Metrics/LineLength:
10
- Max: 120
11
-
12
32
  Metrics/MethodLength:
13
33
  Enabled: false
14
34
 
15
35
  Metrics/ModuleLength:
16
36
  Enabled: false
17
37
 
38
+ Naming/VariableNumber:
39
+ Enabled: true
40
+ EnforcedStyle: snake_case
41
+
18
42
  RSpec/AnyInstance:
19
43
  Enabled: false
20
44
 
@@ -24,6 +48,9 @@ RSpec/DescribedClass:
24
48
  RSpec/ExampleLength:
25
49
  Max: 20
26
50
 
51
+ RSpec/MultipleMemoizedHelpers:
52
+ Max: 8
53
+
27
54
  RSpec/MultipleExpectations:
28
55
  Max: 5
29
56
 
@@ -36,9 +63,24 @@ RSpec/MessageSpies:
36
63
  RSpec/NotToNot:
37
64
  EnforcedStyle: to_not
38
65
 
66
+ Style/ExponentialNotation:
67
+ Enabled: false
68
+
69
+ Style/HashEachMethods:
70
+ Enabled: false
71
+
72
+ Style/HashTransformKeys:
73
+ Enabled: false
74
+
75
+ Style/HashTransformValues:
76
+ Enabled: false
77
+
39
78
  Style/Documentation:
40
79
  Enabled: false
41
80
 
81
+ Style/DocumentDynamicEvalDefinition:
82
+ Enabled: false
83
+
42
84
  Style/EmptyMethod:
43
85
  Enabled: false
44
86
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.7.4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.14.0 (2022-01-06)
6
+
7
+ * Update the thor dependency
8
+ * Latest development dependencies
9
+
10
+ ## 0.13.0 (2021-06-13)
11
+
12
+ * Relax the ActiveSupport dependency
13
+ * Latest development dependencies
14
+
15
+ ## 0.12.0 (2021-01-27)
16
+
17
+ * Relax the thor dependency
18
+ * Latest development dependencies
19
+
20
+ ## 0.11.0 (2020-04-26)
21
+
22
+ ### Breaking Changes
23
+
24
+ * Questions answer negatively by throwing an exception rather than returning false
25
+
26
+ ## 0.10.1 (2020-01-11)
27
+
28
+ * Relax the thor dependency
29
+
5
30
  ## 0.10.0 (2020-01-11)
6
31
 
7
32
  * Remove action abstraction
data/README.md CHANGED
@@ -30,9 +30,8 @@ A Task responds to perform.
30
30
 
31
31
  ## Actor Memory
32
32
 
33
- Actors are able to remember and recall facts. This is the recommended way to
34
- pass state between steps. To clear all actor's memory before each scenario
35
- add a hook:
33
+ Actors are able to remember and recall facts. This is the recommended way to pass state
34
+ between steps. To clear every actor's memory before each scenario add a hook:
36
35
 
37
36
  ```
38
37
  Before do
@@ -40,6 +39,20 @@ Before do
40
39
  end
41
40
  ```
42
41
 
42
+ ## Performing Tasks
43
+
44
+ Actors are able to perform tasks. A task may be implemented by interacting with domain services,
45
+ domain models, application databases, and the application via screen elements.
46
+
47
+ Capybara is available to all screen elements and is the recommended way to interact with a browser.
48
+
49
+ ## Answering Questions
50
+
51
+ Actors are able to answer questions. A question is considered to be answered affirmatively
52
+ when no exception is thrown and negatively when an exception is thrown.
53
+
54
+ [RSpec expectations](https://github.com/rspec/rspec-expectations) are available in all questions and are the recommended way to implement a question.
55
+
43
56
  ## Dampening
44
57
 
45
58
  It sometimes makes sense to slow down the automation. This is known as dampening.
@@ -18,11 +18,7 @@ module Screengem
18
18
  #
19
19
  def asks(*questions)
20
20
  questions.each do |question|
21
- question.configure(self, screen)
22
-
23
- next if question.answer
24
-
25
- raise incorrect_answer(question)
21
+ question.configure(self, screen).answer
26
22
  end
27
23
 
28
24
  self
@@ -33,9 +29,7 @@ module Screengem
33
29
  #
34
30
  def performs(*tasks)
35
31
  tasks.each do |task|
36
- task.configure(self, screen)
37
-
38
- task.perform
32
+ task.configure(self, screen).perform
39
33
  end
40
34
 
41
35
  self
@@ -68,10 +62,6 @@ module Screengem
68
62
 
69
63
  private
70
64
 
71
- def incorrect_answer(question)
72
- Screengem::IncorrectAnswer.new(question)
73
- end
74
-
75
65
  def recollections
76
66
  ActorMemory.instance.recollections(self)
77
67
  end
@@ -6,7 +6,7 @@ module Screengem
6
6
  class QuestionFactory < BasicObject
7
7
  include ::Singleton
8
8
 
9
- def method_missing(question_name, *args) # rubocop:disable Style/MethodMissingSuper
9
+ def method_missing(question_name, *args)
10
10
  question_class_name = "#{question_name}_question".camelize
11
11
  question_class = "#{question_scope}::#{question_class_name}".constantize
12
12
 
@@ -6,7 +6,7 @@ module Screengem
6
6
  class TaskFactory < BasicObject
7
7
  include ::Singleton
8
8
 
9
- def method_missing(task_name, *args) # rubocop:disable Style/MethodMissingSuper
9
+ def method_missing(task_name, *args)
10
10
  task_class_name = "#{task_name}_task".camelize
11
11
  task_class = "#{task_scope}::#{task_class_name}".constantize
12
12
 
@@ -22,11 +22,10 @@ module Screengem
22
22
  generated_method_names = []
23
23
 
24
24
  Screengem::ScreenElement.descendants.each do |screen_element_class|
25
- class_name = screen_element_class.name
26
-
27
25
  # Skip any anonymous classes. We can't do anything with them. Probably they're from testing.
28
- next if class_name.blank?
26
+ next if screen_element_class.anonymous?
29
27
 
28
+ class_name = screen_element_class.name
30
29
  method_name = class_name.demodulize.underscore
31
30
 
32
31
  # Create some safety by detecting and failing fast for duplicate creation method names.
@@ -1,3 +1,3 @@
1
1
  module Screengem
2
- VERSION = "0.10.1"
2
+ VERSION = "0.14.0"
3
3
  end
data/lib/screengem.rb CHANGED
@@ -8,7 +8,6 @@ require "capybara/dsl"
8
8
  require "rspec/expectations"
9
9
 
10
10
  require "screengem/automatic_visit"
11
- require "screengem/incorrect_answer"
12
11
  require "screengem/rails_routes"
13
12
  require "screengem/screen_element"
14
13
  require "screengem/screengem_error"
data/screengem.gemspec CHANGED
@@ -27,18 +27,19 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = "exe"
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
- spec.required_ruby_version = "~> 2.5"
30
+ spec.required_ruby_version = ">= 2.7"
31
31
 
32
- spec.add_runtime_dependency "activesupport", ">= 4.2", "< 6.1"
32
+ spec.add_runtime_dependency "activesupport", ">= 5.2", "< 6.2"
33
33
  spec.add_runtime_dependency "capybara", ">= 2.18", "< 4.0"
34
- spec.add_runtime_dependency "require_all", ">= 2.0", "< 4.0"
35
- spec.add_runtime_dependency "rspec-expectations", "~> 3.8"
36
- spec.add_runtime_dependency "thor", ">= 0.20", "< 1.1"
34
+ spec.add_runtime_dependency "require_all", ">= 3.0", "< 4.0"
35
+ spec.add_runtime_dependency "rspec-expectations", "~> 3.10"
36
+ spec.add_runtime_dependency "thor", "~> 1.2"
37
37
 
38
38
  spec.add_development_dependency "rake", "~> 13.0"
39
39
  spec.add_development_dependency "rspec", "~> 3.9"
40
- spec.add_development_dependency "rubocop", "~> 0.79"
41
- spec.add_development_dependency "rubocop-performance", "~> 1.5"
42
- spec.add_development_dependency "rubocop-rspec", "~> 1.37"
43
- spec.add_development_dependency "simplecov", "~> 0.17"
40
+ spec.add_development_dependency "rubocop", "~> 1.24"
41
+ spec.add_development_dependency "rubocop-performance", "~> 1.13"
42
+ spec.add_development_dependency "rubocop-rake", "~> 0.6"
43
+ spec.add_development_dependency "rubocop-rspec", "~> 2.7"
44
+ spec.add_development_dependency "simplecov", "~> 0.21"
44
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screengem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2022-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.1'
22
+ version: '6.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.1'
32
+ version: '6.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: capybara
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '2.0'
59
+ version: '3.0'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '4.0'
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '2.0'
69
+ version: '3.0'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '4.0'
@@ -76,34 +76,28 @@ dependencies:
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '3.8'
79
+ version: '3.10'
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '3.8'
86
+ version: '3.10'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: thor
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: '0.20'
94
- - - "<"
91
+ - - "~>"
95
92
  - !ruby/object:Gem::Version
96
- version: '1.1'
93
+ version: '1.2'
97
94
  type: :runtime
98
95
  prerelease: false
99
96
  version_requirements: !ruby/object:Gem::Requirement
100
97
  requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0.20'
104
- - - "<"
98
+ - - "~>"
105
99
  - !ruby/object:Gem::Version
106
- version: '1.1'
100
+ version: '1.2'
107
101
  - !ruby/object:Gem::Dependency
108
102
  name: rake
109
103
  requirement: !ruby/object:Gem::Requirement
@@ -138,57 +132,71 @@ dependencies:
138
132
  requirements:
139
133
  - - "~>"
140
134
  - !ruby/object:Gem::Version
141
- version: '0.79'
135
+ version: '1.24'
142
136
  type: :development
143
137
  prerelease: false
144
138
  version_requirements: !ruby/object:Gem::Requirement
145
139
  requirements:
146
140
  - - "~>"
147
141
  - !ruby/object:Gem::Version
148
- version: '0.79'
142
+ version: '1.24'
149
143
  - !ruby/object:Gem::Dependency
150
144
  name: rubocop-performance
151
145
  requirement: !ruby/object:Gem::Requirement
152
146
  requirements:
153
147
  - - "~>"
154
148
  - !ruby/object:Gem::Version
155
- version: '1.5'
149
+ version: '1.13'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - "~>"
155
+ - !ruby/object:Gem::Version
156
+ version: '1.13'
157
+ - !ruby/object:Gem::Dependency
158
+ name: rubocop-rake
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: '0.6'
156
164
  type: :development
157
165
  prerelease: false
158
166
  version_requirements: !ruby/object:Gem::Requirement
159
167
  requirements:
160
168
  - - "~>"
161
169
  - !ruby/object:Gem::Version
162
- version: '1.5'
170
+ version: '0.6'
163
171
  - !ruby/object:Gem::Dependency
164
172
  name: rubocop-rspec
165
173
  requirement: !ruby/object:Gem::Requirement
166
174
  requirements:
167
175
  - - "~>"
168
176
  - !ruby/object:Gem::Version
169
- version: '1.37'
177
+ version: '2.7'
170
178
  type: :development
171
179
  prerelease: false
172
180
  version_requirements: !ruby/object:Gem::Requirement
173
181
  requirements:
174
182
  - - "~>"
175
183
  - !ruby/object:Gem::Version
176
- version: '1.37'
184
+ version: '2.7'
177
185
  - !ruby/object:Gem::Dependency
178
186
  name: simplecov
179
187
  requirement: !ruby/object:Gem::Requirement
180
188
  requirements:
181
189
  - - "~>"
182
190
  - !ruby/object:Gem::Version
183
- version: '0.17'
191
+ version: '0.21'
184
192
  type: :development
185
193
  prerelease: false
186
194
  version_requirements: !ruby/object:Gem::Requirement
187
195
  requirements:
188
196
  - - "~>"
189
197
  - !ruby/object:Gem::Version
190
- version: '0.17'
191
- description:
198
+ version: '0.21'
199
+ description:
192
200
  email:
193
201
  - alistairm@nulogy.com
194
202
  executables:
@@ -201,7 +209,6 @@ files:
201
209
  - ".rubocop"
202
210
  - ".rubocop.yml"
203
211
  - ".ruby-version"
204
- - ".travis.yml"
205
212
  - CHANGELOG.md
206
213
  - CODE_OF_CONDUCT.md
207
214
  - Gemfile
@@ -227,7 +234,6 @@ files:
227
234
  - lib/screengem/factories/factory_creation_error.rb
228
235
  - lib/screengem/factories/question_factory.rb
229
236
  - lib/screengem/factories/task_factory.rb
230
- - lib/screengem/incorrect_answer.rb
231
237
  - lib/screengem/primitive_key.rb
232
238
  - lib/screengem/question.rb
233
239
  - lib/screengem/rails_routes.rb
@@ -245,23 +251,23 @@ metadata:
245
251
  changelog_uri: https://github.com/nulogy/screengem/blob/master/CHANGELOG.md
246
252
  source_code_uri: https://github.com/nulogy/screengem
247
253
  bug_tracker_uri: https://github.com/nulogy/screengem/issues
248
- post_install_message:
254
+ post_install_message:
249
255
  rdoc_options: []
250
256
  require_paths:
251
257
  - lib
252
258
  required_ruby_version: !ruby/object:Gem::Requirement
253
259
  requirements:
254
- - - "~>"
260
+ - - ">="
255
261
  - !ruby/object:Gem::Version
256
- version: '2.5'
262
+ version: '2.7'
257
263
  required_rubygems_version: !ruby/object:Gem::Requirement
258
264
  requirements:
259
265
  - - ">="
260
266
  - !ruby/object:Gem::Version
261
267
  version: '0'
262
268
  requirements: []
263
- rubygems_version: 3.1.2
264
- signing_key:
269
+ rubygems_version: 3.1.6
270
+ signing_key:
265
271
  specification_version: 4
266
272
  summary: Ruby implementation of the Screengem Pattern.
267
273
  test_files: []
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.3
5
- before_install: gem install bundler -v 1.16.2
@@ -1,23 +0,0 @@
1
- module Screengem
2
- #
3
- # Common error to signal a question that was answered incorrectly.
4
- #
5
- class IncorrectAnswer < RuntimeError
6
- def initialize(question)
7
- super(extract_question_text(question))
8
- end
9
-
10
- private
11
-
12
- #
13
- # Transforms question class name into a text message.
14
- #
15
- # Example:
16
- #
17
- # Questions::SignatureCapturedQuestion is transformed to 'Signature captured?'.
18
- #
19
- def extract_question_text(question)
20
- question.class.name.demodulize.underscore.humanize.gsub(" question", "?")
21
- end
22
- end
23
- end