dekiru 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d8df1d364e772bfe0abc6b281c3ff4678f367d0257d798e952955f531dcbee5
4
- data.tar.gz: 617e9cf3e96ad6ef9d0407862aa2b1808475a61887d5360463fb66295c69ac5d
3
+ metadata.gz: 54b13a45f83b83696f4798dc3af4befcb07682e86fdbc9aae2366d3b94524aac
4
+ data.tar.gz: 73a0c2739cd8e0d96486aabe942bc0a62641473d8f23baad150bab7bcbf27907
5
5
  SHA512:
6
- metadata.gz: 47a8042edabdd3a3c5135af8fdf4eca91a7f265c1fbe6a4659490fb2600409a046c156aa533f8988baedc5012ebb796939e93e9880459eec050a1dbd95f59490
7
- data.tar.gz: 89bbb4ec613d4ee1412a55c6bfa7d3f60b30ffb6d6fa2f40b3752c1f4b907f39613031a27945cf7547a00a8561d7d605577687389eaaa12296f0f5154ed20971
6
+ metadata.gz: 10f74414b41a234c0b3c4fac407946ffc0348c692731cd8c10b99d47644b27dc640c19ee49a2ce1d7dc6f50bde201995593efddbc183e4d76307f312788f796c
7
+ data.tar.gz: ce2c7c2330ac94f1de33bae835920897c9edcbaca64f11c05b3a50513d4ffb007e4c99a99f7e39b6e05a9bc1dd133443adff8fd7ba7a65fd68713dd11b6edc3e
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- ruby: ["2.6", "2.7", "3.0"]
17
+ ruby: ["2.7", "3.0", "3.1"]
18
18
  steps:
19
19
  - uses: actions/checkout@v2
20
20
 
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.4.0'
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'
@@ -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) ? page_or_logs.driver.browser.manage.logs.get(:browser) : page_or_logs
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)
@@ -1,3 +1,3 @@
1
1
  module Dekiru
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -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.2.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: 2021-11-01 00:00:00.000000000 Z
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.4.0
179
+ version: 2.7.0
180
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ">="