Commit Graph

12 Commits

Author SHA1 Message Date
Pedro Paiva 0cc461d4d9
Remove ruby 2.5 support (#1415)
* Remove Ruby 2.5 support

* Setting the target Ruby version to 2.6 on Rubocop

* Fix Style/SlicingWithRange: Prefer ary[n..] over ary[n..-1] offenses
2021-03-04 20:42:47 -03:00
Kapil Sachdev 3e88500318 fix(rubocop): Fix Style, Layout, Lint and other offenses [ci skip]
Updated Layout/LineLength cop to Max 120 lenght and ignore everything 
inside specs/**/*

Added rules for below cops in .rubocop.yml
Lint/AmbiguousBlockAssociation
Naming/HeredocDelimiterNaming
Rails/SkipsModelValidations
Style/FormatStringToken


Fixed below mentioned cops:
- Layout/CaseIndentation
- Layout/DotPosition
- Layout/ElseAlignment
- Layout/IndentationWidth
- Layout/LineLength
- Layout/MultilineBlockLayout
- Layout/MultilineOperationIndentation
- Lint/AmbiguousBlockAssociation
- Lint/MissingCopEnableDirective
- Lint/NestedMethodDefinition
- Lint/RedundantCopDisableDirective
- Lint/RedundantRequireStatement
- Lint/UnusedBlockArgument
- Lint/UnusedMethodArgument
- Metrics/ModuleLength
- Naming/MemoizedInstanceVariableName
- Naming/RescuedExceptionsVariableName
- Rails/Output
- Rails/Presence
- Security/Eval
- Security/Open
- Style/ClassCheck
- Style/CollectionMethods
- Style/ConditionalAssignment
- Style/EvalWithLocation
- Style/FormatStringToken
- Style/InverseMethods
- Style/MutableConstant
- Style/ParallelAssignment
- Style/RedundantBegin
- Style/RedundantCondition
- Style/RedundantInterpolation
- Style/RedundantSelf
- Style/RedundantSort
- Style/RescueStandardError
- Style/SafeNavigation
- Style/StringLiteralsInInterpolation
- Style/SymbolProc
2020-11-03 10:05:25 -07:00
Elliot Winkler 4d3efe23f4 Rewrite have_db_index matcher
* Bring the file up to date style-wise with other matcher files
* Bring the tests up to date with other tests
* Improve error messaging
* Simplify documentation
2019-05-30 21:15:52 -06:00
Elliot Winkler 3af3d9f7ab Add required/optional qual's to belongs_to/has_one
Rails 5 made two changes to `belongs_to` associations:

* `required` and `optional` were added as options (which add and remove
  a presence validation on the association, respectively)
* `required` was made the default

In addition, a `required` option was also added to `has_one`.

These new qualifiers allow us to test these options appropriately.

Credit: Shia <rise.shia@gmail.com>
2017-10-06 23:38:47 -05:00
Elliot Winkler 3e0c73f252 fail_with_message(_including): Tweak failure messages 2015-12-30 22:03:29 -05:00
Elliot Winkler 6a4871547a fail_with_message: Switch expect/actual in diff 2015-12-30 21:19:50 -05:00
Elliot Winkler 14b5658826 fail_with_message now shows a diff on failure
When the fail_with_message fails, it's helpful to show how the expected
message differed from the actual message.
2015-12-13 20:22:21 -07:00
Elliot Winkler e708789714 Fix failure message for numericality matcher
Secondary author: Mauro George <maurogot@gmail.com>

Sometimes the failure message did not always provide the reason for
failure. For instance, given this validation:

    validates :ano, numericality: { only_integer: true, greater_than_or_equal_to: 1900 }

this test:

    it { should validate_numericality_of(:ano).is_greater_than_or_equal_to(1900) }

would fail with the following:

    Did not expect errors  when ano is set to 1900.000000000001, got error:

as you can see, the failure message doesn't contain the validation
error.

In the process of making this fix, we changed how the matcher fails so
that it will so when the first submatcher fails, not the last. This
changes what the failure message looks like, but not the basic
functionality of the matcher itself.
2015-06-01 01:38:35 -06:00
Elliot Winkler de111ea5e8 Improve output of fail_with_message matcher 2015-01-22 21:05:08 -07:00
Elliot Winkler 8e049c149f Improve failure messages for failure message matchers 2014-12-16 20:31:31 -07:00
Elliot Winkler f922613386 Reorganize unit tests, part II
* Change 'spec' Rake task to 'spec:unit'
* Require unit_spec_helper.rb in unit tests, not spec_helper.rb
* Re-namespace files in spec/support/unit under UnitTests
* Files in spec/support/unit/helpers no longer automatically add
  themselves to RSpec - this happens in unit_spec_helper.rb
* Extract RecordWithDifferentErrorAttributeBuilder and
  RecordValidatingConfirmationBuilder to separate files
2014-11-05 09:53:20 -07:00
Elliot Winkler bbdf8a807e Reorganize unit tests, part I
* Move spec/shoulda to spec/unit_tests/shoulda
* Move spec/support/*.rb to spec/support/unit_tests/{helpers,matchers}
* Move spec_helper.rb to unit_spec_helper.rb
2014-11-04 14:43:59 -07:00