shoulda-matchers 4.1.2 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.md +168 -86
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +4 -2
- data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +3 -2
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +26 -21
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +6 -8
- data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +6 -8
- data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +16 -13
- data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +2 -1
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -6
- data/lib/shoulda/matchers/action_controller/route_params.rb +1 -1
- data/lib/shoulda/matchers/action_controller/set_session_or_flash_matcher.rb +19 -13
- data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +18 -16
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +31 -29
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb +1 -1
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +5 -5
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb +2 -2
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb +1 -1
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb +1 -1
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +51 -25
- data/lib/shoulda/matchers/active_model/helpers.rb +1 -1
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +32 -30
- data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb +1 -1
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +9 -1
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +9 -8
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +28 -46
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +33 -9
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +71 -26
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +31 -6
- data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +2 -4
- data/lib/shoulda/matchers/active_model/validation_message_finder.rb +2 -4
- data/lib/shoulda/matchers/active_model/validator.rb +3 -3
- data/lib/shoulda/matchers/active_record.rb +26 -23
- data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +6 -3
- data/lib/shoulda/matchers/active_record/association_matcher.rb +100 -44
- data/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb +5 -2
- data/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb +4 -4
- data/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +11 -6
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +14 -15
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +30 -8
- data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +23 -5
- data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb +3 -2
- data/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb +7 -5
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +185 -0
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +40 -18
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
- data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +12 -10
- data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +83 -0
- data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +30 -9
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +13 -9
- data/lib/shoulda/matchers/active_record/uniqueness.rb +1 -1
- data/lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb +1 -3
- data/lib/shoulda/matchers/active_record/uniqueness/test_models.rb +0 -2
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +80 -73
- data/lib/shoulda/matchers/doublespeak.rb +2 -1
- data/lib/shoulda/matchers/doublespeak/double.rb +1 -1
- data/lib/shoulda/matchers/doublespeak/double_collection.rb +3 -3
- data/lib/shoulda/matchers/doublespeak/double_implementation_registry.rb +8 -5
- data/lib/shoulda/matchers/doublespeak/object_double.rb +1 -1
- data/lib/shoulda/matchers/doublespeak/stub_implementation.rb +1 -5
- data/lib/shoulda/matchers/doublespeak/world.rb +2 -2
- data/lib/shoulda/matchers/error.rb +1 -1
- data/lib/shoulda/matchers/independent.rb +0 -1
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +14 -13
- data/lib/shoulda/matchers/integrations/configuration.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -2
- data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
- data/lib/shoulda/matchers/rails_shim.rb +10 -21
- data/lib/shoulda/matchers/util.rb +16 -4
- data/lib/shoulda/matchers/util/word_wrap.rb +8 -8
- data/lib/shoulda/matchers/version.rb +1 -1
- data/lib/shoulda/matchers/warn.rb +3 -3
- data/shoulda-matchers.gemspec +10 -7
- metadata +11 -9
- data/lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb +0 -37
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tammer Saleh
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: activesupport
|
@@ -30,15 +30,15 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 4.2.0
|
33
|
-
description: Shoulda Matchers provides RSpec- and Minitest-compatible one-liners
|
34
|
-
test common Rails functionality that, if written by hand, would be much longer,
|
35
|
-
more complex, and error-prone.
|
33
|
+
description: 'Shoulda Matchers provides RSpec- and Minitest-compatible one-liners
|
34
|
+
to test common Rails functionality that, if written by hand, would be much longer,
|
35
|
+
more complex, and error-prone. '
|
36
36
|
email: support@thoughtbot.com
|
37
37
|
executables: []
|
38
38
|
extensions: []
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
|
-
-
|
41
|
+
- LICENSE
|
42
42
|
- README.md
|
43
43
|
- docs/errors/NonCaseSwappableValueError.md
|
44
44
|
- lib/shoulda-matchers.rb
|
@@ -113,9 +113,12 @@ files:
|
|
113
113
|
- lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb
|
114
114
|
- lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb
|
115
115
|
- lib/shoulda/matchers/active_record/define_enum_for_matcher.rb
|
116
|
+
- lib/shoulda/matchers/active_record/have_attached_matcher.rb
|
116
117
|
- lib/shoulda/matchers/active_record/have_db_column_matcher.rb
|
117
118
|
- lib/shoulda/matchers/active_record/have_db_index_matcher.rb
|
119
|
+
- lib/shoulda/matchers/active_record/have_implicit_order_column.rb
|
118
120
|
- lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb
|
121
|
+
- lib/shoulda/matchers/active_record/have_rich_text_matcher.rb
|
119
122
|
- lib/shoulda/matchers/active_record/have_secure_token_matcher.rb
|
120
123
|
- lib/shoulda/matchers/active_record/serialize_matcher.rb
|
121
124
|
- lib/shoulda/matchers/active_record/uniqueness.rb
|
@@ -137,7 +140,6 @@ files:
|
|
137
140
|
- lib/shoulda/matchers/error.rb
|
138
141
|
- lib/shoulda/matchers/independent.rb
|
139
142
|
- lib/shoulda/matchers/independent/delegate_method_matcher.rb
|
140
|
-
- lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb
|
141
143
|
- lib/shoulda/matchers/independent/delegate_method_matcher/target_not_defined_error.rb
|
142
144
|
- lib/shoulda/matchers/integrations.rb
|
143
145
|
- lib/shoulda/matchers/integrations/configuration.rb
|
@@ -172,7 +174,7 @@ licenses:
|
|
172
174
|
- MIT
|
173
175
|
metadata:
|
174
176
|
bug_tracker_uri: https://github.com/thoughtbot/shoulda-matchers/issues
|
175
|
-
changelog_uri: https://github.com/thoughtbot/shoulda-matchers/blob/master/
|
177
|
+
changelog_uri: https://github.com/thoughtbot/shoulda-matchers/blob/master/CHANGELOG.md
|
176
178
|
documentation_uri: https://matchers.shoulda.io/docs
|
177
179
|
homepage_uri: https://matchers.shoulda.io
|
178
180
|
source_code_uri: https://github.com/thoughtbot/shoulda-matchers
|
@@ -191,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
193
|
- !ruby/object:Gem::Version
|
192
194
|
version: '0'
|
193
195
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
196
|
+
rubygems_version: 3.1.4
|
195
197
|
signing_key:
|
196
198
|
specification_version: 4
|
197
199
|
summary: Simple one-liner tests for common Rails functionality
|
@@ -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
|