Module: Shoulda::Matchers
- Extended by:
- WordWrap
- Defined in:
- lib/shoulda/matchers.rb,
lib/shoulda/matchers/util.rb,
lib/shoulda/matchers/warn.rb,
lib/shoulda/matchers/error.rb,
lib/shoulda/matchers/routing.rb,
lib/shoulda/matchers/version.rb,
lib/shoulda/matchers/rails_shim.rb,
lib/shoulda/matchers/doublespeak.rb,
lib/shoulda/matchers/independent.rb,
lib/shoulda/matchers/active_model.rb,
lib/shoulda/matchers/integrations.rb,
lib/shoulda/matchers/active_record.rb,
lib/shoulda/matchers/configuration.rb,
lib/shoulda/matchers/util/word_wrap.rb,
lib/shoulda/matchers/matcher_context.rb,
lib/shoulda/matchers/action_controller.rb,
lib/shoulda/matchers/doublespeak/world.rb,
lib/shoulda/matchers/doublespeak/double.rb,
lib/shoulda/matchers/integrations/rails.rb,
lib/shoulda/matchers/active_model/errors.rb,
lib/shoulda/matchers/active_model/helpers.rb,
lib/shoulda/matchers/integrations/registry.rb,
lib/shoulda/matchers/active_model/validator.rb,
lib/shoulda/matchers/integrations/inclusion.rb,
lib/shoulda/matchers/integrations/libraries.rb,
lib/shoulda/matchers/active_model/qualifiers.rb,
lib/shoulda/matchers/doublespeak/method_call.rb,
lib/shoulda/matchers/active_record/uniqueness.rb,
lib/shoulda/matchers/doublespeak/object_double.rb,
lib/shoulda/matchers/integrations/configuration.rb,
lib/shoulda/matchers/integrations/libraries/rails.rb,
lib/shoulda/matchers/integrations/test_frameworks.rb,
lib/shoulda/matchers/action_controller/flash_store.rb,
lib/shoulda/matchers/active_record/encrypt_matcher.rb,
lib/shoulda/matchers/doublespeak/double_collection.rb,
lib/shoulda/matchers/action_controller/route_params.rb,
lib/shoulda/matchers/active_record/uniqueness/model.rb,
lib/shoulda/matchers/integrations/libraries/routing.rb,
lib/shoulda/matchers/action_controller/route_matcher.rb,
lib/shoulda/matchers/action_controller/session_store.rb,
lib/shoulda/matchers/active_model/comparison_matcher.rb,
lib/shoulda/matchers/active_model/validation_matcher.rb,
lib/shoulda/matchers/active_record/normalize_matcher.rb,
lib/shoulda/matchers/active_record/serialize_matcher.rb,
lib/shoulda/matchers/doublespeak/stub_implementation.rb,
lib/shoulda/matchers/action_controller/permit_matcher.rb,
lib/shoulda/matchers/active_model/allow_value_matcher.rb,
lib/shoulda/matchers/doublespeak/proxy_implementation.rb,
lib/shoulda/matchers/integrations/configuration_error.rb,
lib/shoulda/matchers/active_model/qualifiers/allow_nil.rb,
lib/shoulda/matchers/active_record/association_matcher.rb,
lib/shoulda/matchers/action_controller/callback_matcher.rb,
lib/shoulda/matchers/active_model/numericality_matchers.rb,
lib/shoulda/matchers/active_record/association_matchers.rb,
lib/shoulda/matchers/active_record/uniqueness/namespace.rb,
lib/shoulda/matchers/integrations/test_frameworks/rspec.rb,
lib/shoulda/matchers/action_controller/set_flash_matcher.rb,
lib/shoulda/matchers/active_model/disallow_value_matcher.rb,
lib/shoulda/matchers/active_model/qualifiers/allow_blank.rb,
lib/shoulda/matchers/active_record/have_attached_matcher.rb,
lib/shoulda/matchers/active_record/have_db_index_matcher.rb,
lib/shoulda/matchers/independent/delegate_method_matcher.rb,
lib/shoulda/matchers/integrations/libraries/active_model.rb,
lib/shoulda/matchers/active_record/have_db_column_matcher.rb,
lib/shoulda/matchers/active_record/have_rich_text_matcher.rb,
lib/shoulda/matchers/active_record/uniqueness/test_models.rb,
lib/shoulda/matchers/integrations/libraries/active_record.rb,
lib/shoulda/matchers/action_controller/redirect_to_matcher.rb,
lib/shoulda/matchers/action_controller/rescue_from_matcher.rb,
lib/shoulda/matchers/action_controller/set_session_matcher.rb,
lib/shoulda/matchers/active_record/define_enum_for_matcher.rb,
lib/shoulda/matchers/action_controller/filter_param_matcher.rb,
lib/shoulda/matchers/action_controller/respond_with_matcher.rb,
lib/shoulda/matchers/active_model/validation_message_finder.rb,
lib/shoulda/matchers/integrations/libraries/missing_library.rb,
lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb,
lib/shoulda/matchers/active_model/validate_length_of_matcher.rb,
lib/shoulda/matchers/active_record/have_secure_token_matcher.rb,
lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb,
lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb,
lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb,
lib/shoulda/matchers/active_record/have_implicit_order_column.rb,
lib/shoulda/matchers/integrations/libraries/action_controller.rb,
lib/shoulda/matchers/action_controller/render_template_matcher.rb,
lib/shoulda/matchers/active_model/have_secure_password_matcher.rb,
lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb,
lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb,
lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb,
lib/shoulda/matchers/doublespeak/double_implementation_registry.rb,
lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb,
lib/shoulda/matchers/active_model/validate_comparison_of_matcher.rb,
lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb,
lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb,
lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb,
lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb,
lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb,
lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb,
lib/shoulda/matchers/action_controller/set_session_or_flash_matcher.rb,
lib/shoulda/matchers/active_model/numericality_matchers/submatchers.rb,
lib/shoulda/matchers/active_model/numericality_matchers/range_matcher.rb,
lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/successful_check.rb,
lib/shoulda/matchers/active_model/validation_matcher/build_description.rb,
lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb,
lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb,
lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb,
lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb,
lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/successful_setting.rb,
lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb,
lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb,
lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb,
lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb,
lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb,
lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb,
lib/shoulda/matchers/active_model/qualifiers/ignore_interference_by_writer.rb,
lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb,
lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb,
lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb,
lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb,
lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb,
lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb,
lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb,
lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb,
lib/shoulda/matchers/independent/delegate_method_matcher/target_not_defined_error.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb,
lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb
Overview
Defined Under Namespace
Modules: ActionController, ActiveModel, ActiveRecord, Doublespeak, Independent, Integrations, RailsShim, Routing, Util, WordWrap
Classes: Configuration, Document, Error, ExampleClass, Line, MatcherContext, Paragraph, Text
Constant Summary
collapse
- TERMINAL_MAX_WIDTH =
72
- VERSION =
'6.4.0'.freeze
Constants included
from WordWrap
WordWrap::TERMINAL_WIDTH
Class Attribute Summary collapse
Class Method Summary
collapse
Methods included from WordWrap
word_wrap
Class Attribute Details
.assertion_exception_class ⇒ Object
21
22
23
|
# File 'lib/shoulda/matchers.rb', line 21
def assertion_exception_class
@assertion_exception_class
end
|
Class Method Details
.configuration ⇒ Object
14
15
16
|
# File 'lib/shoulda/matchers/configuration.rb', line 14
def self.configuration
@_configuration ||= Configuration.new
end
|
4
5
6
|
# File 'lib/shoulda/matchers/configuration.rb', line 4
def self.configure
yield configuration
end
|
.integrations ⇒ Object
9
10
11
|
# File 'lib/shoulda/matchers/configuration.rb', line 9
def self.integrations
configuration.integrations
end
|
.warn(message) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/shoulda/matchers/warn.rb', line 7
def self.warn(message)
= 'Warning from shoulda-matchers:'
divider = '*' * TERMINAL_MAX_WIDTH
wrapped_message = word_wrap(message)
full_message = [
divider,
[, wrapped_message.strip].join("\n\n"),
divider,
].join("\n")
Kernel.warn(full_message)
end
|
.warn_about_deprecated_method(old_method, new_method) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/shoulda/matchers/warn.rb', line 21
def self.warn_about_deprecated_method(old_method, new_method)
warn <<EOT
#{old_method} is deprecated and will be removed in the next major
release. Please use #{new_method} instead.
EOT
end
|