prolog_minitest_matchers 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 6f1a77deacdc56584c7dda771581deb918197253
4
- data.tar.gz: da3f27d505485c4173f65e19da6035ca47a383a8
3
+ metadata.gz: ab049cc38b44bfdecd13c19a184ff1dac0d609a4
4
+ data.tar.gz: 33b6c5cff963db9feb2fad4cfd94505faca65b9c
5
5
  SHA512:
6
- metadata.gz: e3e26ac2e6f13cf5e96c0e36badff81cb7c55c166711aca43069e559c06f845d744d43ce8134b78c163ab2eceb1f0f31a5696414bdafa08b9e3ba911326fd15e
7
- data.tar.gz: 6e995e08d224b4c03120aea2a42dfdcfafb8040ec253b7feb23c31bbcc34b2e406b472cc773c35c054ca3499962f58d9eb7dd630470013ae35f1750c05bfe03e
6
+ metadata.gz: ebc734a912e7341c0624451313f561298385ff8a4cddf0adcd7a9f7695836d81d820b55e85d444c54c046a22d87df8c42cb8047338995299f9a86effb783060b
7
+ data.tar.gz: bbefa511547f71a3427981bec221a8b15b9c24f6d02022c1961e5ee2859bf2c5ae08a6f27e66304cc07a57510db1c9a34501a0dfacd981d2a9350af7a7939451
@@ -42,7 +42,7 @@ module MiniTest
42
42
  module Internals
43
43
  def self.hash_without_key(hash, key)
44
44
  VerifyKeyInHash.call hash, key
45
- hash.dup.reject { |source_key, _| source_key == key }
45
+ hash.reject { |source_key, _| source_key == key }
46
46
  end
47
47
  end
48
48
  private_constant :Internals
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/spec'
4
+
5
+ # require_relative './asserters/assert_requires_static_call_param.rb'
6
+
7
+ module MiniTest
8
+ # Adding custom assertions to make specs easier to read
9
+ module Assertions
10
+ def assert_reports_failure_as(call_result, hash_pair, mesg_in = nil)
11
+ as_expected = ARFAInternals.reports_failure_as(call_result, hash_pair)
12
+ message = ARFAInternals.assert_message_for hash_pair, call_result, mesg_in
13
+ assert as_expected, message
14
+ end
15
+
16
+ def refute_reports_failure_as(call_result, hash_pair, mesg_in = nil)
17
+ as_expected = !ARFAInternals.reports_failure_as(call_result, hash_pair)
18
+ message = ARFAInternals.refute_message_for hash_pair, call_result, mesg_in
19
+ assert as_expected, message
20
+ end
21
+
22
+ # Stateless methods for `assert_report_failure_as` and refutation thereof.
23
+ module ARFAInternals
24
+ # Reek complains about :reek:ControlParameter` for `message`. Tough.
25
+ def self.assert_message_for(hash_pair, call_result, message)
26
+ message || _default_message_for(hash_pair, call_result, 'to find')
27
+ end
28
+
29
+ # Reek complains about :reek:ControlParameter` for `message`. Tough.
30
+ def self.refute_message_for(hash_pair, call_result, message)
31
+ message || _default_message_for(hash_pair, call_result, 'not to find')
32
+ end
33
+
34
+ def self.reports_failure_as(call_result, hash_pair)
35
+ call_result.failure? && call_result.errors.include?(hash_pair)
36
+ end
37
+
38
+ def self._default_message_for(hash_pair, call_result, what)
39
+ "Expected #{what} error with key #{hash_pair.keys.first} and " \
40
+ "value #{hash_pair.values.first}; was #{call_result.errors}"
41
+ end
42
+ end
43
+ private_constant :ARFAInternals
44
+ end # module Assertions
45
+
46
+ # Make it available to MiniTest::Spec
47
+ module Expectations
48
+ infect_an_assertion :assert_reports_failure_as, :must_report_failure_as,
49
+ true
50
+ infect_an_assertion :refute_reports_failure_as, :wont_report_failure_as,
51
+ true
52
+ end
53
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Module to satisfy Gem requirements; nothing inside but version-spec constant.
4
4
  module PrologMinitestMatchers
5
- VERSION = '0.4.0'
5
+ VERSION = '0.5.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prolog_minitest_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dickey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-14 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -273,6 +273,7 @@ files:
273
273
  - lib/prolog_minitest_matchers/matchers/asserters/base_assert_required_parameter.rb
274
274
  - lib/prolog_minitest_matchers/matchers/asserters/induce_error.rb
275
275
  - lib/prolog_minitest_matchers/matchers/asserters/verify_key_in_hash.rb
276
+ - lib/prolog_minitest_matchers/matchers/reports_failure_as.rb
276
277
  - lib/prolog_minitest_matchers/matchers/requires_dry_struct_attribute.rb
277
278
  - lib/prolog_minitest_matchers/matchers/requires_initialize_parameter.rb
278
279
  - lib/prolog_minitest_matchers/matchers/requires_static_call_param.rb