diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..876bef3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,213 @@ +--- + +version: 2.1 + +defaults: &defaults + working_directory: ~/ruby-rspec-mock + docker: + - image: cimg/ruby:<< parameters.ruby-version >> + +orbs: + ruby: circleci/ruby@2.2.1 + +references: + bundle_install: &bundle_install + run: + name: Installing gems + command: | + bundle config set --local path '~/vendor/bundle' + bundle install + + install_linters: &install_linters + run: + name: Installing bunch of linters + command: | + curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash + sudo apt-get update -y + sudo apt-get install -y lefthook shellcheck yamllint + npm install --prefix='~/.local' --global --save-dev git+https://github.com/streetsidesoftware/cspell-cli markdownlint-cli + cp .circleci/linter_configs/.fasterer.yml .fasterer.yml + cp .circleci/linter_configs/.lefthook.yml lefthook.yml + + install_codeclimate_reporter: &install_codeclimate_reporter + run: + name: Installing CodeClimate test reporter + command: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + + use_latest_bundler: &use_latest_bundler + run: + name: Using latest bundler + command: gem install bundler + + use_latest_gemspec: &use_latest_gemspec + run: + name: Using latest gemspec + command: cp .circleci/gemspecs/latest rspec-mock.gemspec + + use_compatible_gemspec: &use_compatible_gemspec + run: + name: Using compatible gemspec + command: cp .circleci/gemspecs/compatible rspec-mock.gemspec + +jobs: + linters-ruby: + parameters: + ruby-version: + type: string + + <<: *defaults + + steps: + - checkout + + - <<: *use_latest_bundler + - <<: *use_latest_gemspec + - <<: *bundle_install + - <<: *install_linters + + - run: + name: Running commit linters + command: lefthook run commit-linters + + - run: + name: Running code style linters + command: lefthook run code-style-linters + + - run: + name: Running code performance linters + command: lefthook run code-performance-linters + + - run: + name: Running code vulnerability linters + command: lefthook run code-vulnerability-linters + + - run: + name: Running code documentation linters + command: lefthook run code-documentation-linters + + - run: + name: Running release linters + command: lefthook run release-linters + + tests-ruby: + parameters: + ruby-version: + type: string + + <<: *defaults + + steps: + - checkout + + - <<: *use_latest_bundler + - <<: *use_latest_gemspec + - <<: *bundle_install + - <<: *install_codeclimate_reporter + + - run: + name: Running RSpec + command: | + ./cc-test-reporter before-build + bundle exec rspec + + # - run: + # name: Creating CodeClimate test coverage report + # command: | + # ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json" + + - store_artifacts: + name: Saving Simplecov coverage artifacts + path: ~/ruby-rspec-mock/coverage + destination: coverage + + # - deploy: + # name: Uploading CodeClimate test coverage report + # command: | + # ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input - + + compatibility-ruby: + parameters: + ruby-version: + type: string + + <<: *defaults + + steps: + - checkout + + - <<: *use_compatible_gemspec + + - ruby/install-deps: + bundler-version: "2.3.26" + with-cache: false + path: '~/vendor/custom_bundle' + + - run: + name: Running compatibility tests + command: bundle exec rspec + + rubygems-deps-ruby: + parameters: + ruby-version: + type: string + + <<: *defaults + + steps: + - checkout + + - run: + name: Building rubygems dependencies from default gemspec on minimal Ruby version + command: bundle install + + releasing-gem-from-ruby: + parameters: + ruby-version: + type: string + + <<: *defaults + + steps: + - checkout + + - add_ssh_keys: + fingerprints: + - "SHA256:4Lk72FCartM+nybIinFywO/2wfXf3MqDcVKz0aGq/6I" + + - run: + name: Publishing new release + command: ./.circleci/scripts/release.sh + +workflows: + build_test_deploy: + jobs: + - linters-ruby: + matrix: + parameters: + ruby-version: ["3.3-node"] + - tests-ruby: + matrix: + parameters: + ruby-version: ["3.3"] + - compatibility-ruby: + matrix: + parameters: + ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] + - rubygems-deps-ruby: + matrix: + parameters: + ruby-version: ["2.5"] + - releasing-gem-from-ruby: + requires: + - linters-ruby + - tests-ruby + - compatibility-ruby + - rubygems-deps-ruby + matrix: + parameters: + ruby-version: ["2.5"] + filters: + branches: + only: master diff --git a/.circleci/gemspecs/compatible b/.circleci/gemspecs/compatible new file mode 100644 index 0000000..17661bc --- /dev/null +++ b/.circleci/gemspecs/compatible @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require_relative 'lib/rspec/mock/version' + +Gem::Specification.new do |spec| + spec.name = 'rspec-mock' + spec.version = RSpec::Mock::VERSION + spec.authors = ['Vladislav Trotsenko'] + spec.email = %w[admin@bestweb.com.ua] + spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework) + spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.) + spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock' + spec.license = 'MIT' + + spec.required_ruby_version = '>= 2.5.0' + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + spec.require_paths = %w[lib] + + spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2' + spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2' + + spec.add_development_dependency 'rspec', '~> 3.13' +end diff --git a/.circleci/gemspecs/latest b/.circleci/gemspecs/latest new file mode 100644 index 0000000..087243c --- /dev/null +++ b/.circleci/gemspecs/latest @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require_relative 'lib/rspec/mock/version' + +Gem::Specification.new do |spec| + spec.name = 'rspec-mock' + spec.version = RSpec::Mock::VERSION + spec.authors = ['Vladislav Trotsenko'] + spec.email = %w[admin@bestweb.com.ua] + spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework) + spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.) + spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock' + spec.license = 'MIT' + + spec.required_ruby_version = '>= 2.5.0' + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + spec.require_paths = %w[lib] + + spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2' + spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2' + + spec.add_development_dependency 'bundler-audit', '~> 0.9.2' + spec.add_development_dependency 'fasterer', '~> 0.11.0' + spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1' + spec.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1' + spec.add_development_dependency 'reek', '~> 6.3' + spec.add_development_dependency 'rspec', '~> 3.13' + spec.add_development_dependency 'rubocop', '~> 1.66', '>= 1.66.1' + spec.add_development_dependency 'rubocop-performance', '~> 1.22', '>= 1.22.1' + spec.add_development_dependency 'rubocop-rspec', '~> 3.1' + spec.add_development_dependency 'simplecov', '~> 0.22.0' +end diff --git a/.circleci/linter_configs/.bundler-audit.yml b/.circleci/linter_configs/.bundler-audit.yml new file mode 100644 index 0000000..46f2b05 --- /dev/null +++ b/.circleci/linter_configs/.bundler-audit.yml @@ -0,0 +1,4 @@ +--- + +ignore: + - EXA-MPLE-XXXX diff --git a/.circleci/linter_configs/.commitspell.yml b/.circleci/linter_configs/.commitspell.yml new file mode 100644 index 0000000..6be3613 --- /dev/null +++ b/.circleci/linter_configs/.commitspell.yml @@ -0,0 +1,36 @@ +--- + +enableGlobDot: true + +patterns: + - name: GithubUser + pattern: /\[@.+\]/gmx + +languageSettings: + - languageId: markdown + ignoreRegExpList: + - Email + - GithubUser + +words: + - bagage + - bagages + - bestwebua + - changeloglint + - configurator + - codebases + - codeclimate + - commitspell + - ffaker + - gemspecs + - hostnames + - lefthook + - markdownlint + - mocktools + - mdlrc + - rubocop + - shortcuting + - simplecov + - stdlib + - substeps + - yamlint diff --git a/.circleci/linter_configs/.cspell.yml b/.circleci/linter_configs/.cspell.yml new file mode 100644 index 0000000..c89c861 --- /dev/null +++ b/.circleci/linter_configs/.cspell.yml @@ -0,0 +1,27 @@ +--- + +enableGlobDot: true + +patterns: + - name: GithubUser + pattern: /\[@.+\]/gmx + - name: MarkdownCode + pattern: /`{1,3}.+`{1,3}/gmx + - name: MarkdownCodeBlock + pattern: /^\s*```[\s\S]*?^\s*```/gmx + +languageSettings: + - languageId: markdown + ignoreRegExpList: + - Email + - GithubUser + - MarkdownCode + - MarkdownCodeBlock + +words: + - Commiting + - Trotsenko + - Vladislav + - bestwebua + - codebases + - gemspecs diff --git a/.circleci/linter_configs/.fasterer.yml b/.circleci/linter_configs/.fasterer.yml new file mode 100644 index 0000000..8c1976b --- /dev/null +++ b/.circleci/linter_configs/.fasterer.yml @@ -0,0 +1,4 @@ +--- + +exclude_paths: + - '.circleci/**/*.rb' diff --git a/.circleci/linter_configs/.lefthook.yml b/.circleci/linter_configs/.lefthook.yml new file mode 100644 index 0000000..adc407b --- /dev/null +++ b/.circleci/linter_configs/.lefthook.yml @@ -0,0 +1,44 @@ +--- + +no_tty: true +skip_output: + - meta + +commit-linters: + commands: + commitspell: + run: .circleci/scripts/commitspell.sh -c '.circleci/linter_configs/.commitspell.yml' + +code-style-linters: + commands: + reek: + run: bundle exec reek + rubocop: + run: bundle exec rubocop -c '.circleci/linter_configs/.rubocop.yml' + shellcheck: + glob: '*.{sh}' + run: shellcheck --norc {all_files} + yamllint: + run: yamllint -c '.circleci/linter_configs/.yamllint.yml' . + +code-performance-linters: + commands: + fasterer: + run: bundle exec fasterer + +code-vulnerability-linters: + commands: + bundle-audit: + run: bundle exec bundle-audit check -c '.circleci/linter_configs/.bundler-audit.yml' --update + +code-documentation-linters: + commands: + cspell: + run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}' + markdownlint: + run: markdownlint -c '.circleci/linter_configs/.markdownlint.yml' '**/*.md' + +release-linters: + commands: + changeloglint: + run: .circleci/scripts/changeloglint.sh diff --git a/.circleci/linter_configs/.markdownlint.yml b/.circleci/linter_configs/.markdownlint.yml new file mode 100644 index 0000000..065b285 --- /dev/null +++ b/.circleci/linter_configs/.markdownlint.yml @@ -0,0 +1,9 @@ +--- + +default: true + +MD013: + line_length: 500 + +MD024: + siblings_only: true diff --git a/.circleci/linter_configs/.rubocop.yml b/.circleci/linter_configs/.rubocop.yml new file mode 100644 index 0000000..49e9cee --- /dev/null +++ b/.circleci/linter_configs/.rubocop.yml @@ -0,0 +1,141 @@ +--- + +require: + - rubocop-rspec + - rubocop-performance + +AllCops: + DisplayCopNames: true + DisplayStyleGuide: true + TargetRubyVersion: 2.5 + SuggestExtensions: false + NewCops: enable + +# Metrics --------------------------------------------------------------------- + +Metrics/ClassLength: + Max: 150 + +Metrics/MethodLength: + Max: 15 + +Metrics/BlockLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/PerceivedComplexity: + Enabled: false + +# Naming ---------------------------------------------------------------------- + +Naming/VariableNumber: + Enabled: false + +Naming/RescuedExceptionsVariableName: + Enabled: false + +Naming/InclusiveLanguage: + Enabled: false + +# Style ----------------------------------------------------------------------- + +Style/Documentation: + Enabled: false + +Style/DoubleNegation: + Enabled: false + +Style/EmptyCaseCondition: + Enabled: false + +Style/ParallelAssignment: + Enabled: false + +Style/RescueStandardError: + Enabled: false + +Style/RedundantConstantBase: + Enabled: false + +# Layout ---------------------------------------------------------------------- + +Layout/LineLength: + Max: 150 + +Layout/ClassStructure: + Enabled: true + Categories: + module_inclusion: + - include + - prepend + - extend + ExpectedOrder: + - module_inclusion + - constants + - public_class_methods + - initializer + - public_methods + - protected_methods + - private_methods + +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Gemspec --------------------------------------------------------------------- + +Gemspec/RequireMFA: + Enabled: false + +Gemspec/DevelopmentDependencies: + Enabled: false + +Gemspec/AddRuntimeDependency: + Enabled: false + +# Performance ----------------------------------------------------------------- + +Performance/MethodObjectAsBlock: + Enabled: false + +# RSpec ----------------------------------------------------------------------- + +RSpec/ExampleLength: + Enabled: false + +RSpec/NestedGroups: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/MessageChain: + Enabled: false + +RSpec/ContextWording: + Enabled: false + +RSpec/AnyInstance: + Enabled: false + +RSpec/MessageSpies: + Enabled: false + +RSpec/MultipleDescribes: + Enabled: false + +RSpec/MultipleMemoizedHelpers: + Enabled: false + +RSpec/StubbedMock: + Enabled: false + +RSpec/VerifiedDoubleReference: + Enabled: false + +RSpec/IndexedLet: + Enabled: false + +RSpec/StringAsInstanceDoubleConstant: + Enabled: false diff --git a/.circleci/linter_configs/.yamllint.yml b/.circleci/linter_configs/.yamllint.yml new file mode 100644 index 0000000..10a4ecf --- /dev/null +++ b/.circleci/linter_configs/.yamllint.yml @@ -0,0 +1,7 @@ +--- + +extends: default + +rules: + line-length: + max: 200 diff --git a/.circleci/scripts/changeloglint.sh b/.circleci/scripts/changeloglint.sh new file mode 100755 index 0000000..c80dc0c --- /dev/null +++ b/.circleci/scripts/changeloglint.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +changelog=$(if [ "$1" = "" ]; then echo "CHANGELOG.md"; else echo "$1"; fi) + +get_current_gem_version() { + ruby -r rubygems -e "puts Gem::Specification::load('$(ls -- *.gemspec)').version" +} + +latest_changelog_tag() { + grep -Po "(?<=\#\# \[)[0-9]+\.[0-9]+\.[0-9]+?(?=\])" "$changelog" | head -n 1 +} + +current_gem_version="$(get_current_gem_version)" + +if [ "$current_gem_version" = "$(latest_changelog_tag)" ] +then + echo "SUCCESS: Current gem version ($current_gem_version) has been found on the top of project changelog." +else + echo "FAILURE: Following to \"Keep a Changelog\" convention current gem version ($current_gem_version) must be mentioned on the top of project changelog." + exit 1 +fi diff --git a/.circleci/scripts/commitspell.sh b/.circleci/scripts/commitspell.sh new file mode 100755 index 0000000..d284cd0 --- /dev/null +++ b/.circleci/scripts/commitspell.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +configuration=$(if [ "$2" = "" ]; then echo "$2"; else echo " $1 $2"; fi) +latest_commit=$(git rev-parse HEAD) + +spellcheck_info() { + echo "Checking the spelling of the latest commit ($latest_commit) message..." +} + +compose_cspell_command() { + echo "cspell-cli lint stdin$configuration" +} + +cspell="$(compose_cspell_command)" + +spellcheck_latest_commit() { + git log -1 --pretty=%B | $cspell +} + +spellcheck_info +spellcheck_latest_commit diff --git a/.circleci/scripts/release.sh b/.circleci/scripts/release.sh new file mode 100755 index 0000000..4e62baa --- /dev/null +++ b/.circleci/scripts/release.sh @@ -0,0 +1,69 @@ +#!/bin/sh +set -e + +GH_CLI_RELEASES_URL="https://github.com/cli/cli/releases" +FILE_NAME="gh" +BUILD_ARCHITECTURE="linux_amd64.deb" +DELIMETER="_" +PACKAGE_FILE="$FILE_NAME$DELIMETER$BUILD_ARCHITECTURE" + +gh_cli_latest_release() { + curl -sL -o /dev/null -w '%{url_effective}' "$GH_CLI_RELEASES_URL/latest" | rev | cut -f 1 -d '/'| rev +} + +download_gh_cli() { + test -z "$VERSION" && VERSION="$(gh_cli_latest_release)" + test -z "$VERSION" && { + echo "Unable to get GitHub CLI release." >&2 + exit 1 + } + curl -s -L -o "$PACKAGE_FILE" "$GH_CLI_RELEASES_URL/download/$VERSION/$FILE_NAME$DELIMETER$(printf '%s' "$VERSION" | cut -c 2-100)$DELIMETER$BUILD_ARCHITECTURE" +} + +install_gh_cli() { + sudo dpkg -i "$PACKAGE_FILE" + rm "$PACKAGE_FILE" +} + +get_release_candidate_version() { + ruby -r rubygems -e "puts Gem::Specification::load('$(ls -- *.gemspec)').version" +} + +release_candidate_tag="v$(get_release_candidate_version)" + +is_an_existing_github_release() { + git fetch origin "refs/tags/$release_candidate_tag" >/dev/null 2>&1 +} + +release_to_rubygems() { + echo "Setting RubyGems publisher credentials..." + ./.circleci/scripts/set_publisher_credentials.sh + echo "Preparation for release..." + git config --global user.email "${PUBLISHER_EMAIL}" + git config --global user.name "${PUBLISHER_NAME}" + git stash + gem install yard gem-ctags + bundle install + echo "Publishing new gem release to RubyGems..." + rake release +} + +release_to_github() { + echo "Downloading and installing latest gh cli..." + download_gh_cli + install_gh_cli + echo "Publishing new release notes to GitHub..." + gh release create "$release_candidate_tag" --generate-notes +} + +update_develop_branch() { + echo "Updating develop branch with new release tag..." + git checkout develop + git merge "$release_candidate_tag" --ff --no-edit + git push origin develop +} + +if is_an_existing_github_release +then echo "Tag $release_candidate_tag already exists on GitHub. Skipping releasing flow..." +else release_to_rubygems; release_to_github; update_develop_branch +fi diff --git a/.circleci/scripts/set_publisher_credentials.sh b/.circleci/scripts/set_publisher_credentials.sh new file mode 100755 index 0000000..36abc15 --- /dev/null +++ b/.circleci/scripts/set_publisher_credentials.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e +set +x +mkdir -p ~/.gem + +cat << EOF > ~/.gem/credentials +--- +:rubygems_api_key: ${RUBYGEMS_API_KEY} +EOF + +chmod 0600 ~/.gem/credentials +set -x diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..cf94389 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,17 @@ +--- + +checks: + argument-count: + enabled: false + method-complexity: + enabled: false + +plugins: + rubocop: + enabled: true + channel: rubocop-1-65 + config: + file: .circleci/linter_configs/.rubocop.yml + + reek: + enabled: true diff --git a/.github/BRANCH_NAMING_CONVENTION.md b/.github/BRANCH_NAMING_CONVENTION.md new file mode 100644 index 0000000..a01188b --- /dev/null +++ b/.github/BRANCH_NAMING_CONVENTION.md @@ -0,0 +1,36 @@ +# Branch naming convention + +## Branch naming + +> Please note for new pull requests create new branches from current `develop` branch only. + +Branch name should include type of your contribution and context. Please follow next pattern for naming your branches: + +```bash +feature/add-some-feature +technical/some-technical-improvements +bugfix/fix-some-bug-name +``` + +## Before PR actions + +### Squash commits + +Please squash all branch commits into the one before opening your PR from your fork. It's simple to do with the git: + +```bash +git rebase -i [hash your first commit of your branch]~1 +git rebase -i 6467fe36232401fa740af067cfd8ac9ec932fed2~1 # example +``` + +### Add commit description + +Please complete your commit description following next pattern: + +``` +Technical/Add info files # should be the same name as your branch name + +* Added license, changelog, contributing, code of conduct docs +* Added GitHub templates +* Updated project license link +``` diff --git a/.github/DEVELOPMENT_ENVIRONMENT_GUIDE.md b/.github/DEVELOPMENT_ENVIRONMENT_GUIDE.md new file mode 100644 index 0000000..b8f9af3 --- /dev/null +++ b/.github/DEVELOPMENT_ENVIRONMENT_GUIDE.md @@ -0,0 +1,26 @@ +# Development environment guide + +## Preparing + +Clone `rspec-mock` repository: + +```bash +git clone https://github.com/mocktools/ruby-rspec-mock.git +cd ruby-rspec-mock +``` + +Configure latest Ruby environment: + +```bash +echo 'ruby-3.1.2' > .ruby-version +cp .circleci/gemspec_latest rspec-mock.gemspec +``` + +## Commiting + +Commit your changes excluding `.ruby-version`, `rspec-mock.gemspec` + +```bash +git add . ':!.ruby-version' ':!rspec-mock.gemspec' +git commit -m 'Your new awesome rspec-mock feature' +``` diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0844874 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +--- + +github: [bestwebua] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..de055d3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG] Your bug report title here" +labels: bug +assignees: bestwebua + +--- + + + +### New bug checklist + +- [ ] I have updated `rspec-mock` to the latest version +- [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-rspec-mock/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/mocktools/ruby-rspec-mock/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-rspec-mock/issues) + + + +### Bug description + + +##### Complete output when running rspec-mock, including the stack trace and command used + +
+
[INSERT OUTPUT HERE]
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..f457a77 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an idea for RSpec::Mock +title: "[FEATURE] Your feature request title here" +labels: enhancement +assignees: bestwebua + +--- + + + +### New feature request checklist + +- [ ] I have updated `rspec-mock` to the latest version +- [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-rspec-mock/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/mocktools/ruby-rspec-mock/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-rspec-mock/issues) + + + +### Feature description + + diff --git a/.github/ISSUE_TEMPLATE/issue_report.md b/.github/ISSUE_TEMPLATE/issue_report.md new file mode 100644 index 0000000..bfe7403 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue_report.md @@ -0,0 +1,28 @@ +--- +name: Issue report +about: Create a report to help us improve +title: "[ISSUE] Your issue report title here" +labels: '' +assignees: bestwebua + +--- + + + +### New issue checklist + +- [ ] I have updated `rspec-mock` to the latest version +- [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-rspec-mock/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/mocktools/ruby-rspec-mock/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-rspec-mock/issues) + + + +### Issue description + + +##### Complete output when running rspec-mock, including the stack trace and command used + +
+
[INSERT OUTPUT HERE]
+
diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..0796b6e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,22 @@ +--- +name: Question +about: Ask your question to RSpec::Mock team +title: "[QUESTION] Your question title here" +labels: question +assignees: bestwebua + +--- + + + +### New question checklist + +- [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-rspec-mock/blob/master/CONTRIBUTING.md) +- [ ] I have read the [documentation](https://github.com/mocktools/ruby-rspec-mock/blob/master/README.md) +- [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-rspec-mock/issues) + + + +### Question + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..27cef0a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,49 @@ +# PR Details + + + + + + +## Description + + + +## Related Issue + + + + + + +## Motivation and Context + + + +## How Has This Been Tested + + + + + +## Types of changes + + + +- [ ] Docs change / refactoring / dependency upgrade +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist + + + + +- [ ] My code follows the code style of this project +- [ ] My change requires a change to the documentation +- [ ] I have updated the documentation accordingly +- [ ] I have read the [**CONTRIBUTING** document](https://github.com/mocktools/ruby-rspec-mock/blob/master/CONTRIBUTING.md) +- [ ] I have added tests to cover my changes +- [ ] I have run `bundle exec rspec` from the root directory to see all new and existing tests pass +- [ ] I have run `rubocop` and `reek` to ensure the code style is valid diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67928ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ +.rspec_status +.DS_Store +Gemfile.lock diff --git a/.reek.yml b/.reek.yml new file mode 100644 index 0000000..5752c08 --- /dev/null +++ b/.reek.yml @@ -0,0 +1,5 @@ +--- + +detectors: + IrresponsibleModule: + enabled: false diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5be63fc --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--require spec_helper +--format documentation diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..101555c --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +rspec-mock diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..bf080da --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.5.0 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8168354 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2024-11-04 + +### Added + +- First release of `RSpec::Mock`. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..65624b3 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at . All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..778ab39 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,48 @@ +# Contributing to RSpec::Mock + +Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. + +Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. + +## Using the issue tracker + +The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests). + +## Issue/bug reports + +A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you! + +Guidelines for issue/bug reports: + +1. **Use the GitHub issue search** — check if the issue has already been reported +2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or `develop` branch in the repository +3. RSpec::Mock [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md) + +A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs. + +## Feature requests + +Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to _you_ to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. + +## Questions + +We're always open to a new conversations. So if you have any questions just ask us. + +## Pull requests + +Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. + +**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. + +Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Not all features proposed will be added but we are open to having a conversation about a feature you are championing. + +Guidelines for pull requests: + +1. RSpec::Mock [pull request template](.github/PULL_REQUEST_TEMPLATE.md) +2. Fork the repo, checkout to `develop` branch +3. Run the tests. This is to make sure your starting point works +4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md) +5. Create a new branch +6. Read our [setup development environment guide](.github/DEVELOPMENT_ENVIRONMENT_GUIDE.md) +7. Make your changes. Please note that your PR should include tests for the new codebase! +8. Push to your fork and submit a pull request to `develop` branch diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ee3c850 --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' +git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } +gemspec diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..55f8323 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 Vladislav Trotsenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e3e7b6e --- /dev/null +++ b/README.md @@ -0,0 +1,149 @@ +# Seamless migration from third-party mocks to RSpec built-in mocking framework + +[![Maintainability](https://api.codeclimate.com/v1/badges/5ea9da61ef468b8ad4c4/maintainability)](https://codeclimate.com/github/mocktools/ruby-rspec-mock/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/5ea9da61ef468b8ad4c4/test_coverage)](https://codeclimate.com/github/mocktools/ruby-rspec-mock/test_coverage) +[![CircleCI](https://circleci.com/gh/mocktools/ruby-rspec-mock/tree/master.svg?style=svg)](https://circleci.com/gh/mocktools/ruby-rspec-mock/tree/master) +[![Gem Version](https://badge.fury.io/rb/rspec-mock.svg)](https://badge.fury.io/rb/rspec-mock) +[![Downloads](https://img.shields.io/gem/dt/rspec-mock.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/rspec-mock) +[![GitHub](https://img.shields.io/github/license/mocktools/ruby-rspec-mock)](LICENSE.txt) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) + +`rspec-mock` is a lightweight gem designed to ease the transition to RSpec's built-in mocking framework by allowing developers to use RSpec's mocks as secondary, alongside a primary, alternative mocking library. This setup enables new code to leverage RSpec’s built-in mocks directly, while still supporting legacy code that relies on an external mocking library. + +## Table of Contents + +- [Features](#features) +- [Requirements](#requirements) +- [Installation](#installation) +- [Usage](#usage) + - [Configuration](#configuration) + - [Integration](#integration) +- [Contributing](#contributing) +- [License](#license) +- [Code of Conduct](#code-of-conduct) +- [Credits](#credits) +- [Versioning](#versioning) +- [Changelog](CHANGELOG.md) + +## Features + +- Dual Mocking Compatibility: Use RSpec’s built-in mock framework as a secondary, with your primary mock of choice (e.g., Mocha, FlexMock). +- Seamless Transition: Adopt `RSpec::Mocks` in new tests gradually, without disrupting existing tests dependent on an alternative mocking library. +- Simplified Migration Path: Makes it easy to phase out external mocking libraries over time, moving towards a more unified, RSpec-native mocking approach. + +## Requirements + +Ruby MRI 2.5.0+ + +## Installation + +Add this line to your application's `Gemfile`: + +```ruby +group :test do + gem 'rspec-mock', require: false +end +``` + +And then execute: + +```bash +bundle +``` + +Or install it yourself as: + +```bash +gem install rspec-mock +``` + +## Usage + +### Configuration + +```ruby +# spec/support/config/rspec_mock.rb + +require 'rspec/mock' + +RSpec.configure do |config| + config.rspec_mock do |mock| + mock.verify_partial_doubles = true + end + + config.include RSpec::Mock::Methods +end +``` + +### Integration + +```ruby +# spec/spec_helper.rb + +RSpec.configure do |config| + config.mock_framework = :flexmock +end + +# spec/sandbox_spec.rb + +RSpec.describe Sandbox do + describe '.call' do + subject(:service) { described_class.call(*args, **kwargs) } + + let(:args) { [1, 2, 3] } + let(:kwargs) { { a: 1, b: 2 } } + let(:expected_result) { { args:, kwargs: } } + + context 'when multiple mocks' do + before do + flexmock(described_class) + .should_receive(:new) + .with(*args, **kwargs) + .pass_thru + + rspec_mock do + allow(described_class) + .to receive(:call) + .with(*args, **kwargs) + .and_call_original + end + end + + it { is_expected.to eq(expected_result) } + end + + context 'when single mock' do + it do + rspec_mock do + expect(described_class) + .to receive(:call) + .with(*args, **kwargs) + .and_call_original + expect(service).to eq(expected_result) + end + end + end + end +end +``` + +## Contributing + +Bug reports and pull requests are welcome on GitHub at . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tickets](https://github.com/mocktools/ruby-rspec-mock/issues). Be sure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md). + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). + +## Code of Conduct + +Everyone interacting in the RSpec::Mock project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md). + +## Credits + +- [The Contributors](https://github.com/mocktools/ruby-rspec-mock/graphs/contributors) for code and awesome suggestions +- [The Stargazers](https://github.com/mocktools/ruby-rspec-mock/stargazers) for showing their support + +## Versioning + +RSpec::Mock uses [Semantic Versioning 2.0.0](https://semver.org) diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..82bb534 --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..db7e6e2 --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'bundler/setup' +require 'rspec-mock' + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require 'irb' +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/lib/rspec/mock.rb b/lib/rspec/mock.rb new file mode 100644 index 0000000..fdae84d --- /dev/null +++ b/lib/rspec/mock.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require_relative 'mock/core' diff --git a/lib/rspec/mock/core.rb b/lib/rspec/mock/core.rb new file mode 100644 index 0000000..4cb9d5b --- /dev/null +++ b/lib/rspec/mock/core.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module RSpec + module Mock + require_relative 'version' + end +end diff --git a/lib/rspec/mock/version.rb b/lib/rspec/mock/version.rb new file mode 100644 index 0000000..43c2a6d --- /dev/null +++ b/lib/rspec/mock/version.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module RSpec + module Mock + VERSION = '0.1.0' + end +end diff --git a/rspec-mock.gemspec b/rspec-mock.gemspec new file mode 100644 index 0000000..17aaab3 --- /dev/null +++ b/rspec-mock.gemspec @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require_relative 'lib/rspec/mock/version' + +Gem::Specification.new do |spec| + spec.name = 'rspec-mock' + spec.version = RSpec::Mock::VERSION + spec.authors = ['Vladislav Trotsenko'] + spec.email = %w[admin@bestweb.com.ua] + + spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework) + spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.) + + spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock' + spec.license = 'MIT' + + spec.metadata = { + 'homepage_uri' => 'https://github.com/mocktools/ruby-rspec-mock', + 'changelog_uri' => 'https://github.com/mocktools/ruby-rspec-mock/blob/master/CHANGELOG.md', + 'source_code_uri' => 'https://github.com/mocktools/ruby-rspec-mock', + 'documentation_uri' => 'https://github.com/mocktools/ruby-rspec-mock/blob/master/README.md', + 'bug_tracker_uri' => 'https://github.com/mocktools/ruby-rspec-mock/issues' + } + + spec.required_ruby_version = '>= 2.5.0' + spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(bin|lib)/|.ruby-version|rspec-mock.gemspec|LICENSE}) } + spec.require_paths = %w[lib] + + spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2' + spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2' + + spec.add_development_dependency 'rspec', '~> 3.13' +end diff --git a/spec/rspec/mock/version_spec.rb b/spec/rspec/mock/version_spec.rb new file mode 100644 index 0000000..d3d4850 --- /dev/null +++ b/spec/rspec/mock/version_spec.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +RSpec.describe RSpec::Mock::VERSION do + it { is_expected.not_to be_nil } +end diff --git a/spec/rspec/mock_spec.rb b/spec/rspec/mock_spec.rb new file mode 100644 index 0000000..9f4746b --- /dev/null +++ b/spec/rspec/mock_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +RSpec.describe RSpec::Mock do + it 'has a version number' do + expect(described_class::VERSION).not_to be_nil + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..6cb97f4 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +rspec_custom = ::File.join(::File.dirname(__FILE__), 'support/**/*.rb') +::Dir[::File.expand_path(rspec_custom)].sort.each { |file| require file unless file[/\A.+_spec\.rb\z/] } + +require_relative '../lib/rspec/mock' + +RSpec.configure do |config| + config.expect_with(:rspec) do |expectations| + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + expectations.syntax = :expect + end + + config.example_status_persistence_file_path = '.rspec_status' + config.disable_monkey_patching! + config.order = :random + + ::Kernel.srand(config.seed) +end diff --git a/spec/support/config/bundler.rb b/spec/support/config/bundler.rb new file mode 100644 index 0000000..81f3f90 --- /dev/null +++ b/spec/support/config/bundler.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'bundler/setup' diff --git a/spec/support/config/pry.rb b/spec/support/config/pry.rb new file mode 100644 index 0000000..e8ef447 --- /dev/null +++ b/spec/support/config/pry.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'pry' if ::RUBY_VERSION[/\A3\.3.+\z/] diff --git a/spec/support/config/simplecov.rb b/spec/support/config/simplecov.rb new file mode 100644 index 0000000..3af6697 --- /dev/null +++ b/spec/support/config/simplecov.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +if ::RUBY_VERSION[/\A3\.3.+\z/] + require 'simplecov' + + SimpleCov.minimum_coverage(100) + SimpleCov.start { add_filter(%r{\A/spec/}) } +end