dekiru 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +1 -1
- data/dekiru.gemspec +1 -1
- data/lib/dekiru/capybara/{Legacy_helpers.rb → legacy_helpers.rb} +0 -0
- data/lib/dekiru/capybara/matchers.rb +6 -1
- data/lib/dekiru/data_migration_operator.rb +2 -1
- data/lib/dekiru/version.rb +1 -1
- data/spec/dekiru/data_migration_operator_spec.rb +31 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54b13a45f83b83696f4798dc3af4befcb07682e86fdbc9aae2366d3b94524aac
|
4
|
+
data.tar.gz: 73a0c2739cd8e0d96486aabe942bc0a62641473d8f23baad150bab7bcbf27907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f74414b41a234c0b3c4fac407946ffc0348c692731cd8c10b99d47644b27dc640c19ee49a2ce1d7dc6f50bde201995593efddbc183e4d76307f312788f796c
|
7
|
+
data.tar.gz: ce2c7c2330ac94f1de33bae835920897c9edcbaca64f11c05b3a50513d4ffb007e4c99a99f7e39b6e05a9bc1dd133443adff8fd7ba7a65fd68713dd11b6edc3e
|
data/.github/workflows/rspec.yml
CHANGED
data/dekiru.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Dekiru::VERSION
|
17
17
|
|
18
|
-
gem.required_ruby_version = '>= 2.
|
18
|
+
gem.required_ruby_version = '>= 2.7.0'
|
19
19
|
|
20
20
|
gem.add_dependency 'http_accept_language', [">= 2.0.0"]
|
21
21
|
gem.add_dependency 'rails'
|
File without changes
|
@@ -3,7 +3,12 @@ module Dekiru
|
|
3
3
|
module Matchers
|
4
4
|
class JsNoErrorMatcher
|
5
5
|
def matches?(page_or_logs)
|
6
|
-
logs = page_or_logs.respond_to?(:driver)
|
6
|
+
logs = if page_or_logs.respond_to?(:driver)
|
7
|
+
ActiveSupport::Deprecation.warn('[dekiru] call have_no_js_errors with page is deprecated. please call with logs.')
|
8
|
+
page_or_logs.driver.browser.logs.get(:browser)
|
9
|
+
else
|
10
|
+
page_or_logs
|
11
|
+
end
|
7
12
|
logs.find_all { |log| log.level == 'WARNING' }.each do |log|
|
8
13
|
STDERR.puts 'WARN: javascript warning'
|
9
14
|
STDERR.puts log.message
|
@@ -48,10 +48,11 @@ module Dekiru
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def find_each_with_progress(target_scope, options = {})
|
51
|
+
total = options.delete(:total)
|
51
52
|
opt = {
|
52
53
|
format: '%a |%b>>%i| %p%% %t',
|
53
54
|
}.merge(options).merge(
|
54
|
-
total: target_scope.count,
|
55
|
+
total: total || target_scope.count,
|
55
56
|
output: stream
|
56
57
|
)
|
57
58
|
pb = ::ProgressBar.create(opt)
|
data/lib/dekiru/version.rb
CHANGED
@@ -127,5 +127,36 @@ describe Dekiru::DataMigrationOperator do
|
|
127
127
|
expect(operator.stream.out).to include('Finished successfully:')
|
128
128
|
expect(operator.stream.out).to include('Total time:')
|
129
129
|
end
|
130
|
+
|
131
|
+
it 'total をオプションで渡すことができる' do
|
132
|
+
class Dekiru::DummyRecord
|
133
|
+
def self.count
|
134
|
+
raise "won't call"
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.find_each
|
138
|
+
yield 99
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
allow(STDIN).to receive(:gets) do
|
143
|
+
"yes\n"
|
144
|
+
end
|
145
|
+
|
146
|
+
sum = 0
|
147
|
+
operator.execute do
|
148
|
+
find_each_with_progress(Dekiru::DummyRecord, title: 'pass total as option', total: 1) do |num|
|
149
|
+
sum += num
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
expect(sum).to eq(99)
|
154
|
+
expect(operator.result).to eq(true)
|
155
|
+
expect(operator.error).to eq(nil)
|
156
|
+
expect(operator.stream.out).to include('Are you sure to commit?')
|
157
|
+
expect(operator.stream.out).to include('pass total as option:')
|
158
|
+
expect(operator.stream.out).to include('Finished successfully:')
|
159
|
+
expect(operator.stream.out).to include('Total time:')
|
160
|
+
end
|
130
161
|
end
|
131
162
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dekiru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akihiro Matsumura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http_accept_language
|
@@ -139,9 +139,9 @@ files:
|
|
139
139
|
- dekiru.gemspec
|
140
140
|
- lib/dekiru.rb
|
141
141
|
- lib/dekiru/camelize_hash.rb
|
142
|
-
- lib/dekiru/capybara/Legacy_helpers.rb
|
143
142
|
- lib/dekiru/capybara/helpers.rb
|
144
143
|
- lib/dekiru/capybara/helpers/wait_for_position_stable.rb
|
144
|
+
- lib/dekiru/capybara/legacy_helpers.rb
|
145
145
|
- lib/dekiru/capybara/matchers.rb
|
146
146
|
- lib/dekiru/controller_additions.rb
|
147
147
|
- lib/dekiru/data_migration_operator.rb
|
@@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
176
|
requirements:
|
177
177
|
- - ">="
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 2.
|
179
|
+
version: 2.7.0
|
180
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
181
|
requirements:
|
182
182
|
- - ">="
|