judges 0.16.0 → 0.18.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: db0130833063b43aab8a1dacec3106566da9c398fe539eea33eb8e76529d9d09
4
- data.tar.gz: 2ced92ba9c8896742ad493dc75be234864cef5690d0313a6a581ee7e12cb427a
3
+ metadata.gz: 01de840b5ca098985b5b4cbdc1ea16d96237d3bbed4617971662f5628fad46bf
4
+ data.tar.gz: e502a04924b0186921fbbc2026e4f7d78eed0ee47ec2f6cdfcfb01c65e092050
5
5
  SHA512:
6
- metadata.gz: d4393433a51dfdbabec4e6b8c09d9a02255fc18f76022f571a9633abf73c9f4bc9783ef1b4175dca14f35a939f5cc043f6052f928c5798206d40bda22667e6d7
7
- data.tar.gz: b4e7653eb03bec4c3ec08a4060c594d1ded0bbe63e24357bce24bab52e4dee1d74615ac7199bbbf09b485c51072c997f513d71011c3fef4147a46c378bf786cd
6
+ metadata.gz: 38e602fda2bc3a1cce738e1633094d7dc0bc8a50fb43ff97e1e28d4da36752bbdb56fac51f98a2cec884b7a3245b701566c7500d817f4a242fbfb0c28cd9b62d
7
+ data.tar.gz: d9d5761f6384e7898da2cbab0b39a659d22f91a1af61a834f52c038f0162b8ebf08f576a8ea846b9a3818fb5f822c6d018552478d979365fa0226955f7cdc5d3
@@ -27,4 +27,4 @@ jobs:
27
27
  runs-on: ubuntu-22.04
28
28
  steps:
29
29
  - uses: actions/checkout@v4
30
- - uses: yegor256/copyrights-action@0.0.4
30
+ - uses: yegor256/copyrights-action@0.0.5
data/.rubocop.yml CHANGED
@@ -28,6 +28,8 @@ AllCops:
28
28
  SuggestExtensions: false
29
29
  NewCops: enable
30
30
 
31
+ Metrics/ParameterLists:
32
+ Enabled: false
31
33
  Style/GlobalVars:
32
34
  Enabled: false
33
35
  Metrics/MethodLength:
data/Gemfile CHANGED
@@ -25,13 +25,14 @@ gemspec
25
25
 
26
26
  gem 'cucumber', '9.2.0', require: false
27
27
  gem 'minitest', '5.24.1', require: false
28
+ gem 'minitest-reporters', '1.7.1', require: false
28
29
  gem 'net-ping', '2.0.8', require: false
29
30
  gem 'rake', '13.2.1', require: false
30
31
  gem 'random-port', '~>0.0', require: false
31
32
  gem 'rspec-rails', '6.1.3', require: false
32
33
  gem 'rubocop', '1.65.0', require: false
33
34
  gem 'rubocop-performance', '1.21.1', require: false
34
- gem 'rubocop-rspec', '3.0.2', require: false
35
+ gem 'rubocop-rspec', '3.0.3', require: false
35
36
  gem 'simplecov', '0.22.0', require: false
36
37
  gem 'simplecov-cobertura', '2.1.0', require: false
37
38
  gem 'webmock', '3.23.1', require: false
data/Gemfile.lock CHANGED
@@ -46,6 +46,7 @@ GEM
46
46
  tzinfo (~> 2.0)
47
47
  addressable (2.8.7)
48
48
  public_suffix (>= 2.0.2, < 7.0)
49
+ ansi (1.5.0)
49
50
  ast (2.4.2)
50
51
  backtrace (0.4.0)
51
52
  base64 (0.2.0)
@@ -122,6 +123,11 @@ GEM
122
123
  loog (0.5.2)
123
124
  mini_mime (1.1.5)
124
125
  minitest (5.24.1)
126
+ minitest-reporters (1.7.1)
127
+ ansi
128
+ builder
129
+ minitest (>= 5.0)
130
+ ruby-progressbar
125
131
  moments (0.3.0)
126
132
  multi_test (1.1.0)
127
133
  mutex_m (0.2.0)
@@ -174,7 +180,7 @@ GEM
174
180
  zeitwerk (~> 2.6)
