mumukit 2.40.0 → 2.41.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: 7df39585e9af97eafeaa33f6189749ed29458e5a55ab37cf3339ae4200fc3f97
4
- data.tar.gz: 0d272a7e75b9cd754314cdaafac2e3158b3b80374e88099be3633066d0098ef0
3
+ metadata.gz: 50c02218ee8201dec0cafb926af1244f37005ca30defbf277647e8f578b80b5f
4
+ data.tar.gz: ca71b312b3b89e4af2601a30248d25e218c2cfa2e51144f839996e12d097bdf8
5
5
  SHA512:
6
- metadata.gz: 7d7868073a960f5c0476bb8dd09aa84bb3d3aa1427ea1fef0700c4d664778cb40c60a18f6db212fc641e784839913e17ba23863788c393535b186764e2f44cdb
7
- data.tar.gz: ca71c3f73c932143b403e4758e110f1e2f209f15cca3ada46365f95bc4974bef8042939e558ac5e11ef6e280b239dbd5abc48aa836fd8206b6098904b3473141
6
+ metadata.gz: 1d7a38c84758cfc37544a392215164550c8adf7885d7fc4bc836e96dada9436a4f1a542b7c7ccc82dde5590d787e8f906b9d7fef711b3db1b2e27e9b21628b8d
7
+ data.tar.gz: aa52beb81dff6b2986ac84aaa400c15cd3bec40f6947b8286b9b62ec2eb315bce5a7ff04b99c89927339cd54021e34ec37c583a5927eb98515337dacb9d4cca8
data/lib/locales/en.yml CHANGED
@@ -6,7 +6,7 @@ en:
6
6
  interactive:
7
7
  check_last_query_equals: "query should be '%{expected}' but was '%{actual}'"
8
8
  check_last_query_fails: "query should fail but it passed"
9
- check_last_query_matches: "query does not match regex %{regex}"
9
+ check_last_query_matches: "query does not match regexp %{regexp}"
10
10
  check_last_query_outputs: "query output should be '%{expected}' but was '%{actual}'"
11
11
  check_last_query_includes: "query output should include '%{expected}' but was '%{actual}'"
12
12
  check_last_query_like: "query output should be like '%{expected}' but was '%{actual}'"
@@ -15,3 +15,4 @@ en:
15
15
  check_query_outputs: "query '%{query}' output should be '%{expected}' but was '%{actual}'"
16
16
  check_query_passes: "query '%{query}' should pass but it failed"
17
17
  goal_passed: "goal was met successfully"
18
+ check_queries_match: "All the required queries must be executed"
@@ -6,7 +6,7 @@ es-CL:
6
6
  interactive:
7
7
  check_last_query_equals: "La consulta debería ser '%{expected}' pero fue '%{actual}'"
8
8
  check_last_query_fails: "La consulta debería fallar pero pasó"
9
- check_last_query_matches: "La consulta no cumple con la expresión regular %{regex}"
9
+ check_last_query_matches: "La consulta no cumple con la expresión regular %{regexp}"
10
10
  check_last_query_outputs: "La consulta debería devolver '%{expected}' pero devolvió '%{actual}'"
11
11
  check_last_query_includes: "La consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
12
12
  check_last_query_like: "La consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
@@ -15,3 +15,4 @@ es-CL:
15
15
  check_query_outputs: "La consulta '%{query}' debería devolver '%{expected}' pero devolvió '%{actual}'"
16
16
  check_query_passes: "La consulta '%{query}' debería pasar pero falló"
17
17
  goal_passed: "El objetivo se cumplió exitosamente"
18
+ check_queries_match: "Se deben realizar todas las consultas solicitadas"
data/lib/locales/es.yml CHANGED
@@ -6,7 +6,7 @@ es:
6
6
  interactive:
7
7
  check_last_query_equals: "La consulta debería ser '%{expected}' pero fue '%{actual}'"
8
8
  check_last_query_fails: "La consulta debería fallar pero pasó"
9
- check_last_query_matches: "La consulta no cumple con la expresión regular %{regex}"
9
+ check_last_query_matches: "La consulta no cumple con la expresión regular %{regexp}"
10
10
  check_last_query_outputs: "La consulta debería devolver '%{expected}' pero devolvió '%{actual}'"
11
11
  check_last_query_includes: "La consulta debería incluir '%{expected}' pero devolvió '%{actual}'"
12
12
  check_last_query_like: "La consulta debería ser como '%{expected}' pero devolvió '%{actual}'"
@@ -14,4 +14,5 @@ es:
14
14
  check_query_fails: "La consulta '%{query}' debería fallar pero pasó"
15
15
  check_query_outputs: "La consulta '%{query}' debería devolver '%{expected}' pero devolvió '%{actual}'"
16
16
  check_query_passes: "La consulta '%{query}' debería pasar pero falló"
