[
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: Test\n\non:\n  push:\n    branches:\n      - main\n    paths-ignore:\n      - '**.md'\n  pull_request:\n    types:\n      - opened\n      - synchronize\n    paths-ignore:\n      - '**.md'\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        ruby:\n          - 2.7.7\n        appraisal:\n          - rails_6_1\n          - rails_6_0\n        test_framework:\n          - minitest\n          - test_unit\n    env:\n      BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile\n      TEST_FRAMEWORK: ${{ matrix.test_framework }}\n    steps:\n      - uses: actions/checkout@v3\n      - name: Set up Ruby\n        id: set-up-ruby\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: ${{ matrix.ruby }}\n      - uses: actions/cache@v3\n        with:\n          path: vendor/bundle\n          key: v1-rubygems-local-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles(format('gemfiles/{0}.gemfile.lock', matrix.appraisal)) }}\n      - name: Install dependencies\n        run: bundle install --jobs=3 --retry=3\n      - name: Run Tests\n        run: bundle exec rake\n"
  },
  {
    "path": ".github/workflows/dynamic-readme.yml",
    "content": "name: update-templates\n\non: \n  push:\n    branches:\n      - main\n  workflow_dispatch:\n\njobs:\n  update-templates:\n    permissions:\n      contents: write\n      pull-requests: write\n      pages: write\n    uses: thoughtbot/templates/.github/workflows/dynamic-readme.yaml@main\n    secrets:\n      token: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/dynamic-security.yml",
    "content": "name: update-security\n\non:\n  push:\n    paths:\n      - SECURITY.md\n    branches:\n      - main\n  workflow_dispatch:\n\njobs:\n  update-security:\n    permissions:\n      contents: write\n      pull-requests: write\n      pages: write\n    uses: thoughtbot/templates/.github/workflows/dynamic-security.yaml@main\n    secrets:\n      token: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/rubocop.yml",
    "content": "name: RuboCop\n\non: [push, pull_request]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n    - name: Checkout Repository\n      uses: actions/checkout@v3\n\n    - name: Setup Ruby\n      uses: ruby/setup-ruby@v1\n\n    - name: Cache gems\n      uses: actions/cache@v3\n      with:\n        path: ../vendor/bundle\n        key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}\n        restore-keys: |\n          ${{ runner.os }}-rubocop-\n\n    - name: Install gems\n      run: |\n        bundle config path ../vendor/bundle\n        bundle install --jobs 4 --retry 3\n\n    - name: Run RuboCop\n      run: bundle exec rubocop --parallel\n"
  },
  {
    "path": ".gitignore",
    "content": ".bundle\nvendor/ruby\nvendor/cache\ndoc\ncoverage\npkg\n*.swp\n*.swo\ntags\ntmp\n"
  },
  {
    "path": ".rubocop.yml",
    "content": "inherit_from: .rubocop_todo.yml\n\nAllCops:\n  TargetRubyVersion: 2.7\n  Exclude:\n    - '*.gemspec'\nLayout/AlignParameters:\n  EnforcedStyle: with_fixed_indentation\nLayout/ConditionPosition:\n  Enabled: false\nLayout/DotPosition:\n  EnforcedStyle: trailing\nLayout/MultilineMethodCallIndentation:\n  EnforcedStyle: indented\nLint/AmbiguousOperator:\n  Enabled: false\nLint/AmbiguousRegexpLiteral:\n  Enabled: false\nLint/AssignmentInCondition:\n  Enabled: false\nLint/DeprecatedClassMethods:\n  Enabled: false\nLint/ElseLayout:\n  Enabled: false\nLint/HandleExceptions:\n  Enabled: false\nLint/IndentHeredoc:\n  Enabled: false\nLint/LiteralInInterpolation:\n  Enabled: false\nLint/Loop:\n  Enabled: false\nLint/ParenthesesAsGroupedExpression:\n  Enabled: false\nLint/RequireParentheses:\n  Enabled: false\nLint/UnderscorePrefixedVariableName:\n  Enabled: false\nLint/Void:\n  Enabled: false\nMetrics/BlockLength:\n  Enabled: false\nMetrics/ClassLength:\n  Enabled: false\nMetrics/LineLength:\n  IgnoredPatterns:\n    - \"^[ ]*describe.+$\"\n    - \"^[ ]*context.+$\"\n    - \"^[ ]*shared_context.+$\"\n    - \"^[ ]*shared_examples_for.+$\"\n    - \"^[ ]*it.+$\"\n    - \"^[ ]*'.+?' => '.+?',?$\"\n    - \"^[ ]*\\\".+?\\\" => \\\".+?\\\",?$\"\n    - \"^[ ]*.+?: .+?$\"\nMetrics/MethodLength:\n  Max: 30\nNaming/AccessorMethodName:\n  Enabled: false\nNaming/AsciiIdentifiers:\n  Enabled: false\nNaming/BinaryOperatorParameterName:\n  Enabled: false\nNaming/MemoizedInstanceVariableName:\n  EnforcedStyleForLeadingUnderscores: required\nStyle/ClassVars:\n  Enabled: false\nStyle/ColonMethodCall:\n  Enabled: false\nNaming/FileName:\n  Enabled: false\nRails:\n  Enabled: true\nRails/Delegate:\n  Enabled: false\nRails/HttpPositionalArguments:\n  Enabled: false\nStyle/Alias:\n  Enabled: false\nStyle/ArrayJoin:\n  Enabled: false\nStyle/AsciiComments:\n  Enabled: false\nStyle/Attr:\n  Enabled: false\nStyle/CaseEquality:\n  Enabled: false\nStyle/CharacterLiteral:\n  Enabled: false\nStyle/ClassAndModuleChildren:\n  Enabled: false\nStyle/CollectionMethods:\n  PreferredMethods:\n    find: detect\n    reduce: inject\n    collect: map\n    find_all: select\nStyle/CommentAnnotation:\n  Enabled: false\nStyle/Documentation:\n  Enabled: false\nStyle/DoubleNegation:\n  Enabled: false\nStyle/EachWithObject:\n  Enabled: false\nStyle/EmptyLiteral:\n  Enabled: false\nStyle/Encoding:\n  Enabled: false\nStyle/EvenOdd:\n  Enabled: false\nStyle/ExpandPathArguments:\n  Enabled: false\nStyle/FlipFlop:\n  Enabled: false\nStyle/FormatString:\n  Enabled: false\nStyle/FrozenStringLiteralComment:\n  Enabled: false\nStyle/GlobalVars:\n  Enabled: false\nStyle/GuardClause:\n  Enabled: false\nStyle/IfUnlessModifier:\n  Enabled: false\nStyle/IfWithSemicolon:\n  Enabled: false\nStyle/InlineComment:\n  Enabled: false\nStyle/Lambda:\n  Enabled: false\nStyle/LambdaCall:\n  Enabled: false\nStyle/LineEndConcatenation:\n  Enabled: false\nStyle/MethodCalledOnDoEndBlock:\n  Enabled: false\nStyle/ModuleFunction:\n  Enabled: false\nStyle/NegatedIf:\n  Enabled: false\nStyle/NegatedWhile:\n  Enabled: false\nStyle/Next:\n  Enabled: false\nStyle/NilComparison:\n  Enabled: false\nStyle/Not:\n  Enabled: false\nStyle/NumericLiterals:\n  Enabled: false\nStyle/NumericPredicate:\n  Enabled: false\nStyle/OneLineConditional:\n  Enabled: false\nStyle/PercentLiteralDelimiters:\n  Enabled: false\nStyle/PerlBackrefs:\n  Enabled: false\nStyle/PreferredHashMethods:\n  Enabled: false\nStyle/Proc:\n  Enabled: false\nStyle/RaiseArgs:\n  Enabled: false\nStyle/RegexpLiteral:\n  Enabled: false\nStyle/RescueStandardError:\n  Enabled: false\nStyle/SelfAssignment:\n  Enabled: false\nStyle/SignalException:\n  Enabled: false\nStyle/SingleLineBlockParams:\n  Enabled: false\nStyle/SingleLineMethods:\n  Enabled: false\nStyle/SpecialGlobalVars:\n  Enabled: false\nStyle/StringLiterals:\n  EnforcedStyle: double_quotes\nStyle/SymbolArray:\n  Enabled: false\nStyle/TrivialAccessors:\n  Enabled: false\nStyle/WhenThen:\n  Enabled: false\nStyle/WhileUntilModifier:\n  Enabled: false\nStyle/WordArray:\n  Enabled: false\nStyle/VariableInterpolation:\n  Enabled: false\n"
  },
  {
    "path": ".rubocop_todo.yml",
    "content": "# This configuration was generated by\n# `rubocop --auto-gen-config`\n# on 2023-02-26 11:25:39 -0300 using RuboCop version 0.71.0.\n# The point is for the user to remove these configuration records\n# one by one as the offenses are removed from the code base.\n# Note that changes in the inspected code, or installation of new\n# versions of RuboCop, may require this file to be generated again.\n\n# Offense count: 39\n# Cop supports --auto-correct.\n# Configuration parameters: TreatCommentsAsGroupSeparators, Include.\n# Include: **/*.gemfile, **/Gemfile, **/gems.rb\nBundler/OrderedGems:\n  Exclude:\n    - 'gemfiles/rails_4_2.gemfile'\n    - 'gemfiles/rails_5_0.gemfile'\n    - 'gemfiles/rails_5_1.gemfile'\n    - 'gemfiles/rails_5_2.gemfile'\n    - 'gemfiles/rails_6_0.gemfile'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle, IndentationWidth.\n# SupportedStyles: with_first_argument, with_fixed_indentation\nLayout/AlignArguments:\n  Exclude:\n    - 'test/shoulda/test_framework_detection_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\nLayout/EmptyLineAfterGuardClause:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 5\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: empty_lines, no_empty_lines\nLayout/EmptyLinesAroundBlockBody:\n  Exclude:\n    - 'test/shoulda/context_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only\nLayout/EmptyLinesAroundClassBody:\n  Exclude:\n    - 'test/shoulda/context_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.\nLayout/ExtraSpacing:\n  Exclude:\n    - 'Appraisals'\n\n# Offense count: 4\n# Cop supports --auto-correct.\nLayout/SpaceAfterComma:\n  Exclude:\n    - 'lib/shoulda/context/assertions.rb'\n    - 'lib/shoulda/context/context.rb'\n    - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake'\n\n# Offense count: 1\n# Cop supports --auto-correct.\nLayout/SpaceAfterNot:\n  Exclude:\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 2\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.\n# SupportedStyles: space, no_space\n# SupportedStylesForEmptyBraces: space, no_space\nLayout/SpaceBeforeBlockBraces:\n  Exclude:\n    - 'lib/shoulda/context/autoload_macros.rb'\n\n# Offense count: 16\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.\n# SupportedStyles: space, no_space\n# SupportedStylesForEmptyBraces: space, no_space\nLayout/SpaceInsideBlockBraces:\n  Exclude:\n    - 'exe/convert_to_should_syntax'\n    - 'lib/shoulda/context/assertions.rb'\n    - 'lib/shoulda/context/autoload_macros.rb'\n    - 'lib/shoulda/context/tasks/list_tests.rake'\n    - 'test/shoulda/convert_to_should_syntax_test.rb'\n    - 'test/shoulda/helpers_test.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 8\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: space, no_space\nLayout/SpaceInsideParens:\n  Exclude:\n    - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake'\n\n# Offense count: 3\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: final_newline, final_blank_line\nLayout/TrailingBlankLines:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n    - 'test/fake_rails_root/test/shoulda_macros/custom_macro.rb'\n    - 'test/shoulda/autoload_macro_test.rb'\n\n# Offense count: 4\n# Cop supports --auto-correct.\n# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.\nLint/UnusedBlockArgument:\n  Exclude:\n    - 'exe/convert_to_should_syntax'\n    - 'test/shoulda/context_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.\nLint/UnusedMethodArgument:\n  Exclude:\n    - 'lib/shoulda/context/dsl.rb'\n\n# Offense count: 2\nLint/UselessAssignment:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 4\nMetrics/AbcSize:\n  Max: 22\n\n# Offense count: 1\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: lowercase, uppercase\nNaming/HeredocDelimiterCase:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 2\n# Configuration parameters: Blacklist.\n# Blacklist: (?-mix:(^|\\s)(EO[A-Z]{1}|END)(\\s|$))\nNaming/HeredocDelimiterNaming:\n  Exclude:\n    - 'test/shoulda/convert_to_should_syntax_test.rb'\n\n# Offense count: 5\n# Configuration parameters: EnforcedStyleForLeadingUnderscores.\n# SupportedStylesForLeadingUnderscores: disallowed, required, optional\nNaming/MemoizedInstanceVariableName:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n    - 'lib/shoulda/context/dsl.rb'\n    - 'lib/shoulda/context/world.rb'\n\n# Offense count: 3\n# Cop supports --auto-correct.\n# Configuration parameters: PreferredName.\nNaming/RescuedExceptionsVariableName:\n  Exclude:\n    - 'test/shoulda/helpers_test.rb'\n\n# Offense count: 4\n# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.\n# AllowedNames: io, id, to, by, on, in, at, ip, db\nNaming/UncommunicativeMethodParamName:\n  Exclude:\n    - 'lib/shoulda/context/assertions.rb'\n\n# Offense count: 3\n# Cop supports --auto-correct.\n# Configuration parameters: Include.\n# Include: **/test/**/*\nRails/AssertNot:\n  Exclude:\n    - 'test/shoulda/context_test.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 1\n# Configuration parameters: Include.\n# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb\nRails/Output:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 2\n# Cop supports --auto-correct.\n# Configuration parameters: Include.\n# Include: **/test/**/*\nRails/RefuteMethods:\n  Exclude:\n    - 'test/shoulda/helpers_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: strict, flexible\nRails/TimeZone:\n  Exclude:\n    - 'lib/shoulda/context/proc_extensions.rb'\n\n# Offense count: 2\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: always, conditionals\nStyle/AndOr:\n  Exclude:\n    - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake'\n\n# Offense count: 20\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.\n# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces\n# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object\n# FunctionalMethods: let, let!, subject, watch\n# IgnoredMethods: lambda, proc, it\nStyle/BlockDelimiters:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 3\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: compact, expanded\nStyle/EmptyMethod:\n  Exclude:\n    - 'test/fake_rails_root/test/shoulda_macros/custom_macro.rb'\n    - 'test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb'\n    - 'test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb'\n\n# Offense count: 20\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.\n# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys\nStyle/HashSyntax:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n    - 'lib/shoulda/context/dsl.rb'\n    - 'test/shoulda/helpers_test.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 1\nStyle/MethodMissingSuper:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 1\nStyle/MissingRespondToMissing:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 3\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle.\n# SupportedStyles: literals, strict\nStyle/MutableConstant:\n  Exclude:\n    - 'test/shoulda/convert_to_should_syntax_test.rb'\n\n# Offense count: 2\n# Cop supports --auto-correct.\nStyle/ParallelAssignment:\n  Exclude:\n    - 'lib/shoulda/context/proc_extensions.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: AllowMultipleReturnValues.\nStyle/RedundantReturn:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 18\n# Cop supports --auto-correct.\nStyle/RedundantSelf:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n    - 'lib/shoulda/context/dsl.rb'\n    - 'lib/shoulda/context/world.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.\n# Whitelist: present?, blank?, presence, try, try!\nStyle/SafeNavigation:\n  Exclude:\n    - 'lib/shoulda/context/dsl.rb'\n\n# Offense count: 2\n# Cop supports --auto-correct.\n# Configuration parameters: AllowAsExpressionSeparator.\nStyle/Semicolon:\n  Exclude:\n    - 'lib/shoulda/context/assertions.rb'\n\n# Offense count: 70\n# Cop supports --auto-correct.\n# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.\n# SupportedStyles: single_quotes, double_quotes\nStyle/StringLiterals:\n  Exclude:\n    - 'Appraisals'\n    - 'bin/supported_ruby_versions'\n    - 'exe/convert_to_should_syntax'\n    - 'lib/shoulda/context/autoload_macros.rb'\n    - 'lib/shoulda/context/context.rb'\n    - 'lib/shoulda/context/dsl.rb'\n    - 'lib/shoulda/context/tasks.rb'\n    - 'lib/shoulda/context/tasks/list_tests.rake'\n    - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake'\n    - 'test/shoulda/autoload_macro_test.rb'\n    - 'test/shoulda/context_test.rb'\n    - 'test/shoulda/convert_to_should_syntax_test.rb'\n    - 'test/shoulda/helpers_test.rb'\n    - 'test/shoulda/should_test.rb'\n\n# Offense count: 1\n# Cop supports --auto-correct.\n# Configuration parameters: IgnoredMethods.\n# IgnoredMethods: respond_to, define_method\nStyle/SymbolProc:\n  Exclude:\n    - 'lib/shoulda/context/context.rb'\n\n# Offense count: 55\n# Cop supports --auto-correct.\n# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.\n# URISchemes: http, https\nMetrics/LineLength:\n  Max: 155\n"
  },
  {
    "path": ".ruby-version",
    "content": "2.7.7\n"
  },
  {
    "path": "Appraisals",
    "content": "# Note: All of the dependencies here were obtained by running `rails new` with\n# various versions of Rails and copying lines from the generated Gemfile. It's\n# best to keep the gems here in the same order as they're listed there so you\n# can compare them more easily.\n\nshared_rails_dependencies = proc do\n  gem \"sqlite3\", \"~> 1.3.6\"\nend\n\nshared_spring_dependencies = proc do\n  gem \"spring\"\n  gem \"spring-commands-rspec\"\nend\n\nshared_test_dependencies = proc do\n  gem \"minitest-reporters\"\nend\n\nshared_dependencies = proc do\n  instance_eval(&shared_rails_dependencies)\n  instance_eval(&shared_spring_dependencies)\n  instance_eval(&shared_test_dependencies)\nend\n\nappraise \"rails_6_0\" do\n  instance_eval(&shared_dependencies)\n\n  gem \"rails\", \"~> 6.0.2\"\n  gem \"puma\", \"~> 4.1\"\n  gem \"sass-rails\", \">= 6\"\n  gem \"webpacker\", \"~> 4.0\"\n  gem \"turbolinks\", \"~> 5\"\n  gem \"jbuilder\", \"~> 2.7\"\n  gem \"bcrypt\", \"~> 3.1.7\"\n  gem \"bootsnap\", \">= 1.4.2\", require: false\n  gem \"listen\", \">= 3.0.5\", \"< 3.2\"\n  gem \"spring-watcher-listen\", \"~> 2.0.0\"\n  gem \"capybara\", \">= 2.15\"\n  gem \"selenium-webdriver\"\n  gem \"sqlite3\", \"~> 1.4.0\"\n  gem \"webdrivers\"\n\n  # Other dependencies\n  gem \"rails-controller-testing\", \">= 1.0.4\"\n  gem \"pg\", \"~> 1.1\", platform: :ruby\nend\n\nappraise \"rails_6_1\" do\n  instance_eval(&shared_dependencies)\n\n  gem \"rails\", \"~> 6.1.3.2\"\n  gem \"puma\", \"~> 5.0\"\n  gem \"sass-rails\", \">= 6\"\n  gem \"turbolinks\", \"~> 5\"\n  gem \"jbuilder\", \"~> 2.7\"\n  gem \"bcrypt\", \"~> 3.1.7\"\n  gem \"bootsnap\", \">= 1.4.2\", require: false\n  gem \"listen\", \">= 3.0.5\", \"< 3.2\"\n  gem \"spring-watcher-listen\", \"~> 2.0.0\"\n  gem \"capybara\", \">= 2.15\"\n  gem \"selenium-webdriver\"\n  gem \"sqlite3\", \"~> 1.4.0\"\n  gem \"webdrivers\"\n\n  # Other dependencies\n  gem \"rails-controller-testing\", \">= 1.0.4\"\n  gem 'pg', '>= 0.18', '< 2.0'\nend\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## 3.0.0.rc1 - 2024-04-21\n\n### Backward-incompatible changes\n\n* Drop support for Ruby 2.5 and 2.6 by @vsppedro. Ruby 2.7.x is the only version supported now. ([#76], [#77], [#78])\n* Drop support for Rails 4.2, 5.0, 5.1 and 5.2 by @vsppedro. Rails 6.0.x and Rails 6.1.x are the only versions supported now. ([#79], [#80], [#81], [#82])\n\n[#74]: https://github.com/thoughtbot/shoulda-context/pull/74\n[#76]: https://github.com/thoughtbot/shoulda-context/pull/76\n[#77]: https://github.com/thoughtbot/shoulda-context/pull/77\n[#78]: https://github.com/thoughtbot/shoulda-context/pull/78\n[#79]: https://github.com/thoughtbot/shoulda-context/pull/79\n[#80]: https://github.com/thoughtbot/shoulda-context/pull/80\n[#81]: https://github.com/thoughtbot/shoulda-context/pull/81\n[#82]: https://github.com/thoughtbot/shoulda-context/pull/82\n\n### Bug fixes\n\n* Fix broken thoughtbot logo on README.md by @sarahraqueld. ([#0551d18c92eebd94db70917d668202508b7d2268])\n* Use proper source location for should calls without a block by @segiddins. ([#92])\n* Fix the link to the gem on Rubygems in the README by @mcmire and @0xRichardH. ([#1098f5beb9b49a9d88434f6b3b6ccb58b2dfe93f])\n* Fix a method redefinition warning by @Earlopain. ([#94])\n\n[#0551d18c92eebd94db70917d668202508b7d2268]: https://github.com/thoughtbot/shoulda-context/commit/0551d18c92eebd94db70917d668202508b7d2268\n[#92]: https://github.com/thoughtbot/shoulda-context/pull/92\n[#94]: https://github.com/thoughtbot/shoulda-context/pull/94\n\n### Features\n\n* Add support for Rails 6.1 by @vsppedro. ([#84])\n\n[#84]: https://github.com/thoughtbot/shoulda-context/pull/84\n\n### Improvements\n\n* Update README for consistency across all shoulda-* gems by @mcmire. ([#5da1895f6c9917bc2aa0a248c209edb453a1340e])\n* Bump warnings_logger to 0.1.1 by @mcmire. ([#970d3d57a584ecb2652f0bc7188761024de16c52])\n* Add 'Getting started' section to the README by @mcmire. ([#52915f3a3cb36ae0494cfbacccc162b95932ca24])\n* Switch to Github Actions by @vsppedro. ([#74], [#83])\n* Do fewer intermediary allocations when calculating test methods by @segiddins. ([#89])\n* Call dynamic-readme reusable workflow by @stefannibrasil. ([#95])\n\n[#5da1895f6c9917bc2aa0a248c209edb453a1340e]: https://github.com/thoughtbot/shoulda-context/commit/5da1895f6c9917bc2aa0a248c209edb453a1340e\n[#970d3d57a584ecb2652f0bc7188761024de16c52]: https://github.com/thoughtbot/shoulda-context/commit/970d3d57a584ecb2652f0bc7188761024de16c52\n[#52915f3a3cb36ae0494cfbacccc162b95932ca24]: https://github.com/thoughtbot/shoulda-context/commit/52915f3a3cb36ae0494cfbacccc162b95932ca24\n[#1098f5beb9b49a9d88434f6b3b6ccb58b2dfe93f]: https://github.com/thoughtbot/shoulda-context/commit/1098f5beb9b49a9d88434f6b3b6ccb58b2dfe93f\n[#83]: https://github.com/thoughtbot/shoulda-context/pull/83\n[#89]: https://github.com/thoughtbot/shoulda-context/pull/89\n[#95]: https://github.com/thoughtbot/shoulda-context/pull/95\n\n## 2.0.0 (2020-06-13)\n\n### Backward-incompatible changes\n\n* Drop support for RSpec 2 matchers. Matchers passed to `should` must conform\n  to RSpec 3's API (`failure_message` and `failure_message_when_negated`).\n* Drop support for older versions of Rails. Rails 4.x-6.x are the\n  only versions supported now.\n* Drop support for older versions of Ruby. Ruby 2.4.x-2.7.x are the only\n  versions supported now.\n\n### Bug fixes\n\n* Fix how test names are generated so that when including the name of the\n  outermost test class, \"Test\" is not removed from the class name if it does not\n  fall at the end.\n* Remove warning from Ruby about `context` not being used when using the gem\n  with warnings enabled.\n* Fix macro autoloading code. Files intended to hold custom macros which are\n  located in either `test/shoulda_macros`, `vendor/gems/*/shoulda_macros`, or\n  `vendor/plugins/*/shoulda_macros` are now loaded and mixed into your test\n  framework's automatically.\n* Restore compatibility with Shoulda Matchers, starting from 3.0.\n* Fix some compatibility issues with Minitest 5.\n* Fix running tests within a Rails < 5.2 environment so that when tests fail, an\n  error is not produced claiming that Minitest::Result cannot find a test\n  method.\n"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\ngemspec\n\ngem \"appraisal\"\ngem \"bundler\", \"~> 1.0\"\ngem \"byebug\"\ngem \"m\"\ngem \"minitest\"\ngem \"mocha\"\ngem \"pry\", \"~> 0.12.0\"\ngem \"pry-byebug\", \"~> 3.6.0\"\ngem \"rake\"\ngem \"rubocop\", \"0.71.0\"\ngem \"snowglobe\", \">= 0.3.0\"\ngem \"test-unit\"\ngem \"warnings_logger\"\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) Tammer Saleh and thoughtbot, inc.\r\n\r\nPermission is hereby granted, free of charge, to any person\r\nobtaining a copy of this software and associated documentation\r\nfiles (the \"Software\"), to deal in the Software without\r\nrestriction, including without limitation the rights to use,\r\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the\r\nSoftware is furnished to do so, subject to the following\r\nconditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\r\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\r\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\r\nOTHER DEALINGS IN THE SOFTWARE.\r\n"
  },
  {
    "path": "MAINTAINING.md",
    "content": "# Maintaining Shoulda Context\n\nAlthough Shoulda Context doesn't receive feature updates these days, you may\nneed to update the gem for new versions of Ruby or Rails. Here's what you need\nto know in order to do that.\n\n## Getting started\n\nFirst, run the setup script:\n\n    bin/setup\n\nThen run all the tests to make sure everything is green:\n\n    bundle exec rake\n\n## Running tests\n\nThis project uses Minitest for tests and Appraisal to create environments\nattuned for different versions of Rails. To run a single test in a single test\nfile, you will need to use a combination of Appraisal and the [`m`][m] gem. For\ninstance:\n\n[m]: https://github.com/qrush/m\n\n    bundle exec appraisal rails_6_0 m test/shoulda/context_test.rb:39\n\n## Updating the changelog\n\nAfter every user-facing change makes it into master, we make a note of it in the\nchangelog, kept in `CHANGELOG.md`. The changelog is sorted in reverse order by\nrelease version, with the topmost version as the next release (tagged as\n\"(Unreleased)\").\n\nWithin each version, there are five available categories you can divide changes\ninto. They are all optional but they should appear in this order:\n\n1. Backward-compatible changes\n1. Deprecations\n1. Bug fixes\n1. Features\n1. Improvements\n\nWithin each category section, the changes relevant to that category are listed\nin chronological order.\n\nFor each change, provide a human-readable description of the change as well as a\nlinked reference to the PR where that change emerged (or the commit ID if no\nsuch PR is available). This helps users cross-reference changes if they need to.\n\n## Versioning\n\n### Naming a new version\n\nAs designated in the README, we follow [SemVer 2.0][semver]. This offers a\nmeaningful baseline for deciding how to name versions. Generally speaking:\n\n[semver]: https://semver.org/spec/v2.0.0.html\n\n* We bump the \"major\" part of the version if we're introducing\n  backward-incompatible changes (e.g. changing the API or core behavior,\n  removing parts of the API, or dropping support for a version of Ruby).\n* We bump the \"minor\" part if we're adding a new feature (e.g. adding a new\n  matcher or adding a new qualifier to a matcher).\n* We bump the \"patch\" part if we're merely including bugfixes.\n\nIn addition to major, minor, and patch levels, you can also append a\nsuffix to the version for pre-release versions. We usually use this to issue\nrelease candidates prior to an actual release. A version number in this case\nmight look like `4.0.0.rc1`.\n\n### Preparing and releasing a new version\n\nIn order to release any versions at all, you will need to have been added as\nan owner of the Ruby gem. If you want to give someone else these permissions,\nthen run:\n\n```bash\ngem owner shoulda-context -a <email address>\n```\n\nAssuming you have permission to publish a new version to RubyGems, then this is\nhow you release a version:\n\n1. First, you'll want to [make sure that the changelog is up to\n   date](#updating-the-changelog).\n\n2. Next, you'll want to update the `VERSION` constant in\n   `lib/shoulda/context/version.rb`. This constant is referenced in the\n   gemspec and is used in the Rake tasks to publish the gem on RubyGems.\n\n3. Assuming that everything looks good, place your changes to the changelog,\n   `version.rb`, and README in their own commit titled \"Bump version to\n   *X.Y.Z*\". Push this to GitHub (you can use `[ci skip]`) in the body of the\n   commit message to skip CI for this commit if you so choose). **There is no\n   going back after this point!**\n\n6. Once GitHub has the version-change commit, you will run:\n\n   ```bash\n   rake release\n   ```\n\n   This will push the gem to RubyGems and make it available for download.\n"
  },
  {
    "path": "README.md",
    "content": "# Shoulda Context [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge] [![Hound][hound-badge]][hound]\n\n[version-badge]: https://img.shields.io/gem/v/shoulda-context.svg\n[rubygems]: https://rubygems.org/gems/shoulda-context\n[travis-badge]: https://img.shields.io/travis/thoughtbot/shoulda-context/master.svg\n[travis]: https://travis-ci.org/thoughtbot/shoulda-context\n[downloads-badge]: https://img.shields.io/gem/dtv/shoulda-context.svg\n[hound-badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg\n[hound]: https://houndci.com\n\nShoulda Context makes it easy to write understandable and maintainable tests\nunder Minitest and Test::Unit within Rails projects or plain Ruby projects. It's\nfully compatible with your existing tests and requires no retooling to use.\n\n## Quick links\n\n📖 **[Read the documentation for the latest version.][rubydocs]**\n📢 **[See what's changed in recent versions.][changelog]**\n\n[rubydocs]: http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames\n[changelog]: CHANGELOG.md\n\n[shoulda-context]: https://github.com/thoughtbot/shoulda-context\n\n## Getting started\n\nIf you're working on a Rails app, then make sure to add this gem to the `test`\ngroup in your Gemfile:\n\n``` ruby\ngroup :test do\n  gem 'shoulda-context', '~> 3.0.0.rc1'\nend\n```\n\nIf you're not working on a Rails app, then you can simply add:\n\n``` ruby\ngem 'shoulda-context', '~> 3.0.0.rc1'\n```\n\nThen run `bundle install`.\n\n## Overview\n\nInstead of writing Ruby methods with `lots_of_underscores`, Shoulda Context lets\nyou name your tests and group them together using English.\n\nAt a minimum, the gem provides some convenience layers around core Minitest /\nTest::Unit functionality. For instance, this test case:\n\n```ruby\nclass CalculatorTest < Minitest::Test\n  context \"a calculator\" do\n    setup do\n      @calculator = Calculator.new\n    end\n\n    should \"add two numbers for the sum\" do\n      assert_equal 4, @calculator.sum(2, 2)\n    end\n\n    should \"multiply two numbers for the product\" do\n      assert_equal 10, @calculator.product(2, 5)\n    end\n  end\nend\n```\n\nturns into:\n\n```ruby\nclass CalculatorTest < Minitest::Test\n  def setup\n    @calculator = Calculator.new\n  end\n\n  define_method \"test_: a calculator should add two numbers for the sum\" do\n    assert_equal 4, @calculator.sum(2, 2)\n  end\n\n  define_method \"test_: a calculator should multiply two numbers for the product\" do\n    assert_equal 10, @calculator.product(2, 5)\n  end\nend\n```\n\nHowever, Shoulda Context also provides functionality apart from Minitest /\nTest::Unit that allows you to shorten tests drastically by making use of\nRSpec-compatible matchers. For instance, with [Shoulda\nMatchers][shoulda-matchers] you can write such tests as:\n\n```ruby\nclass User < ActiveSupport::TestCase\n  context \"validations\" do\n    subject { FactoryBot.build(:user) }\n\n    should validate_presence_of(:first_name)\n    should validate_presence_of(:last_name)\n    should validate_uniqueness_of(:email)\n    should_not allow_value('weird').for(:email)\n  end\nend\n```\n\n[shoulda-matchers]: https://github.com/thoughtbot/shoulda-matchers\n\n## API\n\n### DSL\n\nThe primary method in Shoulda Context's API is `context`, which declares a group\nof a tests.\n\nThese methods are available inside of a `context`:\n\n* `setup` — a DSL-y alternative to defining a `setup` method\n* `teardown` — a DSL-y alternative to defining a `teardown` method\n* `should` — There are two forms:\n  1. when passed a name + block, creates a test equivalent to defining a\n  `test_` method\n  2. when passed a matcher, creates a test that will run the matcher, asserting\n  that it passes\n* `should_not` — like the matcher version of `should`, but creates a test that\n  asserts that the matcher fails\n* `should_eventually` — allows you to temporarily skip tests\n* `context` — creates a subcontext\n\nThese methods are available within a test case class, but outside of a\n`context`:\n\n* `should` — same as above\n* `should_not` — same as above\n* `should_eventually` — same as above\n* `described_type` — returns the class being tested, as determined by the class\n  name of the outermost class\n* `subject` — lets you define an object that is the primary focus of the tests\n  within a context; this is most useful when using a matcher as the matcher will\n  make use of this as _its_ subject\n\nAnd these methods are available inside of a test (whether defined via a method\nor via `should`):\n\n* `subject` — an instance of the class under test, which is derived\n  automatically from the name of the test case class but is overridable via the\n  class method version of `subject` above\n\n### Assertions\n\nIn addition to the main API, the gem also provides some extra assertions that\nmay be of use:\n\n* `assert_same_elements` — compares two arrays for equality, but ignoring\n  ordering\n* `assert_contains` — asserts that an array has an item\n* `assert_does_not_contain` — the opposite of `assert_contains`\n* `assert_accepts` — what `should` uses internally; asserts that a matcher\n  object matches against a value\n* `assert_reject` — what `should_not` uses internally; asserts that a matcher\n  object does not match against a value\n\n## Compatibility\n\nShoulda Context is [tested][travis] and supported against Ruby 2.7+, Rails 6.0+,\nMinitest 4.x, and Test::Unit 3.x.\n\n## Versioning\n\nShoulda Context follows Semantic Versioning 2.0 as defined at\n<http://semver.org>.\n\n## Team\n\nShoulda Context is currently maintained by [Pedro Paiva][VSPPedro]. Previous\nmaintainers include [Elliot Winkler][mcmire], [Travis Jeffery][travisjeffery],\n[Gabe Berke-Williams][gabebw], [Ryan McGeary][rmm5t], [Joe Ferris][jferris], [Dan\nCroaky][croaky], and [Tammer Saleh][tammersaleh].\n\n[VSPPedro]: https://github.com/VSPPedro\n[mcmire]: https://github.com/mcmire\n[travisjeffery]: https://github.com/travisjeffery\n[gabebw]: https://github.com/gabebw\n[rmm5t]: https://github.com/rmm5t\n[jferris]: https://github.com/jferris\n[croaky]: https://github.com/croaky\n[tammersaleh]: https://github.com/tammersaleh\n\n## Copyright/License\n\nShoulda Context is copyright © Tammer Saleh and [thoughtbot,\ninc][thoughtbot-website]. It is free and opensource software and may be\nredistributed under the terms specified in the [LICENSE](LICENSE) file.\n\n[thoughtbot-website]: https://thoughtbot.com?utm_source=github\n\n<!-- START /templates/footer.md -->\n## About thoughtbot\n\n![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)\n\nThis repo is maintained and funded by thoughtbot, inc.\nThe names and logos for thoughtbot are trademarks of thoughtbot, inc.\n\nWe love open source software!\nSee [our other projects][community].\nWe are [available for hire][hire].\n\n[community]: https://thoughtbot.com/community?utm_source=github\n[hire]: https://thoughtbot.com/hire-us?utm_source=github\n\n\n<!-- END /templates/footer.md -->\n"
  },
  {
    "path": "Rakefile",
    "content": "require \"bundler/setup\"\nrequire \"bundler/gem_tasks\"\nrequire \"rake/testtask\"\nrequire \"pry-byebug\"\n\nrequire_relative \"test/support/current_bundle\"\n\nload \"tasks/shoulda.rake\"\n\nRake::TestTask.new do |t|\n  t.libs << \"test\"\n  t.ruby_opts += [\"-w\"]\n  t.pattern = \"test/**/*_test.rb\"\n  t.verbose = true\nend\n\ntask :default do\n  if Tests::CurrentBundle.instance.appraisal_in_use?\n    Rake::Task[\"test\"].invoke\n  elsif ENV[\"CI\"]\n    exec \"appraisal install && appraisal rake --trace\"\n  else\n    appraisal = Tests::CurrentBundle.instance.latest_appraisal\n    exec \"appraisal install && appraisal #{appraisal} rake --trace\"\n  end\nend\n"
  },
  {
    "path": "SECURITY.md",
    "content": "<!-- START /templates/security.md -->\n# Security Policy\n\n## Supported Versions\n\nOnly the the latest version of this project is supported at a given time. If\nyou find a security issue with an older version, please try updating to the\nlatest version first.\n\nIf for some reason you can't update to the latest version, please let us know\nyour reasons so that we can have a better understanding of your situation.\n\n## Reporting a Vulnerability\n\nFor security inquiries or vulnerability reports, visit\n<https://thoughtbot.com/security>.\n\nIf you have any suggestions to improve this policy, visit <https://thoughtbot.com/security>.\n\n<!-- END /templates/security.md -->\n"
  },
  {
    "path": "bin/install_gems_in_all_appraisals",
    "content": "#!/bin/bash\n\nset -euo pipefail\n\nSUPPORTED_VERSIONS=$(bin/supported_ruby_versions)\n\ninstall-gems-for-version() {\n  local version=\"$1\"\n  (export RBENV_VERSION=$version; bundle && bundle exec appraisal install)\n}\n\nfor version in $SUPPORTED_VERSIONS; do\n  echo\n  echo \"*** Installing gems for $version ***\"\n  install-gems-for-version $version\ndone\n"
  },
  {
    "path": "bin/run_all_tests",
    "content": "#!/bin/bash\n\nset -euo pipefail\n\nSUPPORTED_VERSIONS=$(bin/supported_ruby_versions)\n\nrun-tests-for-version() {\n  local version=\"$1\"\n  (export RBENV_VERSION=$version; bundle exec rake)\n}\n\nfor version in $SUPPORTED_VERSIONS; do\n  echo\n  echo \"*** Running tests for $version ***\"\n  run-tests-for-version $version\ndone\n"
  },
  {
    "path": "bin/setup",
    "content": "#!/usr/bin/env bash\n\nset -euo pipefail\n\nRUBY_VERSION=$(bin/supported_ruby_versions | xargs -n 1 echo | sort -V | tail -n 1)\n\ncd \"$(dirname \"$(dirname \"$0\")\")\"\n\nuname=$(uname)\n\nif [[ $uname == 'Darwin' ]]; then\n  platform='mac'\nelse\n  platform='linux'\nfi\n\nbanner() {\n  echo -e \"\\033[34m== $@ ==\\033[0m\"\n}\n\nsuccess() {\n  echo -e \"\\033[32m$@\\033[0m\"\n}\n\nwarning() {\n  echo -e \"\\033[33m$@\\033[0m\"\n}\n\nerror() {\n  echo -e \"\\033[31m$@\\033[0m\"\n}\n\nhas-executable() {\n  type \"$1\" &>/dev/null\n}\n\nis-running() {\n  pgrep \"$1\" >/dev/null\n}\n\ninstall() {\n  local apt_package=\"\"\n  local rpm_package=\"\"\n  local brew_package=\"\"\n  local default_package=\"\"\n  local package=\"\"\n\n  for arg in \"$@\"; do\n    case $arg in\n      apt=*)\n        apt_package=\"$arg\"\n        ;;\n      rpm=*)\n        rpm_package=\"$arg\"\n        ;;\n      brew=*)\n        brew_package=\"$arg\"\n        ;;\n      *)\n        default_package=\"$arg\"\n        ;;\n    esac\n  done\n\n  if has-executable brew; then\n    package=\"${brew_package:-$default_package}\"\n\n    if [[ -n $package ]]; then\n      brew install \"$package\"\n    fi\n  elif has-executable apt-get; then\n    package=\"${apt_package:-$default_package}\"\n\n    if [[ -n $package ]]; then\n      sudo apt-get install -y \"$package\"\n    fi\n  elif has-executable yum; then\n    package=\"${yum_package:-$default_package}\"\n\n    if [[ -n $package ]]; then\n      sudo yum install -y \"$package\"\n    fi\n  else\n    error \"Sorry, I'm not sure how to install $default_package.\"\n    exit 1\n  fi\n}\n\ncheck-for-build-tools() {\n  if [[ $platform == \"linux\" ]]; then\n    if ! has-executable apt-get; then\n      error \"You don't seem to have a package manager installed.\"\n      echo \"The setup script assumes you're using Debian or a Debian-derived flavor of Linux\"\n      echo \"(i.e. something with Apt). If this is not the case, then we would gladly take a\"\n      echo \"PR fixing this!\"\n      exit 1\n    fi\n\n    # TODO: Check if build-essential is installed on Debian?\n  else\n    if ! has-executable brew; then\n      error \"You don't seem to have Homebrew installed.\"\n      echo\n      echo \"Follow the instructions here to do this:\"\n      echo\n      echo \"http://brew.sh\"\n      exit 1\n    fi\n\n    # TODO: Check that OS X Command Line Tools are installed?\n  fi\n}\n\ninstall-development-libraries() {\n  install apt=ruby-dev rpm=ruby-devel\n  install rpm=zlib-devel\n}\n\ninstall-dependencies() {\n  if ! has-executable sqlite3; then\n    banner 'Installing SQLite 3'\n    install sqlite3\n    install apt=libsqlite3-dev rpm=sqlite-devel\n  fi\n\n  if ! has-executable psql; then\n    banner 'Installing PostgreSQL'\n    install postgresql\n    install apt=libpq-dev rpm=postgresql-devel\n  fi\n\n  if ! is-running postgres; then\n    banner 'Starting PostgreSQL'\n    start postgresql\n  fi\n\n  if ! has-executable heroku; then\n    banner 'Installing Heroku'\n    install heroku/brew/heroku heroku\n  fi\n\n  if has-executable rbenv; then\n    if ! (rbenv versions | grep $RUBY_VERSION'\\>' &>/dev/null); then\n      banner \"Installing Ruby $RUBY_VERSION with rbenv\"\n      rbenv install --skip-existing \"$RUBY_VERSION\"\n    fi\n  elif has-executable rvm; then\n    if ! (rvm ls | grep $RUBY_VERSION'\\>' &>/dev/null); then\n      banner \"Installing Ruby $RUBY_VERSION with rvm\"\n      error \"You don't seem to have Ruby $RUBY_VERSION installed.\"\n      echo\n      echo \"Use RVM to do so, and then re-run this command.\"\n      echo\n    fi\n  else\n    error \"You don't seem to have a Ruby manager installed.\"\n    echo\n    echo 'We recommend using rbenv. You can find installation instructions here:'\n    echo\n    echo 'http://github.com/rbenv/rbenv'\n    echo\n    echo \"When you're done, simply re-run this script!\"\n    exit 1\n  fi\n\n  banner 'Installing Ruby dependencies'\n  gem install bundler -v '~> 1.0' --conservative\n  bundle check || bundle install\n  bundle exec appraisal install\n\n  if ! has-executable node; then\n    banner 'Installing Node'\n\n    if [[ $platform == 'linux' ]]; then\n      curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -\n\n      install nodejs\n\n      if ! has-executable npm; then\n        install npm\n      fi\n    else\n      install nodejs\n    fi\n  fi\n}\n\ncheck-for-build-tools\ninstall-development-libraries\ninstall-dependencies\n"
  },
  {
    "path": "bin/supported_ruby_versions",
    "content": "#!/usr/bin/env ruby\n\nrequire 'yaml'\n\nci_config_path = File.expand_path('../../.github//workflows/ci.yml', __FILE__)\nci_config = YAML.load_file(ci_config_path)\nputs ci_config.dig('jobs', 'build', 'strategy', 'matrix', 'ruby').join(' ')\n"
  },
  {
    "path": "bin/update_gem_in_all_appraisals",
    "content": "#!/bin/bash\n\nset -euo pipefail\n\nSUPPORTED_VERSIONS=$(bin/supported_ruby_versions)\ngem=\"$1\"\n\nupdate-gem-for-version() {\n  local version=\"$1\"\n  (export RBENV_VERSION=$version; bundle update \"$gem\"; bundle exec appraisal update \"$gem\")\n}\n\nfor version in $SUPPORTED_VERSIONS; do\n  echo\n  echo \"*** Updating $gem for $version ***\"\n  update-gem-for-version $version\ndone\n"
  },
  {
    "path": "bin/update_gems_in_all_appraisals",
    "content": "#!/bin/bash\n\nset -euo pipefail\n\nSUPPORTED_VERSIONS=$(bin/supported_ruby_versions)\n\nupdate-gems-for-version() {\n  local version=\"$1\"\n  (export RBENV_VERSION=$version; bundle update \"${@:2}\"; bundle exec appraisal update \"${@:2}\")\n}\n\nfor version in $SUPPORTED_VERSIONS; do\n  echo\n  echo \"*** Updating gems for $version ***\"\n  update-gems-for-version \"$version\" \"$@\"\ndone\n"
  },
  {
    "path": "exe/convert_to_should_syntax",
    "content": "#!/usr/bin/env ruby\nrequire 'fileutils'\nrequire 'tmpdir'\n\nTMP = Dir::tmpdir\n\ndef usage(msg = nil)\n  puts \"Error: #{msg}\" if msg\n  puts if msg\n  puts \"Usage: #{File.basename(__FILE__)} normal_test_file.rb\"\n  puts\n  puts \"Will convert an existing test file with names like \"\n  puts\n  puts \"  def test_should_do_stuff\"\n  puts \"    ...\"\n  puts \"  end\"\n  puts\n  puts \"to one using the new syntax: \"\n  puts\n  puts \"  should \\\"be super cool\\\" do\"\n  puts \"    ...\"\n  puts \"  end\"\n  puts\n  puts \"A copy of the old file will be left under #{TMP} in case\\nthis script just seriously screws up\"\n  puts\n  exit (msg ? 2 : 0)\nend\n\nusage(\"Wrong number of arguments.\") unless ARGV.size == 1\nusage(\"Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to a writeable directory.\") unless File.directory?(TMP) && File.writable?(TMP)\n\nfile = ARGV.shift\ntmpfile = File.join(TMP, File.basename(file))\nusage(\"File '#{file}' doesn't exist\") unless File.exist?(file)\n\nFileUtils.cp(file, tmpfile)\ncontents = File.read(tmpfile)\ncontents.gsub!(/def test_should_(\\S+)/) {|line| \"should \\\"#{$1.tr('_', ' ')}\\\" do\"}\ncontents.gsub!(/def test_(\\S+)/) {|line| \"should \\\"RENAME ME: test #{$1.tr('_', ' ')}\\\" do\"}\nFile.open(file, 'w') { |f| f.write(contents) }\n\nputs \"File '#{file}' has been converted to 'should' syntax.  Old version has been stored in '#{tmpfile}'\"\n"
  },
  {
    "path": "gemfiles/rails_6_0.gemfile",
    "content": "# This file was generated by Appraisal\n\nsource \"https://rubygems.org\"\n\ngem \"appraisal\"\ngem \"bundler\", \"~> 1.0\"\ngem \"byebug\"\ngem \"m\"\ngem \"minitest\"\ngem \"mocha\"\ngem \"pry\", \"~> 0.12.0\"\ngem \"pry-byebug\", \"~> 3.6.0\"\ngem \"rake\"\ngem \"rubocop\", \"0.71.0\"\ngem \"snowglobe\", \">= 0.3.0\"\ngem \"test-unit\"\ngem \"warnings_logger\"\ngem \"sqlite3\", \"~> 1.4.0\"\ngem \"spring\"\ngem \"spring-commands-rspec\"\ngem \"minitest-reporters\"\ngem \"rails\", \"~> 6.0.2\"\ngem \"puma\", \"~> 4.1\"\ngem \"sass-rails\", \">= 6\"\ngem \"webpacker\", \"~> 4.0\"\ngem \"turbolinks\", \"~> 5\"\ngem \"jbuilder\", \"~> 2.7\"\ngem \"bcrypt\", \"~> 3.1.7\"\ngem \"bootsnap\", \">= 1.4.2\", require: false\ngem \"listen\", \">= 3.0.5\", \"< 3.2\"\ngem \"spring-watcher-listen\", \"~> 2.0.0\"\ngem \"capybara\", \">= 2.15\"\ngem \"selenium-webdriver\"\ngem \"webdrivers\"\ngem \"rails-controller-testing\", \">= 1.0.4\"\ngem \"pg\", \"~> 1.1\", platform: :ruby\n\ngemspec path: \"../\"\n"
  },
  {
    "path": "gemfiles/rails_6_1.gemfile",
    "content": "# This file was generated by Appraisal\n\nsource \"https://rubygems.org\"\n\ngem \"appraisal\"\ngem \"bcrypt\", \"~> 3.1.7\"\ngem \"bootsnap\", \">= 1.4.2\", require: false\ngem \"bundler\", \"~> 1.0\"\ngem \"byebug\"\ngem \"capybara\", \">= 2.15\"\ngem \"jbuilder\", \"~> 2.7\"\ngem \"listen\", \">= 3.0.5\", \"< 3.2\"\ngem \"m\"\ngem \"minitest\"\ngem \"minitest-reporters\"\ngem \"mocha\"\ngem \"pg\", \">= 0.18\", \"< 2.0\"\ngem \"pry\", \"~> 0.12.0\"\ngem \"pry-byebug\", \"~> 3.6.0\"\ngem \"puma\", \"~> 5.0\"\ngem \"rails\", \"~> 6.1.3.2\"\ngem \"rails-controller-testing\", \">= 1.0.4\"\ngem \"rake\"\ngem \"rubocop\", \"0.71.0\"\ngem \"sass-rails\", \">= 6\"\ngem \"selenium-webdriver\"\ngem \"snowglobe\", \">= 0.3.0\"\ngem \"spring\"\ngem \"spring-commands-rspec\"\ngem \"spring-watcher-listen\", \"~> 2.0.0\"\ngem \"sqlite3\", \"~> 1.4.0\"\ngem \"test-unit\"\ngem \"turbolinks\", \"~> 5\"\ngem \"warnings_logger\"\ngem \"webdrivers\"\n\ngemspec path: \"../\"\n"
  },
  {
    "path": "lib/shoulda/context/assertions.rb",
    "content": "module Shoulda # :nodoc:\n  module Context\n    module Assertions\n      # Asserts that two arrays contain the same elements, the same number of times.  Essentially ==, but unordered.\n      #\n      #   assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes)\n      def assert_same_elements(a1, a2, msg = nil)\n        [:select, :inject, :size].each do |m|\n          [a1, a2].each {|a| assert_respond_to(a, m, \"Are you sure that #{a.inspect} is an array?  It doesn't respond to #{m}.\") }\n        end\n\n        assert a1h = a1.inject({}) { |h,e| h[e] ||= a1.select { |i| i == e }.size; h }\n        assert a2h = a2.inject({}) { |h,e| h[e] ||= a2.select { |i| i == e }.size; h }\n\n        assert_equal(a1h, a2h, msg)\n      end\n\n      # Asserts that the given collection contains item x.  If x is a regular expression, ensure that\n      # at least one element from the collection matches x.  +extra_msg+ is appended to the error message if the assertion fails.\n      #\n      #   assert_contains(['a', '1'], /\\d/) => passes\n      #   assert_contains(['a', '1'], 'a') => passes\n      #   assert_contains(['a', '1'], /not there/) => fails\n      def assert_contains(collection, x, extra_msg = \"\")\n        collection = Array(collection)\n        msg = \"#{x.inspect} not found in #{collection.to_a.inspect} #{extra_msg}\"\n        case x\n        when Regexp\n          assert(collection.detect { |e| e =~ x }, msg)\n        else\n          assert(collection.include?(x), msg)\n        end\n      end\n\n      # Asserts that the given collection does not contain item x.  If x is a regular expression, ensure that\n      # none of the elements from the collection match x.\n      def assert_does_not_contain(collection, x, extra_msg = \"\")\n        collection = Array(collection)\n        msg = \"#{x.inspect} found in #{collection.to_a.inspect} \" + extra_msg\n        case x\n        when Regexp\n          assert(!collection.detect { |e| e =~ x }, msg)\n        else\n          assert(!collection.include?(x), msg)\n        end\n      end\n\n      # Asserts that the given matcher returns true when +target+ is passed to\n      # #matches?\n      def assert_accepts(matcher, target, options = {})\n        if matcher.respond_to?(:in_context)\n          matcher.in_context(self)\n        end\n\n        if matcher.matches?(target)\n          safe_assert_block { true }\n          if options[:message]\n            assert_match options[:message], matcher.failure_message_when_negated\n          end\n        else\n          safe_assert_block(matcher.failure_message) { false }\n        end\n      end\n\n      # Asserts that the given matcher returns true when +target+ is passed to\n      # #does_not_match? or false when +target+ is passed to #matches? if\n      # #does_not_match? is not implemented\n      def assert_rejects(matcher, target, options = {})\n        if matcher.respond_to?(:in_context)\n          matcher.in_context(self)\n        end\n\n        not_match =\n          if matcher.respond_to?(:does_not_match?)\n            matcher.does_not_match?(target)\n          else\n            !matcher.matches?(target)\n          end\n\n        if not_match\n          safe_assert_block { true }\n          if options[:message]\n            assert_match options[:message], matcher.failure_message\n          end\n        else\n          safe_assert_block(matcher.failure_message_when_negated) { false }\n        end\n      end\n\n      def safe_assert_block(message = \"assert_block failed.\", &block)\n        if respond_to?(:assert_block)\n          assert_block message, &block\n        else\n          assert yield, message\n        end\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/autoload_macros.rb",
    "content": "module Shoulda # :nodoc:\n  # Call autoload_macros when you want to load test macros automatically in a non-Rails\n  # project (it's done automatically for Rails projects).\n  # You don't need to specify ROOT/test/shoulda_macros explicitly. Your custom macros\n  # are loaded automatically when you call autoload_macros.\n  #\n  # The first argument is the path to you application's root directory.\n  # All following arguments are directories relative to your root, which contain\n  # shoulda_macros subdirectories. These directories support the same kinds of globs as the\n  # Dir class.\n  #\n  # Basic usage (from a test_helper):\n  # Shoulda.autoload_macros(File.dirname(__FILE__) + '/..')\n  # will load everything in\n  # - your_app/test/shoulda_macros\n  #\n  # To load vendored macros as well:\n  # Shoulda.autoload_macros(APP_ROOT, 'vendor/*')\n  # will load everything in\n  # - APP_ROOT/vendor/*/shoulda_macros\n  # - APP_ROOT/test/shoulda_macros\n  #\n  # To load macros in an app with a vendor directory laid out like Rails':\n  # Shoulda.autoload_macros(APP_ROOT, 'vendor/{plugins,gems}/*')\n  # or\n  # Shoulda.autoload_macros(APP_ROOT, 'vendor/plugins/*', 'vendor/gems/*')\n  # will load everything in\n  # - APP_ROOT/vendor/plugins/*/shoulda_macros\n  # - APP_ROOT/vendor/gems/*/shoulda_macros\n  # - APP_ROOT/test/shoulda_macros\n  #\n  # If you prefer to stick testing dependencies away from your production dependencies:\n  # Shoulda.autoload_macros(APP_ROOT, 'vendor/*', 'test/vendor/*')\n  # will load everything in\n  # - APP_ROOT/vendor/*/shoulda_macros\n  # - APP_ROOT/test/vendor/*/shoulda_macros\n  # - APP_ROOT/test/shoulda_macros\n  def self.autoload_macros(root, *dirs)\n    dirs << File.join('test')\n    complete_dirs = dirs.map{|d| File.join(root, d, 'shoulda_macros')}\n    all_files     = complete_dirs.inject([]){ |files, dir| files + Dir[File.join(dir, '*.rb')] }\n    all_files.each do |file|\n      require file\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/configuration.rb",
    "content": "module Shoulda\n  module Context\n    def self.configure\n      yield self\n    end\n\n    def self.include(mod)\n      test_framework_test_cases.each do |test_case|\n        test_case.class_eval { include mod }\n      end\n    end\n\n    def self.extend(mod)\n      test_framework_test_cases.each do |test_case|\n        test_case.extend(mod)\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/context.rb",
    "content": "module Shoulda\n  module Context\n    class Context # :nodoc:\n      attr_accessor :name               # my name\n      attr_accessor :parent             # may be another context, or the original test::unit class.\n      attr_accessor :subcontexts        # array of contexts nested under myself\n      attr_accessor :setup_blocks       # blocks given via setup methods\n      attr_accessor :teardown_blocks    # blocks given via teardown methods\n      attr_accessor :shoulds            # array of hashes representing the should statements\n      attr_accessor :should_eventuallys # array of hashes representing the should eventually statements\n\n      # accessor with cache\n      def subject_block\n        return @subject_block if @subject_block\n        parent.subject_block\n      end\n      attr_writer :subject_block\n\n      def initialize(name, parent, &blk)\n        Shoulda::Context.add_context(self)\n        self.name               = name\n        self.parent             = parent\n        self.setup_blocks       = []\n        self.teardown_blocks    = []\n        self.shoulds            = []\n        self.should_eventuallys = []\n        self.subcontexts        = []\n        self.subject_block      = nil\n\n        if block_given?\n          merge_block(&blk)\n        else\n          merge_block { warn \"  * WARNING: Block missing for context '#{full_name}'\" }\n        end\n        Shoulda::Context.remove_context\n      end\n\n      def merge_block(&blk)\n        if self.respond_to?(:instance_exec)\n          self.instance_exec(&blk)\n        else\n          # deprecated in Rails 4.x\n          blk.bind(self).call\n        end\n      end\n\n      def context(name, &blk)\n        self.subcontexts << Context.new(name, self, &blk)\n      end\n\n      def setup(&blk)\n        self.setup_blocks << blk\n      end\n\n      def teardown(&blk)\n        self.teardown_blocks << blk\n      end\n\n      class LambdaWithLocation < Proc\n        attr_reader :source_location\n\n        def initialize(source_location, &blk)\n          @source_location = source_location\n          super(&blk)\n        end\n      end\n\n      def should(name_or_matcher, options = {}, source_location = (loc = caller_locations(1, 1)[0]\n                                                                   [loc.path, loc.lineno]), &blk)\n        if name_or_matcher.respond_to?(:description) && name_or_matcher.respond_to?(:matches?)\n          name = name_or_matcher.description\n          blk = LambdaWithLocation.new(source_location, &lambda { assert_accepts name_or_matcher, subject })\n        else\n          name = name_or_matcher\n        end\n\n        if blk\n          self.shoulds << { :name => name, :before => options[:before], :block => blk }\n        else\n          self.should_eventuallys << { :name => name }\n        end\n      end\n\n      def should_not(matcher, source_location = (loc = caller_locations(1, 1)[0]\n                                                 [loc.path, loc.lineno]))\n        name = matcher.description\n        blk = LambdaWithLocation.new(source_location, &lambda { assert_rejects matcher, subject })\n        self.shoulds << { :name => \"not #{name}\", :block => blk }\n      end\n\n      def should_eventually(name, &blk)\n        self.should_eventuallys << { :name => name, :block => blk }\n      end\n\n      def subject(&block)\n        self.subject_block = block\n      end\n\n      def full_name\n        parent_name = parent.full_name if am_subcontext?\n        return [parent_name, name].join(\" \").strip\n      end\n\n      def am_subcontext?\n        parent.is_a?(self.class) # my parent is the same class as myself.\n      end\n\n      def test_unit_class\n        am_subcontext? ? parent.test_unit_class : parent\n      end\n\n      def test_methods\n        @test_methods ||= Hash.new { |h,k|\n          h[k] = k.instance_methods.each_with_object({}) { |n, a| a[n] = true }\n        }\n      end\n\n      def create_test_from_should_hash(should)\n        test_name = build_test_name_from(should)\n\n        if test_methods[test_unit_class][test_name.to_s]\n          raise Shoulda::Context::DuplicateTestError.new(\n            \"'#{test_name}' is defined more than once.\"\n          )\n        end\n\n        test_methods[test_unit_class][test_name.to_s] = true\n        file, line_no = should[:block].source_location\n\n        # Ruby doesn't know that we are referring to this variable inside of the\n        # eval, so it will emit a warning that it's \"assigned but unused\".\n        # However, making a double assignment places `context` on the right hand\n        # side of the assignment, thereby putting it into use.\n        context = context = self\n\n        test_unit_class.class_eval <<-end_eval, file, line_no\n          define_method test_name do\n            @shoulda_context = context\n            begin\n              context.run_parent_setup_blocks(self)\n              if should[:before]\n                instance_exec(&should[:before])\n              end\n              context.run_current_setup_blocks(self)\n              instance_exec(&should[:block])\n            ensure\n              context.run_all_teardown_blocks(self)\n            end\n          end\n        end_eval\n      end\n\n      def build_test_name_from(should)\n        [\n          test_name_prefix,\n          full_name,\n          \"should\",\n          \"#{should[:name]}. \"\n        ].flatten.join(' ').to_sym\n      end\n\n      def run_all_setup_blocks(binding)\n        run_parent_setup_blocks(binding)\n        run_current_setup_blocks(binding)\n      end\n\n      def run_parent_setup_blocks(binding)\n        self.parent.run_all_setup_blocks(binding) if am_subcontext?\n      end\n\n      def run_current_setup_blocks(binding)\n        setup_blocks.each do |setup_block|\n          if binding.respond_to?(:instance_exec)\n            binding.instance_exec(&setup_block)\n          else\n            # deprecated in Rails 4.x\n            setup_block.bind(binding).call\n          end\n        end\n      end\n\n      def run_all_teardown_blocks(binding)\n        teardown_blocks.reverse.each do |teardown_block|\n          if binding.respond_to?(:instance_exec)\n            binding.instance_exec(&teardown_block)\n          else\n            # deprecated in Rails 4.x\n            teardown_block.bind(binding).call\n          end\n        end\n        self.parent.run_all_teardown_blocks(binding) if am_subcontext?\n      end\n\n      def print_should_eventuallys\n        should_eventuallys.each do |should|\n          test_name = [full_name, \"should\", \"#{should[:name]}. \"].flatten.join(' ')\n          puts \"  * DEFERRED: \" + test_name\n        end\n      end\n\n      def build\n        shoulds.each do |should|\n          create_test_from_should_hash(should)\n        end\n\n        subcontexts.each { |context| context.build }\n\n        print_should_eventuallys\n      end\n\n      def test_name_prefix\n        if defined?(Minitest)\n          'test_:'\n        else\n          'test:'\n        end\n      end\n\n      def method_missing(method, *args, &blk)\n        test_unit_class.send(method, *args, &blk)\n      end\n    end\n\n    class DuplicateTestError < RuntimeError; end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/dsl.rb",
    "content": "require \"shoulda/context/assertions\"\n\nmodule Shoulda\n  module Context\n    module DSL\n      def self.included(base)\n        base.class_eval do\n          include Assertions\n          include InstanceMethods\n        end\n        base.extend(ClassMethods)\n      end\n\n      module ClassMethods\n        # == Should statements\n        #\n        # Should statements are just syntactic sugar over normal Test::Unit test\n        # methods.  A should block contains all the normal code and assertions\n        # you're used to seeing, with the added benefit that they can be wrapped\n        # inside context blocks (see below).\n        #\n        # === Example:\n        #\n        #  class UserTest < Test::Unit::TestCase\n        #\n        #    def setup\n        #      @user = User.new(\"John\", \"Doe\")\n        #    end\n        #\n        #    should \"return its full name\"\n        #      assert_equal 'John Doe', @user.full_name\n        #    end\n        #\n        #  end\n        #\n        # ...will produce the following test:\n        # * <tt>\"test: User should return its full name. \"</tt>\n        #\n        # Note: The part before <tt>should</tt> in the test name is gleamed from the name of the Test::Unit class.\n        #\n        # Should statements can also take a Proc as a <tt>:before </tt>option.  This proc runs after any\n        # parent context's setups but before the current context's setup.\n        #\n        # === Example:\n        #\n        #  context \"Some context\" do\n        #    setup { puts(\"I run after the :before proc\") }\n        #\n        #    should \"run a :before proc\", :before => lambda { puts(\"I run before the setup\") }  do\n        #      assert true\n        #    end\n        #  end\n        #\n        # Should statements can also wrap matchers, making virtually any matcher\n        # usable in a macro style. The matcher's description is used to generate a\n        # test name and failure message, and the test will pass if the matcher\n        # matches the subject.\n        #\n        # === Example:\n        #\n        #   should validate_presence_of(:first_name).with_message(/gotta be there/)\n        #\n\n        def should(name_or_matcher, options = {}, source_location = (loc = caller_locations(1, 1)[0]\n                                                                     [loc.path, loc.lineno]), &blk)\n          if Shoulda::Context.current_context\n            Shoulda::Context.current_context.should(name_or_matcher, options, source_location, &blk)\n          else\n            context_name = self.name.gsub(/Test$/, \"\") if name\n            context = Shoulda::Context::Context.new(context_name, self) do\n              should(name_or_matcher, options, source_location, &blk)\n            end\n            context.build\n          end\n        end\n\n        # Allows negative tests using matchers. The matcher's description is used\n        # to generate a test name and negative failure message, and the test will\n        # pass unless the matcher matches the subject.\n        #\n        # === Example:\n        #\n        #   should_not set_the_flash\n        def should_not(matcher, source_location = (loc = caller_locations(1, 1)[0]\n                                                   [loc.path, loc.lineno]))\n          if Shoulda::Context.current_context\n            Shoulda::Context.current_context.should_not(matcher, source_location)\n          else\n            context_name = self.name.gsub(/Test$/, \"\") if name\n            context = Shoulda::Context::Context.new(context_name, self) do\n              should_not(matcher, source_location)\n            end\n            context.build\n          end\n        end\n\n        # == Before statements\n        #\n        # Before statements are should statements that run before the current\n        # context's setup. These are especially useful when setting expectations.\n        #\n        # === Example:\n        #\n        #  class UserControllerTest < Test::Unit::TestCase\n        #    context \"the index action\" do\n        #      setup do\n        #        @users = [Factory(:user)]\n        #        User.stubs(:find).returns(@users)\n        #      end\n        #\n        #      context \"on GET\" do\n        #        setup { get :index }\n        #\n        #        should respond_with(:success)\n        #\n        #        # runs before \"get :index\"\n        #        before_should \"find all users\" do\n        #          User.expects(:find).with(:all).returns(@users)\n        #        end\n        #      end\n        #    end\n        #  end\n        def before_should(name, &blk)\n          should(name, :before => blk) { assert true }\n        end\n\n        # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output.\n        def should_eventually(name, options = {}, &blk)\n          context_name = self.name.gsub(/Test$/, \"\")\n          context = Shoulda::Context::Context.new(context_name, self) do\n            should_eventually(name, &blk)\n          end\n          context.build\n        end\n\n        # == Contexts\n        #\n        # A context block groups should statements under a common set of setup/teardown methods.\n        # Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability\n        # and readability of your test code.\n        #\n        # A context block can contain setup, should, should_eventually, and teardown blocks.\n        #\n        #  class UserTest < Test::Unit::TestCase\n        #    context \"A User instance\" do\n        #      setup do\n        #        @user = User.find(:first)\n        #      end\n        #\n        #      should \"return its full name\"\n        #        assert_equal 'John Doe', @user.full_name\n        #      end\n        #    end\n        #  end\n        #\n        # This code will produce the method <tt>\"test: A User instance should return its full name. \"</tt>.\n        #\n        # Contexts may be nested.  Nested contexts run their setup blocks from out to in before each\n        # should statement.  They then run their teardown blocks from in to out after each should statement.\n        #\n        #  class UserTest < Test::Unit::TestCase\n        #    context \"A User instance\" do\n        #      setup do\n        #        @user = User.find(:first)\n        #      end\n        #\n        #      should \"return its full name\"\n        #        assert_equal 'John Doe', @user.full_name\n        #      end\n        #\n        #      context \"with a profile\" do\n        #        setup do\n        #          @user.profile = Profile.find(:first)\n        #        end\n        #\n        #        should \"return true when sent :has_profile?\"\n        #          assert @user.has_profile?\n        #        end\n        #      end\n        #    end\n        #  end\n        #\n        # This code will produce the following methods\n        # * <tt>\"test: A User instance should return its full name. \"</tt>\n        # * <tt>\"test: A User instance with a profile should return true when sent :has_profile?. \"</tt>\n        #\n        # <b>Just like should statements, a context block can exist next to normal <tt>def test_the_old_way; end</tt>\n        # tests</b>.  This means you do not have to fully commit to the context/should syntax in a test file.\n\n        def context(name, &blk)\n          if Shoulda::Context.current_context\n            Shoulda::Context.current_context.context(name, &blk)\n          else\n            context = Shoulda::Context::Context.new(name, self, &blk)\n            context.build\n          end\n        end\n\n        # Returns the class being tested, as determined by the test class name.\n        #\n        #   class UserTest; described_type; end\n        #   # => User\n        def described_type\n          @described_type ||= self.name.\n            gsub(/Test$/, '').\n            split('::').\n            inject(Object) do |parent, local_name|\n              parent.const_get(local_name, false)\n            end\n        end\n\n        # Sets the return value of the subject instance method:\n        #\n        #   class UserTest < Test::Unit::TestCase\n        #     subject { User.first }\n        #\n        #     # uses the existing user\n        #     should validate_uniqueness_of(:email)\n        #   end\n        def subject(&block)\n          @subject_block = block\n        end\n\n        def subject_block # :nodoc:\n          @subject_block ||= nil\n        end\n      end\n\n      module InstanceMethods\n        # Returns an instance of the class under test.\n        #\n        #   class UserTest\n        #     should \"be a user\" do\n        #       assert_kind_of User, subject # passes\n        #     end\n        #   end\n        #\n        # The subject can be explicitly set using the subject class method:\n        #\n        #   class UserTest\n        #     subject { User.first }\n        #     should \"be an existing user\" do\n        #       assert !subject.new_record? # uses the first user\n        #     end\n        #   end\n        #\n        # The subject is used by all macros that require an instance of the class\n        # being tested.\n        def subject\n          @shoulda_subject ||= construct_subject\n        end\n\n        def subject_block # :nodoc:\n          (@shoulda_context && @shoulda_context.subject_block) || self.class.subject_block\n        end\n\n        def get_instance_of(object_or_klass) # :nodoc:\n          if object_or_klass.is_a?(Class)\n            object_or_klass.new\n          else\n            object_or_klass\n          end\n        end\n\n        def instance_variable_name_for(klass) # :nodoc:\n          klass.to_s.split('::').last.underscore\n        end\n\n        private\n\n        def construct_subject\n          if subject_block\n            instance_eval(&subject_block)\n          else\n            get_instance_of(self.class.described_type)\n          end\n        end\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/proc_extensions.rb",
    "content": "# Stolen straight from ActiveSupport\n\nclass Proc #:nodoc:\n  def bind(object)\n    block, time = self, Time.now\n    (class << object; self end).class_eval do\n      method_name = \"__bind_#{time.to_i}_#{time.usec}\"\n      define_method(method_name, &block)\n      method = instance_method(method_name)\n      remove_method(method_name)\n      method\n    end.bind(object)\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/railtie.rb",
    "content": "module Shoulda\n  module Context\n    class Railtie < Rails::Railtie\n      initializer \"shoulda_context.autoload_macros\" do\n        if Rails.env.test?\n          Shoulda.autoload_macros(\n            Rails.root,\n            File.join(\"vendor\", \"{plugins,gems}\", \"*\")\n          )\n        end\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/tasks/list_tests.rake",
    "content": "namespace :shoulda do\n  desc \"List the names of the test methods in a specification like format\"\n  task :list do\n    $LOAD_PATH.unshift(\"test\")\n\n    require 'test/unit'\n    require 'rubygems'\n    require 'active_support'\n\n    # bug in test unit.  Set to true to stop from running.\n    Test::Unit.run = true\n\n    test_files = Dir.glob(File.join('test', '**', '*_test.rb'))\n    test_files.each do |file|\n      load file\n      klass = File.basename(file, '.rb').classify\n      unless Object.const_defined?(klass.to_s)\n        puts \"Skipping #{klass} because it doesn't map to a Class\"\n        next\n      end\n      klass = klass.constantize\n\n      puts klass.name.gsub('Test', '')\n\n      test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort\n      test_methods.each {|m| puts \"  \" + m }\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/tasks/yaml_to_shoulda.rake",
    "content": "namespace :shoulda do\n  # From http://blog.internautdesign.com/2007/11/2/a-yaml_to_shoulda-rake-task\n  # David.Lowenfels@gmail.com\n  desc \"Converts a YAML file (FILE=./path/to/yaml) into a Shoulda skeleton\"\n  task :from_yaml do\n    require 'yaml'\n\n    def yaml_to_context(hash, indent = 0)\n      indent1 = '  ' * indent\n      indent2 = '  ' * (indent + 1)\n      hash.each_pair do |context, shoulds|\n        puts indent1 + \"context \\\"#{context}\\\" do\"\n        puts\n        shoulds.each do |should|\n          yaml_to_context( should, indent + 1 ) and next if should.is_a?( Hash )\n          puts indent2 + \"should_eventually \\\"\" + should.gsub(/^should +/,'') + \"\\\" do\"\n          puts indent2 + \"end\"\n          puts\n        end\n        puts indent1 + \"end\"\n      end\n    end\n\n    puts(\"Please pass in a FILE argument.\") and exit unless ENV['FILE']\n\n    yaml_to_context( YAML.load_file( ENV['FILE'] ) )\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/tasks.rb",
    "content": "Dir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')].each do |f|\n  load f\nend\n"
  },
  {
    "path": "lib/shoulda/context/test_framework_detection.rb",
    "content": "module Shoulda\n  module Context\n    module TestFrameworkDetection\n      def self.possible_test_frameworks\n        [\n          -> { ActiveSupport::TestCase },\n          -> { Minitest::Test },\n          -> { Test::Unit::TestCase }\n        ]\n      end\n\n      def self.resolve_framework(future_framework)\n        future_framework.call\n      rescue NameError\n        nil\n      end\n\n      def self.detected_test_framework_test_cases\n        possible_test_frameworks.\n          map { |future_framework| resolve_framework(future_framework) }.\n          compact\n      end\n\n      def self.test_framework_test_cases\n        @_test_framework_test_cases ||= detected_test_framework_test_cases\n      end\n    end\n\n    def self.test_framework_test_cases\n      TestFrameworkDetection.test_framework_test_cases\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/version.rb",
    "content": "module Shoulda\n  module Context\n    VERSION = \"3.0.0.rc1\".freeze\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context/world.rb",
    "content": "module Shoulda\n  module Context\n    class << self\n      def contexts # :nodoc:\n        @contexts ||= []\n      end\n      attr_writer :contexts\n\n      def current_context # :nodoc:\n        self.contexts.last\n      end\n\n      def add_context(context) # :nodoc:\n        self.contexts.push(context)\n      end\n\n      def remove_context # :nodoc:\n        self.contexts.pop\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "lib/shoulda/context.rb",
    "content": "require \"shoulda/context/autoload_macros\"\nrequire \"shoulda/context/configuration\"\nrequire \"shoulda/context/context\"\nrequire \"shoulda/context/dsl\"\nrequire \"shoulda/context/proc_extensions\"\nrequire \"shoulda/context/test_framework_detection\"\nrequire \"shoulda/context/version\"\nrequire \"shoulda/context/world\"\n\nif defined?(Rails)\n  require \"shoulda/context/railtie\"\nend\n\nShoulda::Context.configure do |config|\n  config.include(Shoulda::Context::DSL)\nend\n"
  },
  {
    "path": "lib/shoulda-context.rb",
    "content": "require \"shoulda/context\"\n"
  },
  {
    "path": "shoulda-context.gemspec",
    "content": "# -*- encoding: utf-8 -*-\n\n$LOAD_PATH << File.join(File.dirname(__FILE__), \"lib\")\nrequire \"shoulda/context/version\"\n\nGem::Specification.new do |s|\n  s.name        = \"shoulda-context\"\n  s.version     = Shoulda::Context::VERSION.dup\n  s.platform    = Gem::Platform::RUBY\n  s.authors     = [\"thoughtbot, inc.\", \"Tammer Saleh\", \"Joe Ferris\",\n                   \"Ryan McGeary\", \"Dan Croak\", \"Matt Jankowski\"]\n  s.email       = \"support@thoughtbot.com\"\n  s.homepage    = \"http://thoughtbot.com/community/\"\n  s.summary     = \"Context framework extracted from Shoulda\"\n  s.description = \"Context framework extracted from Shoulda\"\n  s.license     = \"MIT\"\n\n  s.files            = `git ls-files`.split(\"\\n\")\n  s.test_files       = `git ls-files -- {test,spec,features}/*`.split(\"\\n\")\n  s.executables      = `git ls-files -- exe/*`.split(\"\\n\").map { |f| File.basename(f) }\n  s.bindir           = \"exe\"\n  s.require_paths    = [\"lib\"]\nend\n"
  },
  {
    "path": "tasks/shoulda.rake",
    "content": "load File.join(File.dirname(__FILE__), \"..\", \"lib\", \"shoulda\", \"context\", \"tasks.rb\")\n"
  },
  {
    "path": "test/fake_rails_root/test/shoulda_macros/custom_macro.rb",
    "content": "module CustomMacro\n  def custom_macro\n  end\nend\nPARENT_TEST_CASE.extend(CustomMacro)\n\n"
  },
  {
    "path": "test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb",
    "content": "module GemMacro\n  def gem_macro\n  end\nend\nPARENT_TEST_CASE.extend(GemMacro)\n"
  },
  {
    "path": "test/fake_rails_root/vendor/plugins/.keep",
    "content": ""
  },
  {
    "path": "test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb",
    "content": "module PluginMacro\n  def plugin_macro\n  end\nend\nPARENT_TEST_CASE.extend(PluginMacro)\n"
  },
  {
    "path": "test/shoulda/autoload_macro_test.rb",
    "content": "require 'test_helper'\n\nclass AutoloadMacroTest < PARENT_TEST_CASE\n  context \"The macro auto-loader\" do\n    should \"load macros from the plugins\" do\n      assert self.class.respond_to?('plugin_macro')\n    end\n\n    should \"load macros from the gems\" do\n      assert self.class.respond_to?('gem_macro')\n    end\n\n    should \"load custom macros from ROOT/test/shoulda_macros\" do\n      assert self.class.respond_to?('custom_macro')\n    end\n  end\nend\n\n"
  },
  {
    "path": "test/shoulda/context_test.rb",
    "content": "require 'test_helper'\n\nclass ContextTest < PARENT_TEST_CASE\n  def self.context_macro(&blk)\n    context \"with a subcontext made by a macro\" do\n      setup { @context_macro = :foo }\n\n      merge_block(&blk)\n    end\n  end\n\n  context \"context with setup block\" do\n    setup do\n      @blah = \"blah\"\n    end\n\n    should \"run the setup block\" do\n      assert_equal \"blah\", @blah\n    end\n\n    should \"have name set right\" do\n      assert_match(/^test: context with setup block/, normalized_name)\n    end\n\n    context \"and a subcontext\" do\n      setup do\n        @blah = \"#{@blah} twice\"\n      end\n\n      should \"be named correctly\" do\n        assert_match(/^test: context with setup block and a subcontext should be named correctly/, normalized_name)\n      end\n\n      should \"run the setup blocks in order\" do\n        assert_equal @blah, \"blah twice\"\n      end\n    end\n\n    context_macro do\n      should \"have name set right\" do\n        assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, normalized_name)\n      end\n\n      should \"run the setup block of that context macro\" do\n        assert_equal :foo, @context_macro\n      end\n\n      should \"run the setup block of the main context\" do\n        assert_equal \"blah\", @blah\n      end\n    end\n\n  end\n\n  context \"another context with setup block\" do\n    setup do\n      @blah = \"foo\"\n    end\n\n    should \"have @blah == 'foo'\" do\n      assert_equal \"foo\", @blah\n    end\n\n    should \"have name set right\" do\n      assert_match(/^test: another context with setup block/, normalized_name)\n    end\n  end\n\n  context \"context with method definition\" do\n    setup do\n      def hello; \"hi\"; end\n    end\n\n    should \"be able to read that method\" do\n      assert_equal \"hi\", hello\n    end\n\n    should \"have name set right\" do\n      assert_match(/^test: context with method definition/, normalized_name)\n    end\n  end\n\n  context \"another context\" do\n    should \"not define @blah\" do\n      assert !instance_variable_defined?(:@blah)\n    end\n  end\n\n  context \"context with multiple setups and/or teardowns\" do\n\n    cleanup_count = 0\n\n    2.times do |i|\n      setup { cleanup_count += 1 }\n      teardown { cleanup_count -= 1 }\n    end\n\n    2.times do |i|\n      should \"call all setups and all teardowns (check ##{i + 1})\" do\n        assert_equal 2, cleanup_count\n      end\n    end\n\n    context \"subcontexts\" do\n\n      2.times do |i|\n        setup { cleanup_count += 1 }\n        teardown { cleanup_count -= 1 }\n      end\n\n      2.times do |i|\n        should \"also call all setups and all teardowns in parent and subcontext (check ##{i + 1})\" do\n          assert_equal 4, cleanup_count\n        end\n      end\n\n    end\n\n  end\n\n  should_eventually \"pass, since it's unimplemented\" do\n    flunk \"what?\"\n  end\n\n  should_eventually \"not require a block when using should_eventually\"\n  should \"pass without a block, as that causes it to piggyback to should_eventually\"\n\n  context \"context for testing should piggybacking\" do\n    should \"call should_eventually as we are not passing a block\"\n  end\n\n  context \"context\" do\n    context \"with nested subcontexts\" do\n      should_eventually \"only print this statement once for a should_eventually\"\n    end\n  end\n\n  class ::SomeModel; end\n\n  context \"given a test named after a class\" do\n    setup do\n      self.class.stubs(:name).returns(\"SomeModelTest\")\n    end\n\n    should \"determine the described type\" do\n      assert_equal SomeModel, self.class.described_type\n    end\n\n    should \"return a new instance of the described type as the subject if none exists\" do\n      assert_kind_of SomeModel, subject\n    end\n\n    context \"with an explicit subject block\" do\n      setup { @expected = SomeModel.new }\n      subject { @expected }\n      should \"return the result of the block as the subject\" do\n        assert_equal @expected, subject\n      end\n\n      context \"nested context block without a subject block\" do\n        should \"return the result of the parent context's subject block\" do\n          assert_equal @expected, subject\n        end\n      end\n    end\n  end\n\n  def normalized_name\n    name.sub(\"test_:\", \"test:\")\n  end\nend\n\nclass ::Some\n  class NestedModel; end\nend\n\nclass Some::NestedModelTest < PARENT_TEST_CASE\n  should \"determine the described type for a nested model\" do\n    assert_equal Some::NestedModel, self.class.described_type\n  end\nend\n\nclass Some::SomeTest < PARENT_TEST_CASE\n  should \"not fallback to higher-level constants with same name\" do\n    assert_raises(NameError) do\n      assert_equal nil, self.class.described_type\n    end\n  end\nend\n\nclass ShouldMatcherTest < PARENT_TEST_CASE\n  class FakeMatcher\n    attr_reader :subject\n    attr_accessor :fail\n\n    def description\n      \"be a fake matcher\"\n    end\n\n    def matches?(subject)\n      @subject = subject\n      !@fail\n    end\n\n    def failure_message\n      \"positive failure message\"\n    end\n\n    def failure_message_when_negated\n      \"negative failure message\"\n    end\n  end\n\n  def setup\n    @matcher = FakeMatcher.new\n  end\n\n  def assert_failed_with(message, test_suite)\n    assert_equal [message], test_suite.failure_messages\n  end\n\n  def assert_passed(test_suite)\n    assert_equal [], test_suite.failure_messages\n  end\n\n  def assert_test_named(expected_name, test_suite)\n    name = test_suite.test_names.first\n    assert(\n      name.include?(expected_name),\n      \"Expected #{name} to include #{expected_name}\"\n    )\n  end\n\n  def self.should_use_positive_matcher\n    should \"generate a test using the matcher's description\" do\n      assert_test_named \"should #{@matcher.description}\", @test_suite\n    end\n\n    should \"pass with a passing matcher\" do\n      @matcher.fail = false\n      @test_suite.run\n      assert_passed @test_suite\n    end\n\n    should \"fail with a failing matcher\" do\n      @matcher.fail = true\n      @test_suite.run\n      assert_failed_with \"positive failure message\", @test_suite\n    end\n\n    should \"provide the subject\" do\n      @matcher.fail = false\n      @test_suite.run\n      assert_equal 'a subject', @matcher.subject\n    end\n  end\n\n  def self.should_use_negative_matcher\n    should \"generate a test using the matcher's description\" do\n      assert_test_named \"should not #{@matcher.description}\", @test_suite\n    end\n\n    should \"pass with a failing matcher\" do\n      @matcher.fail = true\n      @test_suite.run\n      assert_passed @test_suite\n    end\n\n    should \"fail with a passing matcher\" do\n      @matcher.fail = false\n      @test_suite.run\n      assert_failed_with \"negative failure message\", @test_suite\n    end\n\n    should \"provide the subject\" do\n      @matcher.fail = false\n      @test_suite.run\n      assert_equal 'a subject', @matcher.subject\n    end\n  end\n\n  context \"a should block with a matcher\" do\n    setup do\n      matcher = @matcher\n      @test_suite = TestSuite.create do\n        subject { 'a subject' }\n        should matcher\n      end\n    end\n\n    should_use_positive_matcher\n  end\n\n  context \"a should block with a matcher within a context\" do\n    setup do\n      matcher = @matcher\n      @test_suite = TestSuite.create do\n        context \"in context\" do\n          subject { 'a subject' }\n          should matcher\n        end\n      end\n    end\n\n    should_use_positive_matcher\n  end\n\n  context \"a should_not block with a matcher\" do\n    setup do\n      matcher = @matcher\n      @test_suite = TestSuite.create do\n        subject { 'a subject' }\n        should_not matcher\n      end\n    end\n\n    should_use_negative_matcher\n  end\n\n  context \"a should_not block with a matcher within a context\" do\n    setup do\n      matcher = @matcher\n      @test_suite = TestSuite.create do\n        context \"in context\" do\n          subject { 'a subject' }\n          should_not matcher\n        end\n      end\n    end\n\n    should_use_negative_matcher\n  end\n\n  class TestSuite\n    def self.create(&definition)\n      if defined?(Test::Unit)\n        TestUnitSuite.new(&definition)\n      else\n        MinitestSuite.new(&definition)\n      end\n    end\n  end\n\n  class TestUnitSuite\n    def initialize(&definition)\n      @suite = Class.new(Test::Unit::TestCase, &definition).suite\n      @result = Test::Unit::TestResult.new\n    end\n\n    def run\n      @suite.run(@result) do |event, name|\n        # do nothing\n      end\n    end\n\n    def failure_messages\n      @result.failures.map(&:message)\n    end\n\n    def test_names\n      @suite.tests.map(&:method_name)\n    end\n  end\n\n  class MinitestSuite\n    def initialize(&definition)\n      @test_case_class = Class.new(Minitest::Test, &definition)\n      @reporter = Minitest::StatisticsReporter.new(StringIO.new)\n    end\n\n    def run\n      @test_case_class.run(@reporter)\n    end\n\n    def failure_messages\n      @reporter.results.flat_map(&:failures).map(&:message)\n    end\n\n    def test_names\n      @test_case_class.runnable_methods\n    end\n  end\nend\n\nclass Subject; end\n\nclass SubjectTest < PARENT_TEST_CASE\n\n  def setup\n    @expected = Subject.new\n  end\n\n  subject { @expected }\n\n  should \"return a specified subject\" do\n    assert_equal @expected, subject\n  end\nend\n\nclass SubjectLazinessTest < PARENT_TEST_CASE\n  subject { Subject.new }\n\n  should \"only build the subject once\" do\n    assert_equal subject, subject\n  end\nend\n"
  },
  {
    "path": "test/shoulda/convert_to_should_syntax_test.rb",
    "content": "require 'test_helper'\n\nclass ConvertToShouldSyntaxTest < PARENT_TEST_CASE\n  BEFORE_FIXTURE = <<-EOS\n    class DummyTest < #{PARENT_TEST_CASE}\n\n      should \"Not change this_word_with_underscores\" do\n      end\n\n      def test_should_be_working\n        assert true\n      end\n\n      def test_some_cool_stuff\n        assert true\n      end\n\n      def non_test_method\n      end\n\n    end\n  EOS\n\n  AFTER_FIXTURE = <<-EOS\n    class DummyTest < #{PARENT_TEST_CASE}\n\n      should \"Not change this_word_with_underscores\" do\n      end\n\n      should \"be working\" do\n        assert true\n      end\n\n      should \"RENAME ME: test some cool stuff\" do\n        assert true\n      end\n\n      def non_test_method\n      end\n\n    end\n  EOS\n\n  FIXTURE_PATH = \"./convert_to_should_syntax_fixture.dat\"\n\n  RUBY = ENV['RUBY'] || 'ruby'\n\n  def test_convert_to_should_syntax\n    File.open(FIXTURE_PATH, \"w\") {|f| f.write(BEFORE_FIXTURE)}\n    cmd = \"#{RUBY} #{File.join(File.dirname(__FILE__), '../../exe/convert_to_should_syntax')} #{FIXTURE_PATH}\"\n    output = `#{cmd}`\n    File.unlink($1) if output.match(/has been stored in '([^']+)/)\n    assert_match(/has been converted/, output)\n    result = IO.read(FIXTURE_PATH)\n    assert_equal result, AFTER_FIXTURE\n  end\n\n  def teardown\n    File.unlink(FIXTURE_PATH)\n  end\nend\n"
  },
  {
    "path": "test/shoulda/helpers_test.rb",
    "content": "require 'test_helper'\n\nclass HelpersTest < PARENT_TEST_CASE\n  context \"an array of values\" do\n    setup do\n      @a = ['abc', 'def', 3]\n    end\n\n    [/b/, 'abc', 3].each do |x|\n      should \"contain #{x.inspect}\" do\n        assert_raises(ASSERTION_CLASS) do\n          assert_does_not_contain @a, x\n        end\n        assert_contains @a, x\n      end\n    end\n\n    should \"not contain 'wtf'\" do\n      assert_raises(ASSERTION_CLASS) {assert_contains @a, 'wtf'}\n      assert_does_not_contain @a, 'wtf'\n    end\n\n    should \"be the same as another array, ordered differently\" do\n      assert_same_elements(@a, [3, \"def\", \"abc\"])\n      assert_raises(ASSERTION_CLASS) do\n        assert_same_elements(@a, [3, 3, \"def\", \"abc\"])\n      end\n      assert_same_elements([@a, \"abc\"].flatten, [\"abc\", 3, \"def\", \"abc\"])\n      assert_raises(ASSERTION_CLASS) do\n        assert_same_elements([@a, \"abc\"].flatten, [3, 3, \"def\", \"abc\"])\n      end\n    end\n\n    should \"only count the number of occurrences once for each unique value\" do\n      a1 = [@a, \"abc\"].flatten\n      a1.expects(:select).times(3).returns([\"abc\", \"abc\"], [\"def\"], [3])\n      assert_same_elements(a1, [\"abc\", 3, \"def\", \"abc\"])\n    end\n  end\n\n  context \"a matching matcher\" do\n    setup do\n      @matcher = stub(\n        \"matcher\",\n        matches?: true,\n        failure_message: \"bad failure message\",\n        failure_message_when_negated: \"big time failure\"\n      )\n    end\n\n    should \"pass when given to assert_accepts with no message expectation\" do\n      assert_accepts @matcher, 'target'\n    end\n\n    should \"pass when given to assert_accepts with a matching message\" do\n      assert_accepts @matcher, 'target', :message => /big time/\n    end\n\n    should \"fail when given to assert_accepts with non-matching message\" do\n      assert_raises ASSERTION_CLASS do\n        assert_accepts @matcher, 'target', :message => /small time/\n      end\n    end\n\n    context \"when given to assert_rejects\" do\n      context \"and matcher has :does_not_match?\" do\n        setup do\n          @error = nil\n          begin\n            @matcher.stubs(:matches?).returns(false)\n            @matcher.stubs(:does_not_match?).returns(true)\n            assert_rejects @matcher, 'target'\n          rescue ASSERTION_CLASS => @error\n          end\n        end\n\n        should \"pass\" do\n          assert_nil @error\n        end\n      end\n\n      context \"and matcher does not have :does_not_match?\" do\n        setup do\n          @error = nil\n          begin\n            assert_rejects @matcher, 'target'\n          rescue ASSERTION_CLASS => @error\n          end\n        end\n\n        should \"fail\" do\n          refute_nil @error\n        end\n\n        should \"use the error message from the matcher\" do\n          assert_equal 'big time failure', @error.message\n        end\n      end\n    end\n  end\n\n  context \"a non-matching matcher\" do\n    setup do\n      @matcher = stub(\n        \"matcher\",\n        matches?: false,\n        failure_message: \"big time failure\",\n        failure_message_when_negated: \"bad failure message\"\n      )\n    end\n\n    should \"pass when given to assert_rejects with no message expectation\" do\n      assert_rejects @matcher, 'target'\n    end\n\n    should \"pass when given to assert_rejects with a matching message\" do\n      assert_rejects @matcher, 'target', :message => /big time/\n    end\n\n    should \"fail when given to assert_rejects with a non-matching message\" do\n      assert_raises ASSERTION_CLASS do\n        assert_rejects @matcher, 'target', :message => /small time/\n      end\n    end\n\n    context \"when given to assert_accepts\" do\n      setup do\n        assert_accepts @matcher, 'target'\n      rescue ASSERTION_CLASS => @error\n      end\n\n      should \"fail\" do\n        refute_nil @error\n      end\n\n      should \"use the error message from the matcher\" do\n        assert_equal 'big time failure', @error.message\n      end\n    end\n  end\n\n  should \"assign context to a support matching on assert_accepts\" do\n    matcher = stub('matcher', :matches? => true)\n    matcher.expects(:in_context).with(self)\n    assert_accepts matcher, nil\n  end\n\n  should \"assign context to a support matching on assert_rejects\" do\n    matcher = stub('matcher', :matches? => false)\n    matcher.expects(:in_context).with(self)\n    assert_rejects matcher, nil\n  end\nend\n"
  },
  {
    "path": "test/shoulda/railtie_test.rb",
    "content": "require \"test_helper\"\n\nclass RailtieTest < PARENT_TEST_CASE\n  context \"A Rails application with shoulda-context added to it\" do\n    setup do\n      app.create\n    end\n\n    should \"load files in vendor/gems and vendor/plugins when booted\" do\n      app.create_gem_with_macro(\n        module_name: \"MacrosFromVendor\",\n        location: \"vendor/gems/vendored_gem_with_macro\",\n        macro_name: \"macro_from_vendored_gem\"\n      )\n      app.create_gem_with_macro(\n        module_name: \"MacrosFromPlugin\",\n        location: \"vendor/plugins/plugin_gem_with_macro\",\n        macro_name: \"macro_from_plugin_gem\"\n      )\n      app.create_gem_with_macro(\n        module_name: \"MacrosFromTest\",\n        location: \"test\",\n        macro_name: \"macro_from_test\"\n      )\n      app.write_file(\"test/macros_test.rb\", <<~RUBY)\n        ENV[\"RAILS_ENV\"] = \"test\"\n        require_relative \"../config/environment\"\n\n        class MacrosTest < #{PARENT_TEST_CASE}\n          macro_from_vendored_gem\n          macro_from_plugin_gem\n          macro_from_test\n        end\n      RUBY\n\n      app.run_n_unit_test_suite\n    end\n  end\n\n  def app\n    @_app ||= RailsApplicationWithShouldaContext.new\n  end\nend\n"
  },
  {
    "path": "test/shoulda/rerun_snippet_test.rb",
    "content": "require \"test_helper\"\n\nclass RerunSnippetTest < PARENT_TEST_CASE\n  context \"A Rails application with shoulda-context added to it\" do\n    should \"display the correct rerun snippet when a test fails\" do\n      if app.rails_version >= 5 && TEST_FRAMEWORK == \"minitest\"\n        app.create\n\n        app.write_file(\"test/models/failing_test.rb\", <<~RUBY)\n          ENV[\"RAILS_ENV\"] = \"test\"\n          require_relative \"../../config/environment\"\n\n          class FailingTest < #{PARENT_TEST_CASE}\n            class FakeMatcher\n              attr_reader :subject\n              attr_accessor :fail\n\n              def description\n                \"be a fake matcher\"\n              end\n\n              def matches?(subject)\n                @subject = subject\n                !@fail\n              end\n\n              def failure_message\n                \"positive failure message\"\n              end\n\n              def failure_message_when_negated\n                \"negative failure message\"\n              end\n            end\n\n            should \"fail\" do\n              assert false\n            end\n\n            should_not FakeMatcher.new.tap { |m| m.fail = false }\n            should FakeMatcher.new.tap { |m| m.fail = true }\n          end\n        RUBY\n\n        command_runner = app.run_n_unit_test_suite\n\n        expected_executable = rails_version >= 6 ? \"rails test\" : \"bin/rails test\"\n\n        assert_includes(command_runner.output, \"#{expected_executable} test/models/failing_test.rb:27\")\n        assert_includes(command_runner.output, \"#{expected_executable} test/models/failing_test.rb:31\")\n        assert_includes(command_runner.output, \"#{expected_executable} test/models/failing_test.rb:32\")\n      end\n    end\n  end\n\n  def app\n    @_app ||= RailsApplicationWithShouldaContext.new\n  end\n\n  def rails_version\n    # TODO: Update snowglobe so that we don't have to do this\n    app.send(:bundle).version_of(\"rails\")\n  end\nend\n"
  },
  {
    "path": "test/shoulda/should_test.rb",
    "content": "require 'test_helper'\n\nclass ShouldTest < PARENT_TEST_CASE\n  should \"be able to define a should statement outside of a context\" do\n    assert true\n  end\n\n  should \"see the name of my class as ShouldTest\" do\n    assert_equal \"ShouldTest\", self.class.name\n  end\n\n  def self.should_see_class_methods\n    should \"be able to see class methods\" do\n      assert true\n    end\n  end\n\n  def self.should_be_able_to_setup_a_should_eventually_in_a_class_method\n    should \"be able to setup a should eventually in a class method\"\n  end\n\n  def self.should_see_a_context_block_like_a_test_case_class\n    should \"see a context block as a Test::Unit class\" do\n      assert_equal \"ShouldTest\", self.class.name\n    end\n  end\n\n  def self.should_see_blah\n    should \"see @blah through a macro\" do\n      assert @blah\n    end\n  end\n\n  def self.should_not_see_blah\n    should \"not see @blah through a macro\" do\n      assert !instance_variable_defined?(:@blah)\n    end\n  end\n\n  def self.should_be_able_to_make_context_macros(prefix = nil)\n    context \"a macro\" do\n      should \"have the tests named correctly\" do\n        assert_match(\n          Regexp.new(\n            \"^\" +\n            build_expected_test_name(\n              \"#{prefix}a macro should have the tests named correctly\"\n            )\n          ),\n          test_name\n        )\n      end\n    end\n  end\n\n  context \"Context\" do\n    should_see_class_methods\n    should_see_a_context_block_like_a_test_case_class\n    should_be_able_to_make_context_macros(\"Context \")\n    should_be_able_to_setup_a_should_eventually_in_a_class_method\n\n    should \"not define @blah\" do\n      assert ! self.instance_variables.include?(\"@blah\")\n    end\n\n    should_not_see_blah\n\n    should \"be able to define a should statement\" do\n      assert true\n    end\n\n    should \"see the name of my class as ShouldTest\" do\n      assert_equal \"ShouldTest\", self.class.name\n    end\n\n    context \"with a subcontext\" do\n      should_be_able_to_make_context_macros(\"Context with a subcontext \")\n    end\n  end\n\n  context \"Context with setup block\" do\n    setup do\n      @blah = \"blah\"\n    end\n\n    should \"have @blah == 'blah'\" do\n      assert_equal \"blah\", @blah\n    end\n    should_see_blah\n\n    should \"have name set right\" do\n      assert_match(\n        Regexp.new(\n          \"^\" +\n          build_expected_test_name(\"Context with setup block\")\n        ),\n        test_name\n      )\n    end\n\n    context \"and a subcontext\" do\n      setup do\n        @blah = \"#{@blah} twice\"\n      end\n\n      should \"be named correctly\" do\n        assert_match(\n          Regexp.new(\n            \"^\" +\n            build_expected_test_name(\n              \"Context with setup block and a subcontext should be named correctly\"\n            )\n          ),\n          test_name\n        )\n      end\n\n      should \"run the setup methods in order\" do\n        assert_equal @blah, \"blah twice\"\n      end\n      should_see_blah\n    end\n  end\n\n  context \"Another context with setup block\" do\n    setup do\n      @blah = \"foo\"\n    end\n\n    should \"have @blah == 'foo'\" do\n      assert_equal \"foo\", @blah\n    end\n\n    should \"have name set right\" do\n      assert_match(\n        Regexp.new(\n          \"^\" +\n          build_expected_test_name(\"Another context with setup block\")\n        ),\n        test_name\n      )\n    end\n    should_see_blah\n  end\n\n  should_eventually \"pass, since it's a should_eventually\" do\n    flunk \"what?\"\n  end\n\n  # Context creation and naming\n\n  def test_should_create_a_new_context\n    assert_nothing_raised do\n      Shoulda::Context::Context.new(\"context name\", self.class) do; end\n    end\n  end\n\n  def test_should_create_a_new_context_even_if_block_is_omitted\n    old_verbose, $VERBOSE = $VERBOSE, nil\n    assert_nothing_raised do\n      Shoulda::Context::Context.new(\"context without a block\", self.class)\n    end\n  ensure\n    $VERBOSE = old_verbose\n  end\n\n  def test_should_create_a_nested_context\n    assert_nothing_raised do\n      parent = Shoulda::Context::Context.new(\"Parent\", self.class) do; end\n      child  = Shoulda::Context::Context.new(\"Child\", parent) do; end\n      raise unless child.instance_of? Shoulda::Context::Context\n    end\n  end\n\n  def test_should_name_a_contexts_correctly\n    parent     = Shoulda::Context::Context.new(\"Parent\", self.class) do; end\n    child      = Shoulda::Context::Context.new(\"Child\", parent) do; end\n    grandchild = Shoulda::Context::Context.new(\"GrandChild\", child) do; end\n\n    assert_equal \"Parent\", parent.full_name\n    assert_equal \"Parent Child\", child.full_name\n    assert_equal \"Parent Child GrandChild\", grandchild.full_name\n  end\n\n  def test_should_raise_on_duplicate_naming\n    context = Shoulda::Context::Context.new(\"DupContext\", self.class) do\n      should \"dup\" do; end\n      should \"dup\" do; end\n    end\n    assert_raises Shoulda::Context::DuplicateTestError do\n      context.build\n    end\n  end\n\n  # Should statements\n\n  def test_should_have_should_hashes_when_given_should_statements\n    context = Shoulda::Context::Context.new(\"name\", self.class) do\n      should \"be good\" do; end\n      should \"another\" do; end\n    end\n\n    names = context.shoulds.map {|s| s[:name]}\n    assert_equal [\"another\", \"be good\"], names.sort\n  end\n\n  # setup and teardown\n\n  def test_should_capture_setup_and_teardown_blocks\n    context = Shoulda::Context::Context.new(\"name\", self.class) do\n      setup    do; \"setup\";    end\n      teardown do; \"teardown\"; end\n    end\n\n    assert_equal \"setup\",    context.setup_blocks.first.call\n    assert_equal \"teardown\", context.teardown_blocks.first.call\n  end\n\n  # building\n\n  def test_should_create_shoulda_test_for_each_should_on_build\n    context = Shoulda::Context::Context.new(\"name\", self.class) do\n      should \"one\" do; end\n      should \"two\" do; end\n    end\n    context.expects(:create_test_from_should_hash).with(has_entry(:name => \"one\"))\n    context.expects(:create_test_from_should_hash).with(has_entry(:name => \"two\"))\n    context.build\n  end\n\n  def test_should_create_test_methods_on_build\n    tu_class = self.class\n    context = Shoulda::Context::Context.new(\"A Context\", tu_class) do\n      should \"define the test\" do; end\n    end\n\n    tu_class.\n      expects(:define_method).\n      with(\n        build_expected_test_name(\"A Context should define the test. \").to_sym\n      )\n    context.build\n  end\n\n  def test_should_create_test_methods_on_build_when_subcontext\n    tu_class = self.class\n    context = Shoulda::Context::Context.new(\"A Context\", tu_class) do\n      context \"with a child\" do\n        should \"define the test\" do; end\n      end\n    end\n\n    tu_class.\n      expects(:define_method).\n      with(\n        build_expected_test_name(\n          \"A Context with a child should define the test. \"\n        ).to_sym\n      )\n    context.build\n  end\n\n  # Test::Unit integration\n\n  def test_should_create_a_new_context_and_build_it_on_test_case_context\n    c = mock(\"context\")\n    c.expects(:build)\n    Shoulda::Context::Context.expects(:new).with(\"foo\", kind_of(Class)).returns(c)\n    self.class.context \"foo\" do; end\n  end\n\n  def test_should_create_a_one_off_context_and_build_it_on_test_case_should\n    s = mock(\"test\")\n    Shoulda::Context::Context.any_instance.expects(:should).with(\"rock\", {}, [__FILE__, __LINE__ + 2]).returns(s)\n    Shoulda::Context::Context.any_instance.expects(:build)\n    self.class.should \"rock\" do; end\n  end\n\n  def test_should_create_a_one_off_context_and_build_it_on_test_case_should_eventually\n    s = mock(\"test\")\n    Shoulda::Context::Context.any_instance.expects(:should_eventually).with(\"rock\").returns(s)\n    Shoulda::Context::Context.any_instance.expects(:build)\n    self.class.should_eventually \"rock\" do; end\n  end\n\n  should \"run a :before proc\", :before => lambda { @value = \"before\" } do\n    assert_equal \"before\", @value\n  end\n\n  context \"A :before proc\" do\n    setup do\n      assert_equal \"before\", @value\n      @value = \"setup\"\n    end\n\n    should \"run before the current setup\", :before => lambda { @value = \"before\" } do\n      assert_equal \"setup\", @value\n    end\n  end\n\n  context \"a before statement\" do\n    setup do\n      assert_equal \"before\", @value\n      @value = \"setup\"\n    end\n\n    before_should \"run before the current setup\" do\n      @value = \"before\"\n    end\n  end\n\n  context \"A context\" do\n    setup do\n      @value = \"outer\"\n    end\n\n    context \"with a subcontext and a :before proc\" do\n      before = lambda do\n        assert \"outer\", @value\n        @value = \"before\"\n      end\n      should \"run after the parent setup\", :before => before do\n        assert_equal \"before\", @value\n      end\n    end\n  end\n\n  def test_name\n    name\n  end\n\n  def build_expected_test_name(value)\n    if TEST_FRAMEWORK == \"minitest\"\n      if value.is_a?(Regexp)\n        Regexp.new(\"^test_: #{value.source}\")\n      else\n        \"test_: #{value}\"\n      end\n    elsif value.is_a?(Regexp)\n      Regexp.new(\"^test: #{value.source}\")\n    else\n      \"test: #{value}\"\n    end\n  end\n\n  # Minitest removed assert_nothing_raised a while back;\n  # see here: <http://www.zenspider.com/ruby/2012/01/assert_nothing_tested.html>\n  def assert_nothing_raised\n    yield\n  end\nend\n\nclass RedTestarossaDriver; end\n\nclass RedTestarossaDriverTest < PARENT_TEST_CASE\n  class DummyMatcher\n    def description\n      \"fail to construct the proper test name with a 'should_not'\"\n    end\n\n    def matches?(*)\n      false\n    end\n\n    def failure_message_when_negated\n      \"dummy failure message\"\n    end\n  end\n\n  should \"call Shoulda::Context::Context.new using the correct context name\" do\n    assert_equal \"RedTestarossaDriver\", @shoulda_context.name\n  end\n\n  should \"see the name of the test case class as RedTestarossaDriverTest\" do\n    assert_equal \"RedTestarossaDriverTest\", self.class.name\n  end\n\n  should \"include the correct context name in the full name of the test\" do\n    assert_match(\n      build_expected_test_name(/RedTestarossaDriver/),\n      test_name\n    )\n  end\n\n  def test_should_property_construct_test_name_for_should_eventually\n    context = Shoulda::Context::Context.new(\"whatever\", self.class) do\n      \"this is just a placeholder\"\n    end\n\n    Shoulda::Context::Context.\n      expects(:new).\n      with(\"RedTestarossaDriver\", RedTestarossaDriverTest).\n      returns(context)\n\n    self.class.should_eventually(\"do something\") {}\n  end\n\n  def test_should_property_construct_test_name_for_should_not\n    context = Shoulda::Context::Context.new(\"whatever\", self.class) do\n      \"this is just a placeholder\"\n    end\n\n    Shoulda::Context::Context.\n      expects(:new).\n      with(\"RedTestarossaDriver\", RedTestarossaDriverTest).\n      returns(context)\n\n    self.class.should_not(DummyMatcher.new)\n  end\n\n  private\n\n  def test_name\n    name\n  end\n\n  def build_expected_test_name(value)\n    if TEST_FRAMEWORK == \"minitest\"\n      if value.is_a?(Regexp)\n        Regexp.new(\"^test_: #{value.source}\")\n      else\n        \"test_: #{value}\"\n      end\n    elsif value.is_a?(Regexp)\n      Regexp.new(\"^test: #{value.source}\")\n    else\n      \"test: #{value}\"\n    end\n  end\nend\n"
  },
  {
    "path": "test/shoulda/test_framework_detection_test.rb",
    "content": "require \"test_helper\"\nrequire \"tempfile\"\n\nclass TestFrameworkDetectionTest < PARENT_TEST_CASE\n  if TEST_FRAMEWORK == \"minitest\"\n    should \"detect Minitest 5.x when it is loaded standalone\" do\n      assert_integration_with \"Minitest::Test\", setup: <<-RUBY\n        require \"minitest/autorun\"\n      RUBY\n    end\n  end\n\n  if TEST_FRAMEWORK == \"test_unit\"\n    should \"detect the test-unit gem when it is loaded standalone\" do\n      assert_integration_with \"Test::Unit::TestCase\",\n        setup: <<-RUBY\n          require \"test/unit\"\n        RUBY\n    end\n  end\n\n  def assert_integration_with_rails_and(*test_cases)\n    test_cases = [\"ActiveSupport::TestCase\"] | test_cases\n    options = test_cases.last.is_a?(Hash) ? test_cases.pop : {}\n    options[:setup] = <<-RUBY\n      require \"rails/all\"\n      require \"rails/test_help\"\n      ActiveRecord::Base.establish_connection(\n        adapter: \"sqlite3\",\n        database: \":memory:\"\n      )\n    RUBY\n    args = test_cases + [options]\n\n    assert_integration_with(*args)\n  end\n\n  def assert_integration_with(*test_cases)\n    assert_test_cases_are_detected(*test_cases)\n    assert_our_api_is_available_in_test_cases(*test_cases)\n  end\n\n  def assert_test_cases_are_detected(*expected_test_cases)\n    options = expected_test_cases.last.is_a?(Hash) ? expected_test_cases.pop : {}\n    setup = options[:setup] || \"\"\n    output = execute(file_that_detects_test_framework_test_cases([setup]))\n    actual_test_cases = output.split(\"\\n\").first.split(\", \")\n    assert_equal expected_test_cases, actual_test_cases\n  end\n\n  def file_that_detects_test_framework_test_cases(mixins)\n    <<-RUBY\n      #{require_gems(mixins)}\n      require \"yaml\"\n      test_cases =\n      Shoulda::Context.test_framework_test_cases.map do |test_case|\n        test_case.to_s\n      end\n      puts test_cases.join(', ')\n    RUBY\n  end\n\n  def require_gems(mixins)\n    <<-RUBY\n      ENV[\"BUNDLE_GEMFILE\"] =\n        \"#{PROJECT_DIR}/gemfiles/\" +\n        \"#{Tests::CurrentBundle.instance.current_appraisal}.gemfile\"\n      require \"bundler\"\n      Bundler.setup\n      #{mixins.join(\"\\n\")}\n      require \"shoulda-context\"\n    RUBY\n  end\n\n  def assert_our_api_is_available_in_test_cases(*test_cases)\n    options = test_cases.last.is_a?(Hash) ? test_cases.pop : {}\n    setup = options[:setup] || \"\"\n\n    test_cases.each do |test_case|\n      output = execute(\n        file_that_runs_a_test_within_test_case(test_case, [setup])\n      )\n      assert_match(/1 (tests|runs)/, output)\n      assert_match(/1 assertions/, output)\n      assert_match(/0 failures/, output)\n      assert_match(/0 errors/, output)\n    end\n  end\n\n  def file_that_runs_a_test_within_test_case(test_case, mixins)\n    <<-RUBY\n      #{require_gems(mixins)}\n\n      class FrameworkIntegrationTest < #{test_case}\n        context \"a context\" do\n          should \"have a test\" do\n            assert_equal true, true\n          end\n        end\n      end\n    RUBY\n  end\n\n  def execute(code)\n    tempfile = Tempfile.new(\"shoulda-context-test\")\n    tempfile.write(code)\n    tempfile.close\n\n    if ENV[\"DEBUG\"]\n      puts \"Code:\"\n      puts code\n    end\n\n    output = `RUBYOPT=\"\" ruby #{tempfile.path} 2>/dev/null`\n\n    if ENV[\"DEBUG\"]\n      puts \"Output:\"\n      puts output\n    end\n\n    output\n  end\nend\n"
  },
  {
    "path": "test/support/current_bundle.rb",
    "content": "require \"bundler\"\nrequire \"appraisal\"\n\nmodule Tests\n  class CurrentBundle\n    AppraisalNotSpecified = Class.new(ArgumentError)\n\n    include Singleton\n\n    def assert_appraisal!\n      unless appraisal_in_use?\n        message = <<MSG\n\n\nPlease run tests starting with `appraisal <appraisal_name>`.\nPossible appraisals are: #{available_appraisals}\n\nMSG\n        raise AppraisalNotSpecified, message\n      end\n    end\n\n    def appraisal_in_use?\n      path.dirname == root.join(\"gemfiles\")\n    end\n\n    def current_or_latest_appraisal\n      current_appraisal || latest_appraisal\n    end\n\n    def latest_appraisal\n      available_appraisals.max\n    end\n\n    def current_appraisal\n      if appraisal_in_use?\n        File.basename(path, \".gemfile\")\n      end\n    end\n\n    private\n\n    def available_appraisals\n      appraisals = []\n\n      Appraisal::AppraisalFile.each do |appraisal|\n        appraisals << appraisal.name\n      end\n\n      appraisals\n    end\n\n    def path\n      Bundler.default_gemfile\n    end\n\n    def root\n      Pathname.new(\"../../..\").expand_path(__FILE__)\n    end\n  end\nend\n"
  },
  {
    "path": "test/support/rails_application_with_shoulda_context.rb",
    "content": "require_relative \"snowglobe\"\n\nclass RailsApplicationWithShouldaContext < Snowglobe::RailsApplication\n  ROOT_DIRECTORY = Pathname.new(\"../../..\").expand_path(__FILE__)\n\n  def create\n    super\n\n    bundle.updating do\n      bundle.add_gem(test_framework_gem_name, group: :test)\n      bundle.add_gem(\"shoulda-context\", path: ROOT_DIRECTORY, group: :test)\n    end\n  end\n\n  def test_framework_require_path\n    if TEST_FRAMEWORK == \"test_unit\"\n      \"test-unit\"\n    else\n      \"minitest/autorun\"\n    end\n  end\n\n  def create_gem_with_macro(module_name:, location:, macro_name:)\n    fs.write_file(\"#{location}/shoulda_macros/macros.rb\", <<~FILE)\n      module #{module_name}\n        def #{macro_name}\n          puts \"#{macro_name} is available\"\n        end\n      end\n\n      Shoulda::Context.configure do |config|\n        config.extend(#{module_name})\n      end\n    FILE\n  end\n\n  private\n\n  def test_framework_gem_name\n    if TEST_FRAMEWORK == \"test_unit\"\n      \"test-unit\"\n    else\n      \"minitest\"\n    end\n  end\nend\n"
  },
  {
    "path": "test/support/snowglobe.rb",
    "content": "require \"snowglobe\"\n\nSnowglobe.configure do |config|\n  config.project_name = \"shoulda-context\"\nend\n"
  },
  {
    "path": "test/test_helper.rb",
    "content": "require_relative \"support/current_bundle\"\n\nTests::CurrentBundle.instance.assert_appraisal!\n\n#---\n\nrequire \"pry-byebug\"\nrequire \"warnings_logger\"\n\nTEST_FRAMEWORK = ENV.fetch(\"TEST_FRAMEWORK\", \"minitest\")\n\nif TEST_FRAMEWORK == \"test_unit\"\n  require \"test-unit\"\n  require \"mocha/test_unit\"\nelse\n  require \"minitest/autorun\"\n  require \"mocha/minitest\"\nend\n\nPROJECT_DIR = File.expand_path(\"../..\", __FILE__)\nPARENT_TEST_CASE =\n  if TEST_FRAMEWORK == \"test_unit\"\n    Test::Unit::TestCase\n  else\n    Minitest::Test\n  end\nASSERTION_CLASS =\n  if TEST_FRAMEWORK == \"test_unit\"\n    Test::Unit::AssertionFailedError\n  else\n    Minitest::Assertion\n  end\n\nWarningsLogger::Spy.call(\n  project_name: \"shoulda-context\",\n  project_directory: Pathname.new(\"../..\").expand_path(__FILE__)\n)\n\nrequire_relative \"support/rails_application_with_shoulda_context\"\n\nrequire_relative \"../lib/shoulda/context\"\n\nShoulda.autoload_macros(\n  File.join(File.dirname(__FILE__), \"fake_rails_root\"),\n  File.join(\"vendor\", \"{plugins,gems}\", \"*\")\n)\n\n$VERBOSE = true\n"
  }
]