From 663c2f2c4da608197d610318355c81a9f6e929f1 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Sun, 10 Jan 2016 23:19:47 -0700 Subject: [PATCH] Remove most docs for ignoring_interference_by_writer Since `ignoring_interference_by_writer` is on by default now, we don't need to explicitly document it (unless someone wants to turn it off, but that's unlikely). [ci skip] --- .../validate_absence_of_matcher.rb | 33 ----------------- .../validate_acceptance_of_matcher.rb | 33 ----------------- .../validate_exclusion_of_matcher.rb | 35 ------------------ .../validate_inclusion_of_matcher.rb | 36 ------------------- .../validate_length_of_matcher.rb | 35 ------------------ .../validate_numericality_of_matcher.rb | 33 ----------------- .../validate_presence_of_matcher.rb | 33 ----------------- 7 files changed, 238 deletions(-) diff --git a/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb index 7bc45048..7cc1b21a 100644 --- a/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb @@ -70,39 +70,6 @@ module Shoulda # with_message("there shall be peace on Earth") # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and causes it to fail. See - # the documentation for `allow_value` for more information on this. - # - # class PowerHungryCountry - # include ActiveModel::Model - # attr_accessor :nuclear_weapons - # - # validates_absence_of :nuclear_weapons - # - # def nuclear_weapons=(value) - # @nuclear_weapons = value + [:hidden_weapon] - # end - # end - # - # # RSpec - # describe PowerHungryCountry do - # it do - # should validate_absence_of(:nuclear_weapons). - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class PowerHungryCountryTest < ActiveSupport::TestCase - # should validate_absence_of(:nuclear_weapons). - # ignoring_interference_by_writer - # end - # # @return [ValidateAbsenceOfMatcher} # def validate_absence_of(attr) diff --git a/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb index 3286bdf5..1c64d2cb 100644 --- a/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb @@ -73,39 +73,6 @@ module Shoulda # with_message('You must accept the terms of service') # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and cause it to fail. See - # the documentation for `allow_value` for more information on this. - # - # class Registration - # include ActiveModel::Model - # attr_accessor :terms_of_service - # - # validates_acceptance_of :terms_of_service - # - # def terms_of_service=(value) - # @terms_of_service = value || 'something else' - # end - # end - # - # # RSpec - # describe Registration do - # it do - # should validate_acceptance_of(:terms_of_service). - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class RegistrationTest < ActiveSupport::TestCase - # should validate_acceptance_of(:terms_of_service). - # ignoring_interference_by_writer - # end - # # @return [ValidateAcceptanceOfMatcher] # def validate_acceptance_of(attr) diff --git a/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb index 5c029da7..3a0281ce 100644 --- a/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb @@ -112,41 +112,6 @@ module Shoulda # with_message('You chose a puny weapon') # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and cause it to fail. See - # the documentation for `allow_value` for more information on this. - # - # class Game < ActiveRecord::Base - # include ActiveModel::Model - # attr_accessor :weapon - # - # validates_exclusion_of :weapon - # - # def weapon=(value) - # @weapon = value.gsub(' ', '') - # end - # end - # - # # RSpec - # describe Game do - # it do - # should validate_exclusion_of(:weapon). - # in_array(['pistol', 'paintball gun', 'stick']). - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class GameTest < ActiveSupport::TestCase - # should validate_exclusion_of(:weapon). - # in_array(['pistol', 'paintball gun', 'stick']). - # ignoring_interference_by_writer - # end - # # @return [ValidateExclusionOfMatcher] # def validate_exclusion_of(attr) diff --git a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb index a996d295..2b6d94ac 100644 --- a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb @@ -259,42 +259,6 @@ module Shoulda # allow_blank # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and cause it to fail. See - # the documentation for `allow_value` for more information on this. - # - # class Issue - # include ActiveModel::Model - # attr_accessor :state - # - # validates_inclusion_of :state, - # in: ['open', 'resolved', 'unresolved'] - # - # def state=(value) - # @state = 'open' - # end - # end - # - # # RSpec - # describe Issue do - # it do - # should validate_inclusion_of(:state). - # in_array(['open', 'resolved', 'unresolved']). - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class IssueTest < ActiveSupport::TestCase - # should validate_inclusion_of(:state). - # in_array(['open', 'resolved', 'unresolved']). - # ignoring_interference_by_writer - # end - # # @return [ValidateInclusionOfMatcher] # def validate_inclusion_of(attr) diff --git a/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb index f8fd8d62..97fa2f47 100644 --- a/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb @@ -216,41 +216,6 @@ module Shoulda # with_long_message('Secret key must be less than 100 characters') # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and cause it to fail. See - # the documentation for `allow_value` for more information on this. - # - # class User - # include ActiveModel::Model - # attr_accessor :password - # - # validates_length_of :password, minimum: 10 - # - # def password=(value) - # @password = value.upcase - # end - # end - # - # # RSpec - # describe User do - # it do - # should validate_length_of(:password). - # is_at_least(10). - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class UserTest < ActiveSupport::TestCase - # should validate_length_of(:password). - # is_at_least(10). - # ignoring_interference_by_writer - # end - # # @return [ValidateLengthOfMatcher] # def validate_length_of(attr) diff --git a/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb index a6935ab4..93af2dba 100644 --- a/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb @@ -296,39 +296,6 @@ module Shoulda # should validate_numericality_of(:age).allow_nil # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and cause it to fail. See - # the documentation for `allow_value` for more information on this. - # - # Here, `gpa` is an integer column, so it will typecast all values to - # integers. We need to use `ignoring_interference_by_writer` because the - # `only_integer` qualifier will attempt to set `gpa` to a float and assert - # that it makes the record invalid. - # - # class Person < ActiveRecord::Base - # validates_numericality_of :gpa, only_integer: true - # end - # - # # RSpec - # describe Person do - # it do - # should validate_numericality_of(:gpa). - # only_integer. - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class PersonTest < ActiveSupport::TestCase - # should validate_numericality_of(:gpa). - # only_integer. - # ignoring_interference_by_writer - # end - # # @return [ValidateNumericalityOfMatcher] # def validate_numericality_of(attr) diff --git a/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb index c2060ca6..cd24ce42 100644 --- a/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb @@ -103,39 +103,6 @@ module Shoulda # with_message('Robot has no legs') # end # - # ##### ignoring_interference_by_writer - # - # Use `ignoring_interference_by_writer` when the attribute you're testing - # changes incoming values. This qualifier will instruct the matcher to - # suppress raising an AttributeValueChangedError, as long as changing the - # doesn't also change the outcome of the test and cause it to fail. See - # the documentation for `allow_value` for more information on this. - # - # class Robot - # include ActiveModel::Model - # attr_accessor :name - # - # validates_presence_of :name - # - # def name=(name) - # @name = name.to_s - # end - # end - # - # # RSpec - # describe Robot do - # it do - # should validate_presence_of(:name). - # ignoring_interference_by_writer - # end - # end - # - # # Minitest (Shoulda) - # class RobotTest < ActiveSupport::TestCase - # should validate_presence_of(:name). - # ignoring_interference_by_writer - # end - # # @return [ValidatePresenceOfMatcher] # def validate_presence_of(attr)