175
181
  rainbow (3.1.1)
176
182
  rake (13.2.1)
177
- random-port (0.7.0)
183
+ random-port (0.7.1)
178
184
  rdoc (6.7.0)
179
185
  psych (>= 4.0.0)
180
186
  regexp_parser (2.9.2)
@@ -216,7 +222,7 @@ GEM
216
222
  rubocop-performance (1.21.1)
217
223
  rubocop (>= 1.48.1, < 2.0)
218
224
  rubocop-ast (>= 1.31.1, < 2.0)
219
- rubocop-rspec (3.0.2)
225
+ rubocop-rspec (3.0.3)
220
226
  rubocop (~> 1.61)
221
227
  ruby-progressbar (1.13.0)
222
228
  simplecov (0.22.0)
@@ -261,13 +267,14 @@ DEPENDENCIES
261
267
  cucumber (= 9.2.0)
262
268
  judges!
263
269
  minitest (= 5.24.1)
270
+ minitest-reporters (= 1.7.1)
264
271
  net-ping (= 2.0.8)
265
272
  rake (= 13.2.1)
266
273
  random-port (~> 0.0)
267
274
  rspec-rails (= 6.1.3)
268
275
  rubocop (= 1.65.0)
269
276
  rubocop-performance (= 1.21.1)
270
- rubocop-rspec (= 3.0.2)
277
+ rubocop-rspec (= 3.0.3)
271
278
  simplecov (= 0.22.0)
272
279
  simplecov-cobertura (= 2.1.0)
273
280
  webmock (= 3.23.1)
data/README.md CHANGED
@@ -34,6 +34,8 @@ global variables available to it:
34
34
  Every `.yml` file must be formatted as such:
35
35
 
