tune_spec 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +10 -0
- data/lib/tune_spec/configuration.rb +6 -1
- data/lib/tune_spec/instances/page.rb +5 -0
- data/lib/tune_spec/instances/tuner.rb +4 -0
- data/lib/tune_spec/instances.rb +10 -3
- data/lib/tune_spec/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede0c2da431134e6f70d95c3e368940435d49606
|
4
|
+
data.tar.gz: be6caeaf927340c184599e6ca16f92b617880a35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bed736d874f0c5aa00c6c38e2039686b1f97db38c657124174d91a127883f9c10da98ebfb7930c035ef004ceb96e4f02cd733591bf2ab56a38aa1195e885085
|
7
|
+
data.tar.gz: 37e120a2035cff4b9f0065473dd1281c0580840f1220137916aac220c7c66390c786d5da3b0b236e347748e702d4a4ca6b0b703f561e87cc93907c5cfadef4fe
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -78,6 +78,16 @@ TuneSpec.configure do |config|
|
|
78
78
|
end
|
79
79
|
```
|
80
80
|
|
81
|
+
### Calabash
|
82
|
+
|
83
|
+
In order to use the gem with calabash page instantiation features you need to set `TuneSpec.calabash_enabled = true`. Or configure the gem:
|
84
|
+
```ruby
|
85
|
+
TuneSpec.configure do |config|
|
86
|
+
config.calabash_enabled = true
|
87
|
+
config.calabash_wait_opts = { timeout: 10 } # set by default
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
81
91
|
## Development
|
82
92
|
|
83
93
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -4,7 +4,8 @@ module TuneSpec
|
|
4
4
|
# Defines all configurable attributes of TuneSpec
|
5
5
|
module Configuration
|
6
6
|
VALID_CONFIG_KEYS = %i[directory steps_page_arg
|
7
|
-
page_opts steps_opts groups_opts
|
7
|
+
page_opts steps_opts groups_opts
|
8
|
+
calabash_enabled calabash_wait_opts].freeze
|
8
9
|
|
9
10
|
DEFAULT_DIRECTORY = 'lib'
|
10
11
|
|
@@ -16,6 +17,10 @@ module TuneSpec
|
|
16
17
|
|
17
18
|
DEFAULT_GROUPS_OPTS = {}.freeze
|
18
19
|
|
20
|
+
DEFAULT_CALABASH_ENABLED = false
|
21
|
+
|
22
|
+
DEFAULT_CALABASH_WAIT_OPTS = { timeout: 10 }.freeze
|
23
|
+
|
19
24
|
VALID_CONFIG_KEYS.each { |key| attr_accessor key }
|
20
25
|
|
21
26
|
# Make sure the default values are set when the module is 'extended'
|
data/lib/tune_spec/instances.rb
CHANGED
@@ -50,23 +50,30 @@ module TuneSpec
|
|
50
50
|
# @private
|
51
51
|
def instance_handler(name, klass, *args, block)
|
52
52
|
method_name = klass.instance_method_name(name)
|
53
|
-
create_instance_method(method_name, klass)
|
54
53
|
instance_klass = klass.call_object(method_name)
|
54
|
+
create_instance_method(method_name, klass, instance_klass)
|
55
55
|
formatted_args = klass.format_args(args, instance_klass)
|
56
56
|
call_instance_method(method_name, *formatted_args, block)
|
57
57
|
end
|
58
58
|
|
59
59
|
# @private
|
60
|
-
def create_instance_method(method_name, klass)
|
60
|
+
def create_instance_method(method_name, klass, instance_klass)
|
61
61
|
return if respond_to?(method_name)
|
62
62
|
define_singleton_method(method_name) do |*args|
|
63
63
|
instance_var = instance_variable_get("@#{method_name}")
|
64
64
|
return instance_var if klass.rules_passed?(instance_var, args)
|
65
|
-
new_instance = klass
|
65
|
+
new_instance = create_instance(klass, instance_klass, args)
|
66
66
|
instance_variable_set("@#{method_name}", new_instance)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
# @private
|
71
|
+
def create_instance(klass, instance_klass, args)
|
72
|
+
return instance_klass.new(*args) if klass.object_type == :common
|
73
|
+
wait_opts = TuneSpec.calabash_wait_opts
|
74
|
+
page(instance_klass, *args).await(wait_opts)
|
75
|
+
end
|
76
|
+
|
70
77
|
# @private
|
71
78
|
def call_instance_method(method_name, *args, block)
|
72
79
|
return __send__(method_name, *args) unless block
|
data/lib/tune_spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tune_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Starostenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,5 +119,5 @@ rubyforge_project:
|
|
119
119
|
rubygems_version: 2.6.12
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
|
-
summary: tune_spec_0.
|
122
|
+
summary: tune_spec_0.4.0
|
123
123
|
test_files: []
|