screengem 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/screengem/automatic_visit.rb +12 -12
- data/lib/screengem/factories/question_factory.rb +14 -10
- data/lib/screengem/factories/task_factory.rb +14 -10
- data/lib/screengem/version.rb +1 -1
- data/screengem.gemspec +3 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc2caab1569220080738a833782fd78797d70da30e98e190559dca7896d11695
|
4
|
+
data.tar.gz: 2ae610d60ea958c002e0b1f1658257a906b790694478a1d01b0997b979bc8475
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebaced74c3f7ae2640252503e9c1dbee04b7b955b20a1d81c16777cf10b779a984acb5dd20c81c0e68bb356321f22314676f3efffe484147bf85a8ef82bab3df
|
7
|
+
data.tar.gz: 4ccaed09c6abfd214ff67ffdff7e96b3482626dd591f1ef2e293e5ada8e5ff8ec37a82bfe422c16e1d0cdaa16bf79199c259303d59e610d3a5fa4281b6e66582
|
data/CHANGELOG.md
CHANGED
@@ -11,13 +11,19 @@ module Screengem
|
|
11
11
|
@screen_element = screen_element
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
definition = ::RUBY_VERSION >= "2.7" ? "..." : "*args"
|
15
|
+
|
16
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
17
|
+
def method_missing(method, #{definition})
|
18
|
+
if screen_element.respond_to?(method)
|
19
|
+
screen_element.visit if auto_visit?(method)
|
20
|
+
|
21
|
+
screen_element.send(method, #{definition})
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
19
25
|
end
|
20
|
-
|
26
|
+
RUBY
|
21
27
|
|
22
28
|
def respond_to_missing?(method, *)
|
23
29
|
screen_element.respond_to?(method)
|
@@ -25,12 +31,6 @@ module Screengem
|
|
25
31
|
|
26
32
|
private
|
27
33
|
|
28
|
-
def forward_with_auto_visit(method, args)
|
29
|
-
screen_element.visit if auto_visit?(method)
|
30
|
-
|
31
|
-
screen_element.send(method, *args)
|
32
|
-
end
|
33
|
-
|
34
34
|
def auto_visit?(method)
|
35
35
|
methods_to_decorate.include?(method)
|
36
36
|
end
|
@@ -6,17 +6,21 @@ module Screengem
|
|
6
6
|
class QuestionFactory < BasicObject
|
7
7
|
include ::Singleton
|
8
8
|
|
9
|
-
|
10
|
-
question_class_name = "#{question_name}_question".camelize
|
11
|
-
question_class = "#{question_scope}::#{question_class_name}".constantize
|
9
|
+
definition = ::RUBY_VERSION >= "2.7" ? "..." : "*args"
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
12
|
+
def method_missing(question_name, #{definition})
|
13
|
+
question_class_name = "\#{question_name}_question".camelize
|
14
|
+
question_class = "\#{question_scope}::\#{question_class_name}".constantize
|
15
|
+
|
16
|
+
question_class.new(#{definition})
|
17
|
+
rescue => e
|
18
|
+
QuestionError.new(<<~MSG)
|
19
|
+
Unable to create question: '\#{question_class_name}'.
|
20
|
+
Details: \#{e.message}
|
21
|
+
MSG
|
22
|
+
end
|
23
|
+
RUBY
|
20
24
|
|
21
25
|
def respond_to_missing?(_question_name, *)
|
22
26
|
true
|
@@ -6,17 +6,21 @@ module Screengem
|
|
6
6
|
class TaskFactory < BasicObject
|
7
7
|
include ::Singleton
|
8
8
|
|
9
|
-
|
10
|
-
task_class_name = "#{task_name}_task".camelize
|
11
|
-
task_class = "#{task_scope}::#{task_class_name}".constantize
|
9
|
+
definition = ::RUBY_VERSION >= "2.7" ? "..." : "*args"
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
12
|
+
def method_missing(task_name, #{definition})
|
13
|
+
task_class_name = "\#{task_name}_task".camelize
|
14
|
+
task_class = "\#{task_scope}::\#{task_class_name}".constantize
|
15
|
+
|
16
|
+
task_class.new(#{definition})
|
17
|
+
rescue => e
|
18
|
+
TaskError.new(<<~MSG)
|
19
|
+
Unable to create task: '\#{task_class_name}'.
|
20
|
+
Details: \#{e.message}
|
21
|
+
MSG
|
22
|
+
end
|
23
|
+
RUBY
|
20
24
|
|
21
25
|
def respond_to_missing?(_task_name, *)
|
22
26
|
true
|
data/lib/screengem/version.rb
CHANGED
data/screengem.gemspec
CHANGED
@@ -3,6 +3,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
require "screengem/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
+
spec.metadata = { "rubygems_mfa_required" => "true" }
|
7
|
+
|
6
8
|
spec.name = "screengem"
|
7
9
|
spec.version = Screengem::VERSION
|
8
10
|
spec.authors = ["Alistair McKinnell"]
|
@@ -29,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
29
31
|
spec.require_paths = ["lib"]
|
30
32
|
spec.required_ruby_version = ">= 2.7"
|
31
33
|
|
32
|
-
spec.add_runtime_dependency "activesupport", ">= 5.2", "< 7.
|
34
|
+
spec.add_runtime_dependency "activesupport", ">= 5.2", "< 7.1"
|
33
35
|
spec.add_runtime_dependency "capybara", ">= 3.0", "< 4.0"
|
34
36
|
spec.add_runtime_dependency "require_all", ">= 3.0", "< 4.0"
|
35
37
|
spec.add_runtime_dependency "rspec-expectations", "~> 3.11"
|
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.
|
4
|
+
version: 0.18.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:
|
11
|
+
date: 2023-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '7.
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '7.
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: capybara
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
245
|
- !ruby/object:Gem::Version
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
|
-
rubygems_version: 3.
|
248
|
+
rubygems_version: 3.4.5
|
249
249
|
signing_key:
|
250
250
|
specification_version: 4
|
251
251
|
summary: Ruby implementation of the Screengem Pattern.
|