screengem 0.10.1 → 0.11.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: cd011339a587030b0f8c3e17df9684755b66025d6728228be0e4333c716cb71c
4
+ data.tar.gz: aa205821d3e4a36495f5d2614807c2f85189cd0c053218e926c055bab8ee90ff
5
5
  SHA512:
6
- metadata.gz: 5ee82906dcdec034c242ed77982d894ce7f03c3981566871be379d6259a8b63eff0bc4386976d27c41633314b66e254393eb463d6a4c80b5e08192ef51552027
7
- data.tar.gz: 90723b078fe87cb3a4ce29bd744b8337c5e6eb6724b0ce6cbee143cab6fb85969720f760211e1f838a298688150019c84f356686786a9ce966d7520a1a415e21
6
+ metadata.gz: 78ee26817bdf61174c260f6e8d9ec4b2108c595671a7cad0a79dfadf6355d283126196d124f08704a5e28579ca3c7e7b12cdab5232aa62a82998644e35bf117b
7
+ data.tar.gz: 4761eea85f9258e23b9b34efd5eb271c3e84738615e347bc0fe694fc257e7156deee4f11f16aed9f451c37ee0e13e5c0bfa2521efbe8a2fec34f0666630b0d80
@@ -1,5 +1,17 @@
1
1
  require: rubocop-rspec
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+
6
+ Layout/SpaceAroundMethodCallOperator:
7
+ Enabled: false
8
+
9
+ Lint/RaiseException:
10
+ Enabled: false
11
+
12
+ Lint/StructNewOverride:
13
+ Enabled: false
14
+
3
15
  Metrics/AbcSize:
4
16
  Enabled: false
5
17
 
@@ -36,6 +48,18 @@ RSpec/MessageSpies:
36
48
  RSpec/NotToNot:
37
49
  EnforcedStyle: to_not
38
50
 
51
+ Style/ExponentialNotation:
52
+ Enabled: false
53
+
54
+ Style/HashEachMethods:
55
+ Enabled: false
56
+
57
+ Style/HashTransformKeys:
58
+ Enabled: false
59
+
60
+ Style/HashTransformValues:
61
+ Enabled: false
62
+
39
63
  Style/Documentation:
40
64
  Enabled: false
41
65
 
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.6.6
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.11.0 (2020-04-26)
6
+
7
+ ### Breaking Changes
8
+
9
+ * Questions answer negatively by throwing an exception rather than returning false
10
+
11
+ ## 0.10.1 (2020-01-11)
12
+
13
+ * Relax the thor dependency
14
+
5
15
  ## 0.10.0 (2020-01-11)
6
16
 
7
17
  * 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 matchers are available to 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.
@@ -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"
@@ -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
@@ -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.11.0"
3
3
  end
@@ -27,7 +27,7 @@ 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.5"
31
31
 
32
32
  spec.add_runtime_dependency "activesupport", ">= 4.2", "< 6.1"
33
33
  spec.add_runtime_dependency "capybara", ">= 2.18", "< 4.0"
@@ -37,8 +37,8 @@ Gem::Specification.new do |spec|
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"
40
+ spec.add_development_dependency "rubocop", "~> 0.82"
41
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"
42
+ spec.add_development_dependency "rubocop-rspec", "~> 1.38"
43
+ spec.add_development_dependency "simplecov", "~> 0.18"
44
44
  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.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -138,14 +138,14 @@ dependencies:
138
138
  requirements:
139
139
  - - "~>"
140
140
  - !ruby/object:Gem::Version
141
- version: '0.79'
141
+ version: '0.82'
142
142
  type: :development
143
143
  prerelease: false
144
144
  version_requirements: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - "~>"
147
147
  - !ruby/object:Gem::Version
148
- version: '0.79'
148
+ version: '0.82'
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: rubocop-performance
151
151
  requirement: !ruby/object:Gem::Requirement
@@ -166,28 +166,28 @@ dependencies:
166
166
  requirements:
167
167
  - - "~>"
168
168
  - !ruby/object:Gem::Version
169
- version: '1.37'
169
+ version: '1.38'
170
170
  type: :development
171
171
  prerelease: false
172
172
  version_requirements: !ruby/object:Gem::Requirement
173
173
  requirements:
174
174
  - - "~>"
175
175
  - !ruby/object:Gem::Version
176
- version: '1.37'
176
+ version: '1.38'
177
177
  - !ruby/object:Gem::Dependency
178
178
  name: simplecov
179
179
  requirement: !ruby/object:Gem::Requirement
180
180
  requirements:
181
181
  - - "~>"
182
182
  - !ruby/object:Gem::Version
183
- version: '0.17'
183
+ version: '0.18'
184
184
  type: :development
185
185
  prerelease: false
186
186
  version_requirements: !ruby/object:Gem::Requirement
187
187
  requirements:
188
188
  - - "~>"
189
189
  - !ruby/object:Gem::Version
190
- version: '0.17'
190
+ version: '0.18'
191
191
  description:
192
192
  email:
193
193
  - alistairm@nulogy.com
@@ -227,7 +227,6 @@ files:
227
227
  - lib/screengem/factories/factory_creation_error.rb
228
228
  - lib/screengem/factories/question_factory.rb
229
229
  - lib/screengem/factories/task_factory.rb
230
- - lib/screengem/incorrect_answer.rb
231
230
  - lib/screengem/primitive_key.rb
232
231
  - lib/screengem/question.rb
233
232
  - lib/screengem/rails_routes.rb
@@ -251,7 +250,7 @@ require_paths:
251
250
  - lib
252
251
  required_ruby_version: !ruby/object:Gem::Requirement
253
252
  requirements:
254
- - - "~>"
253
+ - - ">="
255
254
  - !ruby/object:Gem::Version
256
255
  version: '2.5'
257
256
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -260,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
259
  - !ruby/object:Gem::Version
261
260
  version: '0'
262
261
  requirements: []
263
- rubygems_version: 3.1.2
262
+ rubygems_version: 3.0.3
264
263
  signing_key:
265
264
  specification_version: 4
266
265
  summary: Ruby implementation of the Screengem Pattern.
@@ -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