36
36
  ```yaml
37
+ before:
38
+ - abc
37
39
  category: slow
38
40
  runs: 1
39
41
  skip: false
@@ -60,6 +62,9 @@ which then may be turned on via the `--category` command line flag.
60
62
  The `runs` (default: `1`) is the number of times the `.rb` script should
61
63
  be executed. After each execution, all expected XPath expressions are validated.
62
64
 
65
+ The `before` (default: `[]`) is a list of judges that must be executed before
66
+ the current one.
67
+
63
68
  ## How to contribute
64
69
 
65
70
  Read
data/bin/judges CHANGED
@@ -179,6 +179,8 @@ class App
179
179
  c.flag([:owner], default_value: 'default', type: String)
180
180
  c.desc 'Supplementary meta information about the upload (key:value)'
181
181
  c.flag([:meta], type: String, multiple: true)
182
+ c.desc 'How many times to retry'
183
+ c.flag([:retries], type: Integer, default_value: 3)
182
184
  c.action do |global, options, args|
183
185
  require_relative '../lib/judges/commands/push'
184
186
  Judges::Push.new(loog).run(options, args)
@@ -201,6 +203,8 @@ class App
201
203
  c.switch([:ssl], default_value: true)
202
204
  c.desc 'A unique name to use for a lock/unlock'
203
205
  c.flag([:owner], default_value: 'default', type: String)
206
+ c.desc 'How many times to retry'
207
+ c.flag([:retries], type: Integer, default_value: 3)
204
208
  c.action do |global, options, args|
205
209
  require_relative '../lib/judges/commands/pull'
206
210
  Judges::Pull.new(loog).run(options, args)
@@ -6,6 +6,6 @@ Feature: Push
6
6
  Given I make a temp directory
7
7
  Then I run bin/judges with "--verbose eval simple.fb '(0..1000).each { $fb.insert.foo = 42 }'"
8
8
  And Exit code is zero
9
- Then I run bin/judges with "push --token 00000000-0000-0000-0000-000000000000 --meta a:b --meta foo:bar simple simple.fb"
9
+ Then I run bin/judges with "push --token 00000000-0000-0000-0000-000000000000 --meta a:b --meta foo:bar --meta=pages_url:https://zerocracy.github.io/zerocracy.html --meta=duration:1055 simple simple.fb"
10
10
  Then Stdout contains "Pushed"
11
11
  And Exit code is zero
@@ -118,3 +118,26 @@ Feature: Test
118
118
  Then I run bin/judges with "test --enable bad mine"
119
119
  Then Stdout contains "Testing mine/bad/bad.yml"
120
120
  And Exit code is not zero
121
+
122
+ Scenario: Test with a pre-condition
123
+ Given I make a temp directory
124
+ Then I have a "mine/first/first.rb" file with content:
125
+ """
126
+ n = $fb.insert
127
+ n.foo = 42
128
+ """
129
+ Then I have a "mine/second/second.rb" file with content:
130
+ """
131
+ n = $fb.insert
132
+ n.foo = 55
133
+ """
134
+ Then I have a "mine/second/second.yml" file with content:
135
+ """
136
+ ---
137
+ before:
138
+ - first
139
+ expected:
140
+ - /fb[count(f)=2]
141
+ """
142
+ Then I run bin/judges with "test mine"
143
+ And Exit code is zero
data/judges.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
27
  s.required_ruby_version = '>=3.2'
28
28
  s.name = 'judges'
29
- s.version = '0.16.0'
29
+ s.version = '0.18.0'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description =
data/lib/judges/baza.rb CHANGED
@@ -33,15 +33,14 @@ require_relative '../judges/elapsed'
33
33
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
34
34
  # License:: MIT
35
35
  class Judges::Baza
36
- # rubocop:disable Metrics/ParameterLists
37
- def initialize(host, port, token, ssl: true, timeout: 30, loog: Loog::NULL)
38
- # rubocop:enable Metrics/ParameterLists
36
+ def initialize(host, port, token, ssl: true, timeout: 30, retries: 3, loog: Loog::NULL)
39
37
  @host = host
40
38
  @port = port
41
39
  @ssl = ssl
42
40
  @token = token
43
41
  @timeout = timeout
44
42
  @loog = loog
43
+ @retries = retries
45
44
  end
46
45
 
47
46
  def push(name, data, meta)
@@ -50,9 +49,11 @@ class Judges::Baza
50
49
  'Content-Type' => 'application/octet-stream',
51
50
  'Content-Length' => data.size
52
51
  )
53
- hdrs = hdrs.merge('X-Zerocracy-Meta' => meta.map { |v| Base64.encode64(v).strip }.join(' ')) unless meta.empty?
52
+ unless meta.empty?
53
+ hdrs = hdrs.merge('X-Zerocracy-Meta' => meta.map { |v| Base64.encode64(v).gsub("\n", '') }.join(' '))
54
+ end
54
55
  elapsed(@loog) do
55
- ret = with_retries do
56
+ ret = with_retries(max_tries: @retries) do
56
57
  checked(
57
58
  Typhoeus::Request.put(
58
59
  home.append('push').append(name).to_s,
@@ -85,7 +86,9 @@ class Judges::Baza
85
86
  request.on_body do |chunk|
86
87
  f.write(chunk)
87
88
  end
88
- request.run
89
+ with_retries(max_tries: @retries) do
90
+ request.run
91
+ end
89
92
  checked(request.response)
90
93
  end
91
94
  data = File.binread(file)
@@ -99,7 +102,7 @@ class Judges::Baza
99
102
  def finished?(id)
100
103
  finished = false
101
104
  elapsed(@loog) do
102
- ret = with_retries do
105
+ ret = with_retries(max_tries: @retries) do
103
106
  checked(
104
107
  Typhoeus::Request.get(
105
108
  home.append('finished').append(id).to_s,
@@ -116,7 +119,7 @@ class Judges::Baza
116
119
  # Lock the name.
117
120
  def lock(name, owner)
118
121
  elapsed(@loog) do
119
- with_retries do
122
+ with_retries(max_tries: @retries) do
120
123
  checked(
121
124
  Typhoeus::Request.get(
122
125
  home.append('lock').append(name).add(owner:).to_s,
@@ -131,7 +134,7 @@ class Judges::Baza
131
134
  # Unlock the name.
132
135
  def unlock(name, owner)
133
136
  elapsed(@loog) do
134
- with_retries do
137
+ with_retries(max_tries: @retries) do
135
138
  checked(
136
139
  Typhoeus::Request.get(
137
140
  home.append('unlock').append(name).add(owner:).to_s,
@@ -146,7 +149,7 @@ class Judges::Baza
146
149
  def recent(name)
147
150
  job = 0
148
151
  elapsed(@loog) do
149
- ret = with_retries do
152
+ ret = with_retries(max_tries: @retries) do
150
153
  checked(
151
154
  Typhoeus::Request.get(
152
155
  home.append('recent').append("#{name}.txt").to_s,
@@ -163,7 +166,7 @@ class Judges::Baza
163
166
  def name_exists?(name)
164
167
  exists = 0
165
168
  elapsed(@loog) do
166
- ret = with_retries do
169
+ ret = with_retries(max_tries: @retries) do
167
170
  checked(
168
171
  Typhoeus::Request.get(
169
172
  home.append('exists').append(name).to_s,
@@ -220,6 +223,8 @@ class Judges::Baza
220
223
  msg +=
221
224
  ', most probably you are trying to reach a wrong server, which doesn\'t ' \
222
225
  'have the URL that it is expected to have'
226
+ when 0
227
+ msg += ', most likely an internal error'
223
228
  end
224
229
  raise msg
225
230
  end
@@ -42,13 +42,14 @@ class Judges::Pull
42
42
  opts['host'], opts['port'].to_i, opts['token'],
43
43
  ssl: opts['ssl'],
44
44
  timeout: (opts['timeout'] || 30).to_i,
45
- loog: @loog
45
+ loog: @loog,
46
+ retries: (opts['retries'] || 3).to_i
46
47
  )
47
48
  name = args[0]
48
49
  elapsed(@loog) do
49
50
  if baza.name_exists?(name)
50
51
  baza.lock(name, opts['owner'])
51
- fb.import(baza.pull(wait(baza, baza.recent(name), opts['wait'])))
52
+ fb.import(baza.pull(wait(name, baza, baza.recent(name), opts['wait'])))
52
53
  Judges::Impex.new(@loog, args[1]).export(fb)
53
54
  throw :"Pulled #{fb.size} facts by the name '#{name}'"
54
55
  else
@@ -59,14 +60,15 @@ class Judges::Pull
59
60
 
60
61
  private
61
62
 
62
- def wait(baza, id, limit)
63
+ def wait(name, baza, id, limit)
63
64
  raise 'Waiting time is nil' if limit.nil?
64
65
  start = Time.now
65
66
  loop do
66
67
  break if baza.finished?(id)
67
68
  sleep 1
68
- raise 'Time is over, the job is still not finished' if Time.now - start > limit
69
- @loog.debug("Still waiting for the job ##{id} to finish... (#{format('%.2f', Time.now - start)}s already)")
69
+ raise "Time is over, the job ##{id} ('#{name}') is still not finished" if Time.now - start > limit
70
+ lapsed = Time.now - start
71
+ @loog.debug("Still waiting for the job ##{id} ('#{name}') to finish... (#{format('%.2f', lapsed)}s already)")
70
72
  end
71
73
  id
72
74
  end
@@ -43,7 +43,8 @@ class Judges::Push
43
43
  opts['host'], opts['port'].to_i, opts['token'],
44
44
  ssl: opts['ssl'],
45
45
  timeout: (opts['timeout'] || 30).to_i,
46
- loog: @loog
46
+ loog: @loog,
47
+ retries: (opts['retries'] || 3).to_i
47
48
  )
48
49
  elapsed(@loog) do
49
50
  baza.lock(name, opts['owner'])
@@ -46,18 +46,19 @@ class Judges::Test
46
46
  dir = args[0]
47
47
  @loog.info("Testing judges in #{dir.to_rel}...")
48
48
  errors = []
49
- judges = 0
49
+ tested = 0
50
50
  tests = 0
51
51
  visible = []
52
+ judges = Judges::Judges.new(dir, opts['lib'], @loog)
52
53
  elapsed(@loog) do
53
- Judges::Judges.new(dir, opts['lib'], @loog).each_with_index do |p, i|
54
- visible << p.name
55
- next unless include?(opts, p.name)
56
- @loog.info("\n👉 Testing #{p.script} (##{i}) in #{p.dir.to_rel}...")
57
- p.tests.each do |f|
54
+ judges.each_with_index do |judge, i|
55
+ visible << judge.name
56
+ next unless include?(opts, judge.name)
57
+ @loog.info("\n👉 Testing #{judge.script} (##{i}) in #{judge.dir.to_rel}...")
58
+ judge.tests.each do |f|
58
59
  tname = File.basename(f).gsub(/\.yml$/, '')
59
- visible << " #{p.name}/#{tname}"
60
- next unless include?(opts, p.name, tname)
60
+ visible << " #{judge.name}/#{tname}"
61
+ next unless include?(opts, judge.name, tname)
61
62
  yaml = YAML.load_file(f, permitted_classes: [Time])
62
63
  if yaml['skip']
63
64
  @loog.info("Skippped #{f.to_rel}")
@@ -69,25 +70,31 @@ class Judges::Test
69
70
  end
70
71
  @loog.info("🛠️ Testing #{f.to_rel}:")
71
72
  begin
72
- test_one(opts, p, tname, yaml)
73
+ fb = Factbase.new
74
+ yaml['before']&.each do |n|
75
+ j = judges.get(n)
76
+ @loog.info("Running #{j.script} judge as a pre-condition...")
77
+ test_one(fb, opts, j, n, yaml, assert: false)
78
+ end
79
+ test_one(fb, opts, judge, tname, yaml)
73
80
  tests += 1
74
81
  rescue StandardError => e
75
82
  @loog.warn(Backtrace.new(e))
76
83
  errors << f
77
84
  end
78
85
  end
79
- judges += 1
86
+ tested += 1
80
87
  end
81
- throw :'👍 No judges tested' if judges.zero?
82
- throw :"👍 All #{judges} judge(s) but no tests passed" if tests.zero?
83
- throw :"👍 All #{judges} judge(s) and #{tests} tests passed" if errors.empty?
84
- throw :"❌ #{judges} judge(s) tested, #{errors.size} of them failed"
88
+ throw :'👍 No judges tested' if tested.zero?
89
+ throw :"👍 All #{tested} judge(s) but no tests passed" if tests.zero?
90
+ throw :"👍 All #{tested} judge(s) and #{tests} tests passed" if errors.empty?
91
+ throw :"❌ #{tested} judge(s) tested, #{errors.size} of them failed"
85
92
  end
86
93
  unless errors.empty?
87
94
  raise "#{errors.size} tests failed" unless opts['quiet']
88
95
  @loog.debug('Not failing the build with tests failures, due to the --quiet option')
89
96
  end
90
- return unless judges.zero? || tests.zero?
97
+ return unless tested.zero? || tests.zero?
91
98
  if opts['judge'].nil?
92
99
  raise 'There are seems to be no judges' unless opts['quiet']
93
100
  @loog.debug('Not failing the build with no judges tested, due to the --quiet option')
@@ -106,8 +113,7 @@ class Judges::Test
106
113
  judges.any? { |n| n.match?(%r{^#{name}(/#{tre})?$}) }
107
114
  end
108
115
 
109
- def test_one(opts, judge, tname, yaml)
110
- fb = Factbase.new
116
+ def test_one(fb, opts, judge, tname, yaml, assert: true)
111
117
  inputs = yaml['input']
112
118
  inputs&.each do |i|
113
119
  f = fb.insert
@@ -127,6 +133,7 @@ class Judges::Test
127
133
  fbx = fb
128
134
  fbx = Factbase::Looged.new(fb, @loog) if opts['log']
129
135
  judge.run(fbx, {}, {}, options)
136
+ next unless assert
130
137
  assert(judge, tname, fb, yaml) if r == runs || opts['assert_once'].is_a?(FalseClass)
131
138
  end
132
139
  end
data/lib/judges/judges.rb CHANGED
@@ -34,8 +34,16 @@ class Judges::Judges
34
34
  @loog = loog
35
35
  end
36
36
 
37
+ # Get one judge by name.
38
+ # @return [Judge]
39
+ def get(name)
40
+ d = File.absolute_path(File.join(@dir, name))
41
+ raise "Judge #{name} doesn't exist in #{@dir}" unless File.exist?(d)
42
+ Judges::Judge.new(d, @lib, @loog)
43
+ end
44
+
37
45
  # Iterate over them all.
38
- # @yield [Pack]
46
+ # @yield [Judge]
39
47
  def each
40
48
  Dir.glob(File.join(@dir, '**/*.rb')).each do |f|
41
49
  d = File.dirname(File.absolute_path(f))
@@ -44,7 +52,7 @@ class Judges::Judges
44
52
  end
45
53
 
46
54
  # Iterate over them all.
47
- # @yield [(Pack, Integer)]
55
+ # @yield [(Judge, Integer)]
48
56
  def each_with_index
49
57
  idx = 0
50
58
  each do |p|
data/lib/judges.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Judges
28
- VERSION = '0.16.0'
28
+ VERSION = '0.18.0'
29
29
  end
@@ -88,6 +88,35 @@ class TestTest < Minitest::Test
88
88
  end
89
89
  end
90
90
 
91
+ def test_with_before
92
+ Dir.mktmpdir do |d|
93
+ home = File.join(d, 'judges')
94
+ FileUtils.mkdir_p(File.join(home, 'first'))
95
+ File.write(File.join(d, 'judges/first/the-first.rb'), '$fb.insert.foo = 42')
96
+ FileUtils.mkdir_p(File.join(home, 'second'))
97
+ File.write(File.join(d, 'judges/second/the-second.rb'), '$fb.insert.foo = 55')
98
+ File.write(
99
+ File.join(d, 'judges/first/something.yml'),
100
+ <<-YAML
101
+ input: []
102
+ expected:
103
+ - /fb[count(f)=1]
104
+ YAML
105
+ )
106
+ File.write(
107
+ File.join(d, 'judges/second/something.yml'),
108
+ <<-YAML
109
+ input: []
110
+ before:
111
+ - first
112
+ expected:
113
+ - /fb[count(f)=2]
114
+ YAML
115
+ )
116
+ Judges::Test.new(Loog::NULL).run({}, [home])
117
+ end
118
+ end
119
+
91
120
  def test_one_judge_negative
92
121
  Dir.mktmpdir do |d|
93
122
  File.write(File.join(d, 'foo.rb'), '')
data/test/test__helper.rb CHANGED
@@ -29,3 +29,6 @@ require 'simplecov-cobertura'
29
29
  SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
30
30
 
31
31
  require 'minitest/autorun'
32
+
33
+ require 'minitest/reporters'
34
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
data/test/test_baza.rb CHANGED
@@ -89,6 +89,21 @@ class TestBaza < Minitest::Test
89
89
  assert(req.include?("X-Zerocracy-Meta: Ym9vbSE= 0YXQtdC5IQ==\r\n"))
90
90
  end
91
91
 
92
+ def test_push_with_big_meta
93
+ req = with_http_server(200, 'yes') do |baza|
94
+ baza.push(
95
+ 'simple',
96
+ 'hello, world!',
97
+ [
98
+ 'pages_url:https://zerocracy.github.io/zerocracy.html',
99
+ 'others:https://zerocracy.github.io/zerocracy.html',
100
+ 'duration:59595'
101
+ ]
102
+ )
103
+ end
104
+ assert(req.join.include?('X-Zerocracy-Meta: '))
105
+ end
106
+
92
107
  private
93
108
 
94
109
  def with_http_server(code, response)
data/test/test_judges.rb CHANGED
@@ -30,7 +30,7 @@ require_relative '../lib/judges/judges'
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
31
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
32
32
  # License:: MIT
33
- class TestPacks < Minitest::Test
33
+ class TestJudges < Minitest::Test
34
34
  def test_basic
35
35
  Dir.mktmpdir do |d|
36
36
  File.write(File.join(d, 'foo.rb'), 'hey')
@@ -44,4 +44,14 @@ class TestPacks < Minitest::Test
44
44
  assert_equal(1, found)
45
45
  end
46
46
  end
47
+
48
+ def test_get_one
49
+ Dir.mktmpdir do |d|
50
+ f = File.join(d, 'boo/foo.rb')
51
+ FileUtils.mkdir_p(File.dirname(f))
52
+ File.write(f, 'hey')
53
+ j = Judges::Judges.new(d, nil, Loog::NULL).get('boo')
54
+ assert_equal('foo.rb', j.script)
55
+ end
56
+ end
47
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-12 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace