shoulda-matchers 4.1.1 → 4.4.1
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 +4 -4
- data/README.md +163 -79
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +5 -1
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +2 -21
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +27 -3
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +32 -0
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +6 -9
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +25 -0
- data/lib/shoulda/matchers/active_record.rb +3 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +23 -7
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +12 -6
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +20 -3
- data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +147 -0
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
- data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +79 -0
- data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +28 -9
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +2 -6
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +2 -2
- data/lib/shoulda/matchers/independent.rb +0 -1
- data/lib/shoulda/matchers/rails_shim.rb +42 -44
- data/lib/shoulda/matchers/util.rb +9 -2
- data/lib/shoulda/matchers/util/word_wrap.rb +1 -1
- data/lib/shoulda/matchers/version.rb +1 -1
- metadata +9 -8
- data/MIT-LICENSE +0 -22
- data/lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb +0 -37
@@ -4,6 +4,8 @@ module Shoulda
|
|
4
4
|
module Matchers
|
5
5
|
# @private
|
6
6
|
module Util
|
7
|
+
MAXIMUM_LENGTH_OF_VALUE_TO_DISPLAY = 500
|
8
|
+
|
7
9
|
def self.deconstantize(path)
|
8
10
|
if defined?(ActiveSupport::Inflector) &&
|
9
11
|
ActiveSupport::Inflector.respond_to?(:deconstantize)
|
@@ -47,7 +49,12 @@ module Shoulda
|
|
47
49
|
when Range
|
48
50
|
inspect_range(value)
|
49
51
|
else
|
50
|
-
|
52
|
+
inspected_value = value.inspect
|
53
|
+
if inspected_value.length > MAXIMUM_LENGTH_OF_VALUE_TO_DISPLAY
|
54
|
+
"‹#{inspected_value[0, MAXIMUM_LENGTH_OF_VALUE_TO_DISPLAY]}...›"
|
55
|
+
else
|
56
|
+
"‹#{inspected_value}›"
|
57
|
+
end
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
@@ -85,7 +92,7 @@ module Shoulda
|
|
85
92
|
when :datetime, :timestamp
|
86
93
|
DateTime.new(2100, 1, 1)
|
87
94
|
when :time
|
88
|
-
Time.new(
|
95
|
+
Time.new(2000, 1, 1)
|
89
96
|
when :uuid
|
90
97
|
SecureRandom.uuid
|
91
98
|
when :boolean
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tammer Saleh
|
@@ -11,10 +11,10 @@ authors:
|
|
11
11
|
- Matt Jankowski
|
12
12
|
- Stafford Brunk
|
13
13
|
- Elliot Winkler
|
14
|
-
autorequire:
|
14
|
+
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: activesupport
|
@@ -38,7 +38,6 @@ executables: []
|
|
38
38
|
extensions: []
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
|
-
- MIT-LICENSE
|
42
41
|
- README.md
|
43
42
|
- docs/errors/NonCaseSwappableValueError.md
|
44
43
|
- lib/shoulda-matchers.rb
|
@@ -113,9 +112,12 @@ files:
|
|
113
112
|
- lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb
|
114
113
|
- lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb
|
115
114
|
- lib/shoulda/matchers/active_record/define_enum_for_matcher.rb
|
115
|
+
- lib/shoulda/matchers/active_record/have_attached_matcher.rb
|
116
116
|
- lib/shoulda/matchers/active_record/have_db_column_matcher.rb
|
117
117
|
- lib/shoulda/matchers/active_record/have_db_index_matcher.rb
|
118
|
+
- lib/shoulda/matchers/active_record/have_implicit_order_column.rb
|
118
119
|
- lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb
|
120
|
+
- lib/shoulda/matchers/active_record/have_rich_text_matcher.rb
|
119
121
|
- lib/shoulda/matchers/active_record/have_secure_token_matcher.rb
|
120
122
|
- lib/shoulda/matchers/active_record/serialize_matcher.rb
|
121
123
|
- lib/shoulda/matchers/active_record/uniqueness.rb
|
@@ -137,7 +139,6 @@ files:
|
|
137
139
|
- lib/shoulda/matchers/error.rb
|
138
140
|
- lib/shoulda/matchers/independent.rb
|
139
141
|
- lib/shoulda/matchers/independent/delegate_method_matcher.rb
|
140
|
-
- lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb
|
141
142
|
- lib/shoulda/matchers/independent/delegate_method_matcher/target_not_defined_error.rb
|
142
143
|
- lib/shoulda/matchers/integrations.rb
|
143
144
|
- lib/shoulda/matchers/integrations/configuration.rb
|
@@ -176,7 +177,7 @@ metadata:
|
|
176
177
|
documentation_uri: https://matchers.shoulda.io/docs
|
177
178
|
homepage_uri: https://matchers.shoulda.io
|
178
179
|
source_code_uri: https://github.com/thoughtbot/shoulda-matchers
|
179
|
-
post_install_message:
|
180
|
+
post_install_message:
|
180
181
|
rdoc_options: []
|
181
182
|
require_paths:
|
182
183
|
- lib
|
@@ -191,8 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
192
|
- !ruby/object:Gem::Version
|
192
193
|
version: '0'
|
193
194
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
195
|
-
signing_key:
|
195
|
+
rubygems_version: 3.1.2
|
196
|
+
signing_key:
|
196
197
|
specification_version: 4
|
197
198
|
summary: Simple one-liner tests for common Rails functionality
|
198
199
|
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2006-2019, Tammer Saleh and thoughtbot, inc.
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person
|
4
|
-
obtaining a copy of this software and associated documentation
|
5
|
-
files (the "Software"), to deal in the Software without
|
6
|
-
restriction, including without limitation the rights to use,
|
7
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the
|
9
|
-
Software is furnished to do so, subject to the following
|
10
|
-
conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Shoulda
|
2
|
-
module Matchers
|
3
|
-
module Independent
|
4
|
-
class DelegateMethodMatcher
|
5
|
-
# @private
|
6
|
-
class StubbedTarget
|
7
|
-
def initialize(method)
|
8
|
-
@received_method = false
|
9
|
-
@received_arguments = []
|
10
|
-
stub_method(method)
|
11
|
-
end
|
12
|
-
|
13
|
-
def has_received_method?
|
14
|
-
received_method
|
15
|
-
end
|
16
|
-
|
17
|
-
def has_received_arguments?(*args)
|
18
|
-
args == received_arguments
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def stub_method(method)
|
24
|
-
class_eval do
|
25
|
-
define_method method do |*args|
|
26
|
-
@received_method = true
|
27
|
-
@received_arguments = args
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
attr_reader :received_method, :received_arguments
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|