17
+ check_queries_match: "Se deben realizar todas las consultas solicitadas"
17
18
  goal_passed: "El objetivo se cumplió exitosamente"
data/lib/locales/pt.yml CHANGED
@@ -6,7 +6,7 @@ pt:
6
6
  interactive:
7
7
  check_last_query_equals: "a consulta deve ser '%{expected}' mas foi '%{actual}'"
8
8
  check_last_query_fails: "a consulta deve falhar, mas passou"
9
- check_last_query_matches: "A consulta não corresponde a regex %{regex}"
9
+ check_last_query_matches: "A consulta não corresponde a regex %{regexp}"
10
10
  check_last_query_outputs: "O resultado da consulta deve ser '%{expected}', mas foi '%{actual}'"
11
11
  check_last_query_includes: "O resultado da consulta deve incluir '%{expected}', mas foi '%{actual}'"
12
12
  check_last_query_like: "O resultado da consulta deve ser como '%{expected}', mas foi '%{actual}'"
@@ -14,4 +14,5 @@ pt:
14
14
  check_query_fails: "a consulta '%{query}' deve falhar, mas passou"
15
15
  check_query_outputs: "a consulta '%{query}' deve ser '%{expected}', mas foi '%{actual}'"
16
16
  check_query_passes: "a consulta '%{query}' deve passar, mas falhou"
17
+ check_queries_match: "Todas as consultas solicitadas devem ser feitas"
17
18
  goal_passed: "O objetivo foi alcançado com sucesso"
@@ -7,7 +7,7 @@ module Mumukit
7
7
  end
8
8
 
9
9
  def matches?(result, status)
10
- @status.like?(status) && @regexp.matches?(result)
10
+ @status.like?(status) && @regexp.match?(result)
11
11
  end
12
12
 
13
13
  def sanitize(result)
@@ -1,25 +1,33 @@
1
1
  module Mumukit::Metatest
2
2
  class InteractiveChecker < Checker
3
3
 
4
- def initialize(request)
4
+ def initialize(request, strip_mode: :left_and_right)
5
5
  @request = request
6
+ @strip_mode = strip_mode
6
7
  end
7
8
 
8
9
  def check_last_query_equals(_result, goal)
9
10
  expected = goal[:value]
10
- actual = @request.query.strip
11
+ actual = query
11
12
  fail_t :check_last_query_equals, expected: expected, actual: actual unless expected == actual
12
13
  end
13
14
 
14
15
  def check_last_query_matches(_result, goal)
15
- regex = goal[:regexp]
16
- fail_t :check_last_query_matches, regex: regex.inspect unless regex.matches? @request.query
16
+ regexp = goal[:regexp]
17
+ fail_t :check_last_query_matches, regexp: regexp.inspect unless query.match?(regexp)
17
18
  end
18
19
 
19
20
  def check_last_query_fails(result, _goal)
20
21
  fail_t :check_last_query_fails unless result[:query][:status].failed?
21
22
  end
22
23
 
24
+ def check_queries_match(result, goal)
25
+ queries = [query] + @request.cookie.to_a
26
+ fail_t :check_queries_match unless goal[:regexps].all? do |regexp|
27
+ queries.any? { |query| query.match? regexp }
28
+ end
29
+ end
30
+
23
31
  def check_last_query_outputs(result, goal)
24
32
  compare_last_query_by(:check_last_query_outputs, result, goal) { |expected, actual| expected == actual }
25
33
  end
@@ -72,5 +80,11 @@ module Mumukit::Metatest
72
80
  a_string.delete(" \t\r\n").downcase
73
81
  end
74
82
 
83
+ private
84
+
85
+ def query
86
+ query_s = @request.query.to_s
87
+ @strip_mode == :right_only ? query_s.rstrip : query_s.strip
88
+ end
75
89
  end
76
90
  end
@@ -4,7 +4,7 @@ module Mumukit
4
4
  request_goal = request.goal.with_indifferent_access
5
5
 
6
6
  @goal = {postconditions: [[request_goal[:kind], request_goal]]}
7
- @checker = Metatest::InteractiveChecker.new request
7
+ @checker = checker_for request
8
8
  super request
9
9
  end
10
10
 
@@ -14,6 +14,14 @@ module Mumukit
14
14
  [check_results[2], check_results[1], structured_results[:query]]
15
15
  end
16
16
 
17
+ def checker_for(request)
18
+ Metatest::InteractiveChecker.new request, **checker_options
19
+ end
20
+
21
+ def checker_options
22
+ {}
23
+ end
24
+
17
25
  required :to_structured_results
18
26
  end
19
27
  end
@@ -1,3 +1,3 @@
1
1
  module Mumukit
2
- VERSION = '2.40.0'
2
+ VERSION = '2.41.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.40.0
4
+ version: 2.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler