rails-rfc6570 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/rails/rfc6570/version.rb +1 -1
- data/rails-rfc6570.gemspec +1 -1
- data/spec/dummy/log/test.log +432 -0
- metadata +10 -262
- data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/README.md +0 -23
- data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/rubocop-config.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.1/CHANGELOG.md +0 -154
- data/vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.1/MIT-LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.1/README.rdoc +0 -57
- data/vendor/bundle/ruby/3.3.0/gems/actionview-7.2.1/CHANGELOG.md +0 -113
- data/vendor/bundle/ruby/3.3.0/gems/actionview-7.2.1/MIT-LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/actionview-7.2.1/README.rdoc +0 -40
- data/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.1/CHANGELOG.md +0 -258
- data/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.1/MIT-LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.1/README.rdoc +0 -40
- data/vendor/bundle/ruby/3.3.0/gems/addressable-2.8.7/CHANGELOG.md +0 -301
- data/vendor/bundle/ruby/3.3.0/gems/addressable-2.8.7/LICENSE.txt +0 -202
- data/vendor/bundle/ruby/3.3.0/gems/addressable-2.8.7/README.md +0 -121
- data/vendor/bundle/ruby/3.3.0/gems/addressable-2.8.7/addressable.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/gems/appraisal-2.5.0/MIT-LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/appraisal-2.5.0/README.md +0 -243
- data/vendor/bundle/ruby/3.3.0/gems/appraisal-2.5.0/appraisal.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.2/LICENSE.MIT +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.2/README.YARD.md +0 -12
- data/vendor/bundle/ruby/3.3.0/gems/benchmark-ips-2.13.0/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/benchmark-ips-2.13.0/README.md +0 -279
- data/vendor/bundle/ruby/3.3.0/gems/bigdecimal-3.1.8/LICENSE +0 -56
- data/vendor/bundle/ruby/3.3.0/gems/bigdecimal-3.1.8/bigdecimal.gemspec +0 -57
- data/vendor/bundle/ruby/3.3.0/gems/builder-3.3.0/MIT-LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/builder-3.3.0/README.md +0 -258
- data/vendor/bundle/ruby/3.3.0/gems/builder-3.3.0/builder.gemspec +0 -49
- data/vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/CHANGELOG.md +0 -934
- data/vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/LICENSE +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/README.md +0 -199
- data/vendor/bundle/ruby/3.3.0/gems/coderay-1.1.3/MIT-LICENSE +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/coderay-1.1.3/README_INDEX.rdoc +0 -123
- data/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/CHANGELOG.md +0 -593
- data/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/LICENSE.txt +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/README.md +0 -407
- data/vendor/bundle/ruby/3.3.0/gems/connection_pool-2.4.1/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/connection_pool-2.4.1/README.md +0 -135
- data/vendor/bundle/ruby/3.3.0/gems/connection_pool-2.4.1/connection_pool.gemspec +0 -24
- data/vendor/bundle/ruby/3.3.0/gems/crass-1.0.6/LICENSE +0 -18
- data/vendor/bundle/ruby/3.3.0/gems/crass-1.0.6/README.md +0 -192
- data/vendor/bundle/ruby/3.3.0/gems/crass-1.0.6/crass.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/gems/diff-lcs-1.5.1/README.rdoc +0 -84
- data/vendor/bundle/ruby/3.3.0/gems/docile-1.4.1/LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/docile-1.4.1/README.md +0 -409
- data/vendor/bundle/ruby/3.3.0/gems/docile-1.4.1/docile.gemspec +0 -36
- data/vendor/bundle/ruby/3.3.0/gems/drb-2.2.1/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/drb-2.2.1/drb.gemspec +0 -41
- data/vendor/bundle/ruby/3.3.0/gems/erubi-1.13.0/CHANGELOG +0 -107
- data/vendor/bundle/ruby/3.3.0/gems/erubi-1.13.0/MIT-LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/erubi-1.13.0/README.rdoc +0 -151
- data/vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/MIT-LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/README.md +0 -127
- data/vendor/bundle/ruby/3.3.0/gems/io-console-0.7.2/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/io-console-0.7.2/README.md +0 -46
- data/vendor/bundle/ruby/3.3.0/gems/irb-1.14.0/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/irb-1.14.0/README.md +0 -405
- data/vendor/bundle/ruby/3.3.0/gems/irb-1.14.0/irb.gemspec +0 -46
- data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/LICENSE +0 -56
- data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/README.md +0 -416
- data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/json.gemspec +0 -68
- data/vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/LICENSE.txt +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/README.md +0 -88
- data/vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/CHANGELOG.md +0 -566
- data/vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/MIT-LICENSE.txt +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/loofah-2.22.0/README.md +0 -363
- data/vendor/bundle/ruby/3.3.0/gems/method_source-1.1.0/CHANGELOG.md +0 -15
- data/vendor/bundle/ruby/3.3.0/gems/method_source-1.1.0/LICENSE +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/method_source-1.1.0/README.markdown +0 -101
- data/vendor/bundle/ruby/3.3.0/gems/method_source-1.1.0/method_source.gemspec +0 -19
- data/vendor/bundle/ruby/3.3.0/gems/minitest-5.25.1/README.rdoc +0 -835
- data/vendor/bundle/ruby/3.3.0/gems/nokogiri-1.16.7-x86_64-linux/LICENSE-DEPENDENCIES.md +0 -2224
- data/vendor/bundle/ruby/3.3.0/gems/nokogiri-1.16.7-x86_64-linux/LICENSE.md +0 -9
- data/vendor/bundle/ruby/3.3.0/gems/nokogiri-1.16.7-x86_64-linux/README.md +0 -290
- data/vendor/bundle/ruby/3.3.0/gems/parallel-1.26.3/MIT-LICENSE.txt +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.4.2/LICENSE.txt +0 -25
- data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.4.2/parser.gemspec +0 -43
- data/vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/CHANGELOG.md +0 -1141
- data/vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/LICENSE +0 -25
- data/vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/README.md +0 -466
- data/vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/slop/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/pry-byebug-3.10.1/CHANGELOG.md +0 -230
- data/vendor/bundle/ruby/3.3.0/gems/pry-byebug-3.10.1/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/pry-byebug-3.10.1/README.md +0 -189
- data/vendor/bundle/ruby/3.3.0/gems/public_suffix-6.0.1/CHANGELOG.md +0 -491
- data/vendor/bundle/ruby/3.3.0/gems/public_suffix-6.0.1/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/public_suffix-6.0.1/README.md +0 -222
- data/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/README.ja.rdoc +0 -58
- data/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/README.rdoc +0 -60
- data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/CHANGELOG.md +0 -994
- data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/MIT-LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/README.md +0 -328
- data/vendor/bundle/ruby/3.3.0/gems/rack-test-2.1.0/MIT-LICENSE.txt +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/rack-test-2.1.0/README.md +0 -139
- data/vendor/bundle/ruby/3.3.0/gems/rails-dom-testing-2.2.0/MIT-LICENSE +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/rails-dom-testing-2.2.0/README.md +0 -91
- data/vendor/bundle/ruby/3.3.0/gems/rails-html-sanitizer-1.6.0/CHANGELOG.md +0 -201
- data/vendor/bundle/ruby/3.3.0/gems/rails-html-sanitizer-1.6.0/MIT-LICENSE +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/rails-html-sanitizer-1.6.0/README.md +0 -271
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/CHANGELOG.md +0 -361
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/MIT-LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/README.rdoc +0 -39
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/generators/rails/app/templates/README.md.tt +0 -24
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +0 -28
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/generators/rails/plugin/templates/README.md.tt +0 -28
- data/vendor/bundle/ruby/3.3.0/gems/rainbow-3.1.1/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/rainbow-3.1.1/README.markdown +0 -227
- data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/MIT-LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/README.rdoc +0 -155
- data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/rake.gemspec +0 -101
- data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/LICENSE +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/README.md +0 -107
- data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/rake-release.gemspec +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.7.0/LICENSE.rdoc +0 -57
- data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.7.0/README.rdoc +0 -129
- data/vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/LICENSE +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/regexp_parser.gemspec +0 -34
- data/vendor/bundle/ruby/3.3.0/gems/reline-0.5.9/README.md +0 -94
- data/vendor/bundle/ruby/3.3.0/gems/rexml-3.3.6/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/rexml-3.3.6/README.md +0 -57
- data/vendor/bundle/ruby/3.3.0/gems/rspec-3.13.0/LICENSE.md +0 -27
- data/vendor/bundle/ruby/3.3.0/gems/rspec-3.13.0/README.md +0 -47
- data/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.0/LICENSE.md +0 -26
- data/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.0/README.md +0 -389
- data/vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.2/LICENSE.md +0 -25
- data/vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.2/README.md +0 -326
- data/vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.1/LICENSE.md +0 -25
- data/vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.1/README.md +0 -465
- data/vendor/bundle/ruby/3.3.0/gems/rspec-rails-6.1.4/LICENSE.md +0 -25
- data/vendor/bundle/ruby/3.3.0/gems/rspec-rails-6.1.4/README.md +0 -381
- data/vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/LICENSE.md +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/README.md +0 -40
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-1.65.1/LICENSE.txt +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-1.65.1/README.md +0 -251
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.32.1/LICENSE.txt +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.32.1/README.md +0 -56
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/CHANGELOG.md +0 -85
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/MIT-LICENSE.md +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/README.md +0 -88
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/CHANGELOG.md +0 -116
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/MIT-LICENSE.md +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/README.md +0 -88
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-performance-1.21.1/LICENSE.txt +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-performance-1.21.1/README.md +0 -97
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.4/CHANGELOG.md +0 -1028
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.4/MIT-LICENSE.md +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.4/README.md +0 -109
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/CHANGELOG.md +0 -84
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/MIT-LICENSE.md +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/README.md +0 -90
- data/vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/LICENSE.txt +0 -19
- data/vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/README.md +0 -131
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-0.22.0/CHANGELOG.md +0 -191
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-0.22.0/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-0.22.0/README.md +0 -974
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-cobertura-2.1.0/LICENSE +0 -202
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-cobertura-2.1.0/README.md +0 -62
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-cobertura-2.1.0/simplecov-cobertura.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-html-0.12.3/CHANGELOG.md +0 -81
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-html-0.12.3/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-html-0.12.3/README.md +0 -30
- data/vendor/bundle/ruby/3.3.0/gems/simplecov-html-0.12.3/simplecov-html.gemspec +0 -23
- data/vendor/bundle/ruby/3.3.0/gems/simplecov_json_formatter-0.1.4/CHANGELOG.md +0 -13
- data/vendor/bundle/ruby/3.3.0/gems/simplecov_json_formatter-0.1.4/README.md +0 -29
- data/vendor/bundle/ruby/3.3.0/gems/strscan-3.1.0/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/thor-1.3.1/LICENSE.md +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/thor-1.3.1/README.md +0 -45
- data/vendor/bundle/ruby/3.3.0/gems/thor-1.3.1/thor.gemspec +0 -33
- data/vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/LICENSE +0 -19
- data/vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/README.md +0 -406
- data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.5.0/CHANGELOG.md +0 -196
- data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.5.0/MIT-LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.5.0/README.md +0 -171
- data/vendor/bundle/ruby/3.3.0/gems/useragent-0.16.10/LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/useragent-0.16.10/README.md +0 -42
- data/vendor/bundle/ruby/3.3.0/gems/webrick-1.8.1/LICENSE.txt +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/webrick-1.8.1/README.md +0 -61
- data/vendor/bundle/ruby/3.3.0/gems/webrick-1.8.1/webrick.gemspec +0 -70
- data/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/MIT-LICENSE +0 -20
- data/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/README.md +0 -1494
- data/vendor/bundle/ruby/3.3.0/specifications/actionpack-7.2.1.gemspec +0 -37
- data/vendor/bundle/ruby/3.3.0/specifications/actionview-7.2.1.gemspec +0 -33
- data/vendor/bundle/ruby/3.3.0/specifications/activesupport-7.2.1.gemspec +0 -36
- data/vendor/bundle/ruby/3.3.0/specifications/addressable-2.8.7.gemspec +0 -30
- data/vendor/bundle/ruby/3.3.0/specifications/appraisal-2.5.0.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/ast-2.4.2.gemspec +0 -30
- data/vendor/bundle/ruby/3.3.0/specifications/benchmark-ips-2.13.0.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/bigdecimal-3.1.8.gemspec +0 -25
- data/vendor/bundle/ruby/3.3.0/specifications/builder-3.3.0.gemspec +0 -22
- data/vendor/bundle/ruby/3.3.0/specifications/byebug-11.1.3.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/coderay-1.1.3.gemspec +0 -25
- data/vendor/bundle/ruby/3.3.0/specifications/concurrent-ruby-1.3.4.gemspec +0 -24
- data/vendor/bundle/ruby/3.3.0/specifications/connection_pool-2.4.1.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/crass-1.0.6.gemspec +0 -27
- data/vendor/bundle/ruby/3.3.0/specifications/diff-lcs-1.5.1.gemspec +0 -37
- data/vendor/bundle/ruby/3.3.0/specifications/docile-1.4.1.gemspec +0 -22
- data/vendor/bundle/ruby/3.3.0/specifications/drb-2.2.1.gemspec +0 -22
- data/vendor/bundle/ruby/3.3.0/specifications/erubi-1.13.0.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/i18n-1.14.5.gemspec +0 -26
- data/vendor/bundle/ruby/3.3.0/specifications/io-console-0.7.2.gemspec +0 -25
- data/vendor/bundle/ruby/3.3.0/specifications/irb-1.14.0.gemspec +0 -30
- data/vendor/bundle/ruby/3.3.0/specifications/json-2.7.2.gemspec +0 -0
- data/vendor/bundle/ruby/3.3.0/specifications/language_server-protocol-3.17.0.3.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/loofah-2.22.0.gemspec +0 -27
- data/vendor/bundle/ruby/3.3.0/specifications/method_source-1.1.0.gemspec +0 -21
- data/vendor/bundle/ruby/3.3.0/specifications/minitest-5.25.1.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/nokogiri-1.16.7-x86_64-linux.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/parallel-1.26.3.gemspec +0 -21
- data/vendor/bundle/ruby/3.3.0/specifications/parser-3.3.4.2.gemspec +0 -37
- data/vendor/bundle/ruby/3.3.0/specifications/pry-0.14.2.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/pry-byebug-3.10.1.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/public_suffix-6.0.1.gemspec +0 -24
- data/vendor/bundle/ruby/3.3.0/specifications/racc-1.8.1.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/rack-3.1.7.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/rack-session-2.0.0.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/rack-test-2.1.0.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/rackup-2.1.0.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/rails-dom-testing-2.2.0.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/rails-html-sanitizer-1.6.0.gemspec +0 -27
- data/vendor/bundle/ruby/3.3.0/specifications/railties-7.2.1.gemspec +0 -37
- data/vendor/bundle/ruby/3.3.0/specifications/rainbow-3.1.1.gemspec +0 -25
- data/vendor/bundle/ruby/3.3.0/specifications/rake-13.2.1.gemspec +0 -26
- data/vendor/bundle/ruby/3.3.0/specifications/rake-release-1.3.0.gemspec +0 -26
- data/vendor/bundle/ruby/3.3.0/specifications/rdoc-6.7.0.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/regexp_parser-2.9.2.gemspec +0 -22
- data/vendor/bundle/ruby/3.3.0/specifications/reline-0.5.9.gemspec +0 -26
- data/vendor/bundle/ruby/3.3.0/specifications/rexml-3.3.6.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/rspec-3.13.0.gemspec +0 -31
- data/vendor/bundle/ruby/3.3.0/specifications/rspec-core-3.13.0.gemspec +0 -39
- data/vendor/bundle/ruby/3.3.0/specifications/rspec-expectations-3.13.2.gemspec +0 -33
- data/vendor/bundle/ruby/3.3.0/specifications/rspec-mocks-3.13.1.gemspec +0 -33
- data/vendor/bundle/ruby/3.3.0/specifications/rspec-rails-6.1.4.gemspec +0 -37
- data/vendor/bundle/ruby/3.3.0/specifications/rspec-support-3.13.1.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-1.65.1.gemspec +0 -39
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-ast-1.32.1.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-capybara-2.21.0.gemspec +0 -27
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-factory_bot-2.26.1.gemspec +0 -27
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-performance-1.21.1.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-rspec-3.0.4.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-rspec_rails-2.30.0.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/ruby-progressbar-1.13.0.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/simplecov-0.22.0.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/simplecov-cobertura-2.1.0.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/simplecov-html-0.12.3.gemspec +0 -21
- data/vendor/bundle/ruby/3.3.0/specifications/simplecov_json_formatter-0.1.4.gemspec +0 -21
- data/vendor/bundle/ruby/3.3.0/specifications/strscan-3.1.0.gemspec +0 -24
- data/vendor/bundle/ruby/3.3.0/specifications/thor-1.3.1.gemspec +0 -28
- data/vendor/bundle/ruby/3.3.0/specifications/tzinfo-2.0.6.gemspec +0 -30
- data/vendor/bundle/ruby/3.3.0/specifications/unicode-display_width-2.5.0.gemspec +0 -29
- data/vendor/bundle/ruby/3.3.0/specifications/useragent-0.16.10.gemspec +0 -25
- data/vendor/bundle/ruby/3.3.0/specifications/webrick-1.8.1.gemspec +0 -22
- data/vendor/bundle/ruby/3.3.0/specifications/zeitwerk-2.6.17.gemspec +0 -22
@@ -1,465 +0,0 @@
|
|
1
|
-
# RSpec Mocks [![Build Status](https://github.com/rspec/rspec-mocks/workflows/RSpec%20CI/badge.svg)](https://github.com/rspec/rspec-mocks/actions) [![Code Climate](https://codeclimate.com/github/rspec/rspec-mocks.svg)](https://codeclimate.com/github/rspec/rspec-mocks)
|
2
|
-
rspec-mocks is a test-double framework for rspec with support for method stubs,
|
3
|
-
fakes, and message expectations on generated test-doubles and real objects
|
4
|
-
alike.
|
5
|
-
|
6
|
-
## Install
|
7
|
-
|
8
|
-
gem install rspec # for rspec-core, rspec-expectations, rspec-mocks
|
9
|
-
gem install rspec-mocks # for rspec-mocks only
|
10
|
-
|
11
|
-
Want to run against the `main` branch? You'll need to include the dependent
|
12
|
-
RSpec repos as well. Add the following to your `Gemfile`:
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
%w[rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
|
16
|
-
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'main'
|
17
|
-
end
|
18
|
-
```
|
19
|
-
## Contributing
|
20
|
-
|
21
|
-
Once you've set up the environment, you'll need to cd into the working
|
22
|
-
directory of whichever repo you want to work in. From there you can run the
|
23
|
-
specs and cucumber features, and make patches.
|
24
|
-
|
25
|
-
NOTE: You do not need to use rspec-dev to work on a specific RSpec repo. You
|
26
|
-
can treat each RSpec repo as an independent project.
|
27
|
-
|
28
|
-
For information about contributing to RSpec, please refer to the following markdown files:
|
29
|
-
* [Build details](BUILD_DETAIL.md)
|
30
|
-
* [Code of Conduct](CODE_OF_CONDUCT.md)
|
31
|
-
* [Detailed contributing guide](CONTRIBUTING.md)
|
32
|
-
* [Development setup guide](DEVELOPMENT.md)
|
33
|
-
|
34
|
-
## Test Doubles
|
35
|
-
|
36
|
-
A test double is an object that stands in for another object in your system
|
37
|
-
during a code example. Use the `double` method, passing in an optional identifier, to create one:
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
book = double("book")
|
41
|
-
```
|
42
|
-
|
43
|
-
Most of the time you will want some confidence that your doubles resemble an
|
44
|
-
existing object in your system. Verifying doubles are provided for this
|
45
|
-
purpose. If the existing object is available, they will prevent you from adding
|
46
|
-
stubs and expectations for methods that do not exist or that have an invalid
|
47
|
-
number of parameters.
|
48
|
-
|
49
|
-
```ruby
|
50
|
-
book = instance_double("Book", :pages => 250)
|
51
|
-
```
|
52
|
-
|
53
|
-
Verifying doubles have some clever tricks to enable you to both test in
|
54
|
-
isolation without your dependencies loaded while still being able to validate
|
55
|
-
them against real objects. More detail is available in [their
|
56
|
-
documentation](https://github.com/rspec/rspec-mocks/blob/main/features/verifying_doubles).
|
57
|
-
|
58
|
-
Verifying doubles can also accept custom identifiers, just like double(), e.g.:
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
books = []
|
62
|
-
books << instance_double("Book", :rspec_book, :pages => 250)
|
63
|
-
books << instance_double("Book", "(Untitled)", :pages => 5000)
|
64
|
-
|
65
|
-
puts books.inspect # with names, it's clearer which were actually added
|
66
|
-
```
|
67
|
-
|
68
|
-
## Method Stubs
|
69
|
-
|
70
|
-
A method stub is an implementation that returns a pre-determined value. Method
|
71
|
-
stubs can be declared on test doubles or real objects using the same syntax.
|
72
|
-
rspec-mocks supports 3 forms for declaring method stubs:
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
allow(book).to receive(:title) { "The RSpec Book" }
|
76
|
-
allow(book).to receive(:title).and_return("The RSpec Book")
|
77
|
-
allow(book).to receive_messages(
|
78
|
-
:title => "The RSpec Book",
|
79
|
-
:subtitle => "Behaviour-Driven Development with RSpec, Cucumber, and Friends")
|
80
|
-
```
|
81
|
-
|
82
|
-
You can also use this shortcut, which creates a test double and declares a
|
83
|
-
method stub in one statement:
|
84
|
-
|
85
|
-
```ruby
|
86
|
-
book = double("book", :title => "The RSpec Book")
|
87
|
-
```
|
88
|
-
|
89
|
-
The first argument is a name, which is used for documentation and appears in
|
90
|
-
failure messages. If you don't care about the name, you can leave it out,
|
91
|
-
making the combined instantiation/stub declaration very terse:
|
92
|
-
|
93
|
-
```ruby
|
94
|
-
double(:foo => 'bar')
|
95
|
-
```
|
96
|
-
|
97
|
-
This is particularly nice when providing a list of test doubles to a method
|
98
|
-
that iterates through them:
|
99
|
-
|
100
|
-
```ruby
|
101
|
-
order.calculate_total_price(double(:price => 1.99), double(:price => 2.99))
|
102
|
-
```
|
103
|
-
|
104
|
-
### Stubbing a chain of methods
|
105
|
-
|
106
|
-
You can use `receive_message_chain` in place of `receive` to stub a chain of messages:
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
allow(double).to receive_message_chain("foo.bar") { :baz }
|
110
|
-
allow(double).to receive_message_chain(:foo, :bar => :baz)
|
111
|
-
allow(double).to receive_message_chain(:foo, :bar) { :baz }
|
112
|
-
|
113
|
-
# Given any of the above forms:
|
114
|
-
double.foo.bar # => :baz
|
115
|
-
```
|
116
|
-
|
117
|
-
Chains can be arbitrarily long, which makes it quite painless to violate the Law of Demeter in violent ways, so you should consider any use of `receive_message_chain` a code smell. Even though not all code smells indicate real problems (think fluent interfaces), `receive_message_chain` still results in brittle examples. For example, if you write `allow(foo).to receive_message_chain(:bar, :baz => 37)` in a spec and then the implementation calls `foo.baz.bar`, the stub will not work.
|
118
|
-
|
119
|
-
## Consecutive return values
|
120
|
-
|
121
|
-
When a stub might be invoked more than once, you can provide additional
|
122
|
-
arguments to `and_return`. The invocations cycle through the list. The last
|
123
|
-
value is returned for any subsequent invocations:
|
124
|
-
|
125
|
-
```ruby
|
126
|
-
allow(die).to receive(:roll).and_return(1, 2, 3)
|
127
|
-
die.roll # => 1
|
128
|
-
die.roll # => 2
|
129
|
-
die.roll # => 3
|
130
|
-
die.roll # => 3
|
131
|
-
die.roll # => 3
|
132
|
-
```
|
133
|
-
|
134
|
-
To return an array in a single invocation, declare an array:
|
135
|
-
|
136
|
-
```ruby
|
137
|
-
allow(team).to receive(:players).and_return([double(:name => "David")])
|
138
|
-
```
|
139
|
-
|
140
|
-
## Message Expectations
|
141
|
-
|
142
|
-
A message expectation is an expectation that the test double will receive a
|
143
|
-
message some time before the example ends. If the message is received, the
|
144
|
-
expectation is satisfied. If not, the example fails.
|
145
|
-
|
146
|
-
```ruby
|
147
|
-
validator = double("validator")
|
148
|
-
expect(validator).to receive(:validate) { "02134" }
|
149
|
-
zipcode = Zipcode.new("02134", validator)
|
150
|
-
zipcode.valid?
|
151
|
-
```
|
152
|
-
|
153
|
-
## Test Spies
|
154
|
-
|
155
|
-
Verifies the given object received the expected message during the course of
|
156
|
-
the test. For a message to be verified, the given object must be setup to spy
|
157
|
-
on it, either by having it explicitly stubbed or by being a null object double
|
158
|
-
(e.g. `double(...).as_null_object`). Convenience methods are provided to easily
|
159
|
-
create null object doubles for this purpose:
|
160
|
-
|
161
|
-
```ruby
|
162
|
-
spy("invitation") # => same as `double("invitation").as_null_object`
|
163
|
-
instance_spy("Invitation") # => same as `instance_double("Invitation").as_null_object`
|
164
|
-
class_spy("Invitation") # => same as `class_double("Invitation").as_null_object`
|
165
|
-
object_spy("Invitation") # => same as `object_double("Invitation").as_null_object`
|
166
|
-
```
|
167
|
-
|
168
|
-
Verifying messages received in this way implements the Test Spy pattern.
|
169
|
-
|
170
|
-
```ruby
|
171
|
-
invitation = spy('invitation')
|
172
|
-
|
173
|
-
user.accept_invitation(invitation)
|
174
|
-
|
175
|
-
expect(invitation).to have_received(:accept)
|
176
|
-
|
177
|
-
# You can also use other common message expectations. For example:
|
178
|
-
expect(invitation).to have_received(:accept).with(mailer)
|
179
|
-
expect(invitation).to have_received(:accept).twice
|
180
|
-
expect(invitation).to_not have_received(:accept).with(mailer)
|
181
|
-
|
182
|
-
# One can specify a return value on the spy the same way one would a double.
|
183
|
-
invitation = spy('invitation', :accept => true)
|
184
|
-
expect(invitation).to have_received(:accept).with(mailer)
|
185
|
-
expect(invitation.accept).to eq(true)
|
186
|
-
```
|
187
|
-
|
188
|
-
Note that `have_received(...).with(...)` is unable to work properly when
|
189
|
-
passed arguments are mutated after the spy records the received message.
|
190
|
-
For example, this does not work properly:
|
191
|
-
|
192
|
-
```ruby
|
193
|
-
greeter = spy("greeter")
|
194
|
-
|
195
|
-
message = "Hello"
|
196
|
-
greeter.greet_with(message)
|
197
|
-
message << ", World"
|
198
|
-
|
199
|
-
expect(greeter).to have_received(:greet_with).with("Hello")
|
200
|
-
```
|
201
|
-
|
202
|
-
## Nomenclature
|
203
|
-
|
204
|
-
### Mock Objects and Test Stubs
|
205
|
-
|
206
|
-
The names Mock Object and Test Stub suggest specialized Test Doubles. i.e.
|
207
|
-
a Test Stub is a Test Double that only supports method stubs, and a Mock
|
208
|
-
Object is a Test Double that supports message expectations and method
|
209
|
-
stubs.
|
210
|
-
|
211
|
-
There is a lot of overlapping nomenclature here, and there are many
|
212
|
-
variations of these patterns (fakes, spies, etc). Keep in mind that most of
|
213
|
-
the time we're talking about method-level concepts that are variations of
|
214
|
-
method stubs and message expectations, and we're applying to them to _one_
|
215
|
-
generic kind of object: a Test Double.
|
216
|
-
|
217
|
-
### Test-Specific Extension
|
218
|
-
|
219
|
-
a.k.a. Partial Double, a Test-Specific Extension is an extension of a
|
220
|
-
real object in a system that is instrumented with test-double like
|
221
|
-
behaviour in the context of a test. This technique is very common in Ruby
|
222
|
-
because we often see class objects acting as global namespaces for methods.
|
223
|
-
For example, in Rails:
|
224
|
-
|
225
|
-
```ruby
|
226
|
-
person = double("person")
|
227
|
-
allow(Person).to receive(:find) { person }
|
228
|
-
```
|
229
|
-
|
230
|
-
In this case we're instrumenting Person to return the person object we've
|
231
|
-
defined whenever it receives the `find` message. We can also set a message
|
232
|
-
expectation so that the example fails if `find` is not called:
|
233
|
-
|
234
|
-
```ruby
|
235
|
-
person = double("person")
|
236
|
-
expect(Person).to receive(:find) { person }
|
237
|
-
```
|
238
|
-
|
239
|
-
RSpec replaces the method we're stubbing or mocking with its own
|
240
|
-
test-double-like method. At the end of the example, RSpec verifies any message
|
241
|
-
expectations, and then restores the original methods.
|
242
|
-
|
243
|
-
## Expecting Arguments
|
244
|
-
|
245
|
-
```ruby
|
246
|
-
expect(double).to receive(:msg).with(*args)
|
247
|
-
expect(double).to_not receive(:msg).with(*args)
|
248
|
-
```
|
249
|
-
|
250
|
-
You can set multiple expectations for the same message if you need to:
|
251
|
-
|
252
|
-
```ruby
|
253
|
-
expect(double).to receive(:msg).with("A", 1, 3)
|
254
|
-
expect(double).to receive(:msg).with("B", 2, 4)
|
255
|
-
```
|
256
|
-
|
257
|
-
## Argument Matchers
|
258
|
-
|
259
|
-
Arguments that are passed to `with` are compared with actual arguments
|
260
|
-
received using ===. In cases in which you want to specify things about the
|
261
|
-
arguments rather than the arguments themselves, you can use any of the
|
262
|
-
matchers that ship with rspec-expectations. They don't all make syntactic
|
263
|
-
sense (they were primarily designed for use with RSpec::Expectations), but
|
264
|
-
you are free to create your own custom RSpec::Matchers.
|
265
|
-
|
266
|
-
rspec-mocks also adds some keyword Symbols that you can use to
|
267
|
-
specify certain kinds of arguments:
|
268
|
-
|
269
|
-
```ruby
|
270
|
-
expect(double).to receive(:msg).with(no_args)
|
271
|
-
expect(double).to receive(:msg).with(any_args)
|
272
|
-
expect(double).to receive(:msg).with(1, any_args) # any args acts like an arg splat and can go anywhere
|
273
|
-
expect(double).to receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
|
274
|
-
expect(double).to receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
|
275
|
-
expect(double).to receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
|
276
|
-
expect(double).to receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
|
277
|
-
expect(double).to receive(:msg).with(1, duck_type(:abs, :div), "b") #2nd argument can be object that responds to #abs and #div
|
278
|
-
expect(double).to receive(:msg).with(hash_including(:a => 5)) # first arg is a hash with a: 5 as one of the key-values
|
279
|
-
expect(double).to receive(:msg).with(array_including(5)) # first arg is an array with 5 as one of the key-values
|
280
|
-
expect(double).to receive(:msg).with(hash_excluding(:a => 5)) # first arg is a hash without a: 5 as one of the key-values
|
281
|
-
expect(double).to receive(:msg).with(start_with('a')) # any matcher, custom or from rspec-expectations
|
282
|
-
expect(double).to receive(:msg).with(satisfy { |data| data.dig(:a, :b, :c) == 5 }) # assert anything you want
|
283
|
-
```
|
284
|
-
|
285
|
-
## Receive Counts
|
286
|
-
|
287
|
-
```ruby
|
288
|
-
expect(double).to receive(:msg).once
|
289
|
-
expect(double).to receive(:msg).twice
|
290
|
-
expect(double).to receive(:msg).exactly(n).time
|
291
|
-
expect(double).to receive(:msg).exactly(n).times
|
292
|
-
expect(double).to receive(:msg).at_least(:once)
|
293
|
-
expect(double).to receive(:msg).at_least(:twice)
|
294
|
-
expect(double).to receive(:msg).at_least(n).time
|
295
|
-
expect(double).to receive(:msg).at_least(n).times
|
296
|
-
expect(double).to receive(:msg).at_most(:once)
|
297
|
-
expect(double).to receive(:msg).at_most(:twice)
|
298
|
-
expect(double).to receive(:msg).at_most(n).time
|
299
|
-
expect(double).to receive(:msg).at_most(n).times
|
300
|
-
```
|
301
|
-
|
302
|
-
## Ordering
|
303
|
-
|
304
|
-
```ruby
|
305
|
-
expect(double).to receive(:msg).ordered
|
306
|
-
expect(double).to receive(:other_msg).ordered
|
307
|
-
# This will fail if the messages are received out of order
|
308
|
-
```
|
309
|
-
|
310
|
-
This can include the same message with different arguments:
|
311
|
-
|
312
|
-
```ruby
|
313
|
-
expect(double).to receive(:msg).with("A", 1, 3).ordered
|
314
|
-
expect(double).to receive(:msg).with("B", 2, 4).ordered
|
315
|
-
```
|
316
|
-
|
317
|
-
## Setting Responses
|
318
|
-
|
319
|
-
Whether you are setting a message expectation or a method stub, you can
|
320
|
-
tell the object precisely how to respond. The most generic way is to pass
|
321
|
-
a block to `receive`:
|
322
|
-
|
323
|
-
```ruby
|
324
|
-
expect(double).to receive(:msg) { value }
|
325
|
-
```
|
326
|
-
|
327
|
-
When the double receives the `msg` message, it evaluates the block and returns
|
328
|
-
the result.
|
329
|
-
|
330
|
-
```ruby
|
331
|
-
expect(double).to receive(:msg).and_return(value)
|
332
|
-
expect(double).to receive(:msg).exactly(3).times.and_return(value1, value2, value3)
|
333
|
-
# returns value1 the first time, value2 the second, etc
|
334
|
-
expect(double).to receive(:msg).and_raise(error)
|
335
|
-
# `error` can be an instantiated object (e.g. `StandardError.new(some_arg)`) or a class (e.g. `StandardError`)
|
336
|
-
# if it is a class, it must be instantiable with no args
|
337
|
-
expect(double).to receive(:msg).and_throw(:msg)
|
338
|
-
expect(double).to receive(:msg).and_yield(values, to, yield)
|
339
|
-
expect(double).to receive(:msg).and_yield(values, to, yield).and_yield(some, other, values, this, time)
|
340
|
-
# for methods that yield to a block multiple times
|
341
|
-
```
|
342
|
-
|
343
|
-
Any of these responses can be applied to a stub as well
|
344
|
-
|
345
|
-
```ruby
|
346
|
-
allow(double).to receive(:msg).and_return(value)
|
347
|
-
allow(double).to receive(:msg).and_return(value1, value2, value3)
|
348
|
-
allow(double).to receive(:msg).and_raise(error)
|
349
|
-
allow(double).to receive(:msg).and_throw(:msg)
|
350
|
-
allow(double).to receive(:msg).and_yield(values, to, yield)
|
351
|
-
allow(double).to receive(:msg).and_yield(values, to, yield).and_yield(some, other, values, this, time)
|
352
|
-
```
|
353
|
-
|
354
|
-
## Arbitrary Handling
|
355
|
-
|
356
|
-
Once in a while you'll find that the available expectations don't solve the
|
357
|
-
particular problem you are trying to solve. Imagine that you expect the message
|
358
|
-
to come with an Array argument that has a specific length, but you don't care
|
359
|
-
what is in it. You could do this:
|
360
|
-
|
361
|
-
```ruby
|
362
|
-
expect(double).to receive(:msg) do |arg|
|
363
|
-
expect(arg.size).to eq 7
|
364
|
-
end
|
365
|
-
```
|
366
|
-
|
367
|
-
If the method being stubbed itself takes a block, and you need to yield to it
|
368
|
-
in some special way, you can use this:
|
369
|
-
|
370
|
-
```ruby
|
371
|
-
expect(double).to receive(:msg) do |&arg|
|
372
|
-
begin
|
373
|
-
arg.call
|
374
|
-
ensure
|
375
|
-
# cleanup
|
376
|
-
end
|
377
|
-
end
|
378
|
-
```
|
379
|
-
|
380
|
-
## Delegating to the Original Implementation
|
381
|
-
|
382
|
-
When working with a partial mock object, you may occasionally
|
383
|
-
want to set a message expectation without interfering with how
|
384
|
-
the object responds to the message. You can use `and_call_original`
|
385
|
-
to achieve this:
|
386
|
-
|
387
|
-
```ruby
|
388
|
-
expect(Person).to receive(:find).and_call_original
|
389
|
-
Person.find # => executes the original find method and returns the result
|
390
|
-
```
|
391
|
-
|
392
|
-
## Combining Expectation Details
|
393
|
-
|
394
|
-
Combining the message name with specific arguments, receive counts and responses
|
395
|
-
you can get quite a bit of detail in your expectations:
|
396
|
-
|
397
|
-
```ruby
|
398
|
-
expect(double).to receive(:<<).with("illegal value").once.and_raise(ArgumentError)
|
399
|
-
```
|
400
|
-
|
401
|
-
While this is a good thing when you really need it, you probably don't really
|
402
|
-
need it! Take care to specify only the things that matter to the behavior of
|
403
|
-
your code.
|
404
|
-
|
405
|
-
## Stubbing and Hiding Constants
|
406
|
-
|
407
|
-
See the [mutating constants
|
408
|
-
README](https://github.com/rspec/rspec-mocks/blob/main/features/mutating_constants/README.md)
|
409
|
-
for info on this feature.
|
410
|
-
|
411
|
-
## Use `before(:example)`, not `before(:context)`
|
412
|
-
|
413
|
-
Stubs in `before(:context)` are not supported. The reason is that all stubs and mocks get cleared out after each example, so any stub that is set in `before(:context)` would work in the first example that happens to run in that group, but not for any others.
|
414
|
-
|
415
|
-
Instead of `before(:context)`, use `before(:example)`.
|
416
|
-
|
417
|
-
## Settings mocks or stubs on any instance of a class
|
418
|
-
|
419
|
-
rspec-mocks provides two methods, `allow_any_instance_of` and
|
420
|
-
`expect_any_instance_of`, that will allow you to stub or mock any instance
|
421
|
-
of a class. They are used in place of `allow` or `expect`:
|
422
|
-
|
423
|
-
```ruby
|
424
|
-
allow_any_instance_of(Widget).to receive(:name).and_return("Wibble")
|
425
|
-
expect_any_instance_of(Widget).to receive(:name).and_return("Wobble")
|
426
|
-
```
|
427
|
-
|
428
|
-
These methods add the appropriate stub or expectation to all instances of
|
429
|
-
`Widget`.
|
430
|
-
|
431
|
-
This feature is sometimes useful when working with legacy code, though in
|
432
|
-
general we discourage its use for a number of reasons:
|
433
|
-
|
434
|
-
* The `rspec-mocks` API is designed for individual object instances, but this
|
435
|
-
feature operates on entire classes of objects. As a result there are some
|
436
|
-
semantically confusing edge cases. For example in
|
437
|
-
`expect_any_instance_of(Widget).to receive(:name).twice` it isn't clear
|
438
|
-
whether each specific instance is expected to receive `name` twice, or if two
|
439
|
-
receives total are expected. (It's the former.)
|
440
|
-
* Using this feature is often a design smell. It may be
|
441
|
-
that your test is trying to do too much or that the object under test is too
|
442
|
-
complex.
|
443
|
-
* It is the most complicated feature of `rspec-mocks`, and has historically
|
444
|
-
received the most bug reports. (None of the core team actively use it,
|
445
|
-
which doesn't help.)
|
446
|
-
|
447
|
-
|
448
|
-
## Further Reading
|
449
|
-
|
450
|
-
There are many different viewpoints about the meaning of mocks and stubs. If
|
451
|
-
you are interested in learning more, here is some recommended reading:
|
452
|
-
|
453
|
-
* Mock Objects: http://www.mockobjects.com/
|
454
|
-
* Endo-Testing: http://www.ccs.neu.edu/research/demeter/related-work/extreme-programming/MockObjectsFinal.PDF
|
455
|
-
* Mock Roles, Not Objects: http://www.jmock.org/oopsla2004.pdf
|
456
|
-
* Test Double: http://www.martinfowler.com/bliki/TestDouble.html
|
457
|
-
* Test Double Patterns: http://xunitpatterns.com/Test%20Double%20Patterns.html
|
458
|
-
* Mocks aren't stubs: http://www.martinfowler.com/articles/mocksArentStubs.html
|
459
|
-
|
460
|
-
## Also see
|
461
|
-
|
462
|
-
* [https://github.com/rspec/rspec](https://github.com/rspec/rspec)
|
463
|
-
* [https://github.com/rspec/rspec-core](https://github.com/rspec/rspec-core)
|
464
|
-
* [https://github.com/rspec/rspec-expectations](https://github.com/rspec/rspec-expectations)
|
465
|
-
* [https://github.com/rspec/rspec-rails](https://github.com/rspec/rspec-rails)
|
@@ -1,25 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
=====================
|
3
|
-
|
4
|
-
* Copyright © 2015 David Chelimsky, Aaron Kromer
|
5
|
-
* Copyright © 2012 David Chelimsky, Andy Lindeman
|
6
|
-
* Copyright © 2006 David Chelimsky, The RSpec Development Team
|
7
|
-
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
9
|
-
a copy of this software and associated documentation files (the
|
10
|
-
"Software"), to deal in the Software without restriction, including
|
11
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
12
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
-
permit persons to whom the Software is furnished to do so, subject to
|
14
|
-
the following conditions:
|
15
|
-
|
16
|
-
The above copyright notice and this permission notice shall be
|
17
|
-
included in all copies or substantial portions of the Software.
|
18
|
-
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
22
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
23
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
25
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|