Skip to content

Commit 24af758

Browse files
authored
Merge pull request #3 from mocktools/develop
RSpec::Mock v0.1.0
2 parents 0a8eb91 + 41c8014 commit 24af758

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1590
-0
lines changed

.circleci/config.yml

+213
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
3+
version: 2.1
4+
5+
defaults: &defaults
6+
working_directory: ~/ruby-rspec-mock
7+
docker:
8+
- image: cimg/ruby:<< parameters.ruby-version >>
9+
10+
orbs:
11+
ruby: circleci/[email protected]
12+
13+
references:
14+
bundle_install: &bundle_install
15+
run:
16+
name: Installing gems
17+
command: |
18+
bundle config set --local path '~/vendor/bundle'
19+
bundle install
20+
21+
install_linters: &install_linters
22+
run:
23+
name: Installing bunch of linters
24+
command: |
25+
curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash
26+
sudo apt-get update -y
27+
sudo apt-get install -y lefthook shellcheck yamllint
28+
npm install --prefix='~/.local' --global --save-dev git+https://github.com/streetsidesoftware/cspell-cli markdownlint-cli
29+
cp .circleci/linter_configs/.fasterer.yml .fasterer.yml
30+
cp .circleci/linter_configs/.lefthook.yml lefthook.yml
31+
32+
install_codeclimate_reporter: &install_codeclimate_reporter
33+
run:
34+
name: Installing CodeClimate test reporter
35+
command: |
36+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
37+
chmod +x ./cc-test-reporter
38+
39+
use_latest_bundler: &use_latest_bundler
40+
run:
41+
name: Using latest bundler
42+
command: gem install bundler
43+
44+
use_latest_gemspec: &use_latest_gemspec
45+
run:
46+
name: Using latest gemspec
47+
command: cp .circleci/gemspecs/latest rspec-mock.gemspec
48+
49+
use_compatible_gemspec: &use_compatible_gemspec
50+
run:
51+
name: Using compatible gemspec
52+
command: cp .circleci/gemspecs/compatible rspec-mock.gemspec
53+
54+
jobs:
55+
linters-ruby:
56+
parameters:
57+
ruby-version:
58+
type: string
59+
60+
<<: *defaults
61+
62+
steps:
63+
- checkout
64+
65+
- <<: *use_latest_bundler
66+
- <<: *use_latest_gemspec
67+
- <<: *bundle_install
68+
- <<: *install_linters
69+
70+
- run:
71+
name: Running commit linters
72+
command: lefthook run commit-linters
73+
74+
- run:
75+
name: Running code style linters
76+
command: lefthook run code-style-linters
77+
78+
- run:
79+
name: Running code performance linters
80+
command: lefthook run code-performance-linters
81+
82+
- run:
83+
name: Running code vulnerability linters
84+
command: lefthook run code-vulnerability-linters
85+
86+
- run:
87+
name: Running code documentation linters
88+
command: lefthook run code-documentation-linters
89+
90+
- run:
91+
name: Running release linters
92+
command: lefthook run release-linters
93+
94+
tests-ruby:
95+
parameters:
96+
ruby-version:
97+
type: string
98+
99+
<<: *defaults
100+
101+
steps:
102+
- checkout
103+
104+
- <<: *use_latest_bundler
105+
- <<: *use_latest_gemspec
106+
- <<: *bundle_install
107+
- <<: *install_codeclimate_reporter
108+
109+
- run:
110+
name: Running RSpec
111+
command: |
112+
./cc-test-reporter before-build
113+
bundle exec rspec
114+
115+
- run:
116+
name: Creating CodeClimate test coverage report
117+
command: |
118+
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
119+
120+
- store_artifacts:
121+
name: Saving Simplecov coverage artifacts
122+
path: ~/ruby-rspec-mock/coverage
123+
destination: coverage
124+
125+
- deploy:
126+
name: Uploading CodeClimate test coverage report
127+
command: |
128+
./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
129+
130+
compatibility-ruby:
131+
parameters:
132+
ruby-version:
133+
type: string
134+
135+
<<: *defaults
136+
137+
steps:
138+
- checkout
139+
140+
- <<: *use_compatible_gemspec
141+
142+
- ruby/install-deps:
143+
bundler-version: "2.3.26"
144+
with-cache: false
145+
path: '~/vendor/custom_bundle'
146+
147+
- run:
148+
name: Running compatibility tests
149+
command: bundle exec rspec
150+
151+
rubygems-deps-ruby:
152+
parameters:
153+
ruby-version:
154+
type: string
155+
156+
<<: *defaults
157+
158+
steps:
159+
- checkout
160+
161+
- run:
162+
name: Building rubygems dependencies from default gemspec on minimal Ruby version
163+
command: bundle install
164+
165+
releasing-gem-from-ruby:
166+
parameters:
167+
ruby-version:
168+
type: string
169+
170+
<<: *defaults
171+
172+
steps:
173+
- checkout
174+
175+
- add_ssh_keys:
176+
fingerprints:
177+
- "SHA256:4Lk72FCartM+nybIinFywO/2wfXf3MqDcVKz0aGq/6I"
178+
179+
- run:
180+
name: Publishing new release
181+
command: ./.circleci/scripts/release.sh
182+
183+
workflows:
184+
build_test_deploy:
185+
jobs:
186+
- linters-ruby:
187+
matrix:
188+
parameters:
189+
ruby-version: ["3.3-node"]
190+
- tests-ruby:
191+
matrix:
192+
parameters:
193+
ruby-version: ["3.3"]
194+
- compatibility-ruby:
195+
matrix:
196+
parameters:
197+
ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"]
198+
- rubygems-deps-ruby:
199+
matrix:
200+
parameters:
201+
ruby-version: ["2.5"]
202+
- releasing-gem-from-ruby:
203+
requires:
204+
- linters-ruby
205+
- tests-ruby
206+
- compatibility-ruby
207+
- rubygems-deps-ruby
208+
matrix:
209+
parameters:
210+
ruby-version: ["2.5"]
211+
filters:
212+
branches:
213+
only: master

.circleci/gemspecs/compatible

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'lib/rspec/mock/version'
4+
5+
Gem::Specification.new do |spec|
6+
spec.name = 'rspec-mock'
7+
spec.version = RSpec::Mock::VERSION
8+
spec.authors = ['Vladislav Trotsenko']
9+
spec.email = %w[[email protected]]
10+
spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework)
11+
spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.)
12+
spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock'
13+
spec.license = 'MIT'
14+
15+
spec.required_ruby_version = '>= 2.5.0'
16+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17+
spec.require_paths = %w[lib]
18+
19+
spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2'
20+
spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2'
21+
22+
spec.add_development_dependency 'rspec', '~> 3.13'
23+
end

.circleci/gemspecs/latest

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'lib/rspec/mock/version'
4+
5+
Gem::Specification.new do |spec|
6+
spec.name = 'rspec-mock'
7+
spec.version = RSpec::Mock::VERSION
8+
spec.authors = ['Vladislav Trotsenko']
9+
spec.email = %w[[email protected]]
10+
spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework)
11+
spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.)
12+
spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock'
13+
spec.license = 'MIT'
14+
15+
spec.required_ruby_version = '>= 2.5.0'
16+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17+
spec.require_paths = %w[lib]
18+
19+
spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2'
20+
spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2'
21+
22+
spec.add_development_dependency 'bundler-audit', '~> 0.9.2'
23+
spec.add_development_dependency 'fasterer', '~> 0.11.0'
24+
spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1'
25+
spec.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
26+
spec.add_development_dependency 'reek', '~> 6.3'
27+
spec.add_development_dependency 'rspec', '~> 3.13'
28+
spec.add_development_dependency 'rubocop', '~> 1.66', '>= 1.66.1'
29+
spec.add_development_dependency 'rubocop-performance', '~> 1.22', '>= 1.22.1'
30+
spec.add_development_dependency 'rubocop-rspec', '~> 3.1'
31+
spec.add_development_dependency 'simplecov', '~> 0.22.0'
32+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
3+
ignore:
4+
- EXA-MPLE-XXXX
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
3+
enableGlobDot: true
4+
5+
patterns:
6+
- name: GithubUser
7+
pattern: /\[@.+\]/gmx
8+
9+
languageSettings:
10+
- languageId: markdown
11+
ignoreRegExpList:
12+
- Email
13+
- GithubUser
14+
15+
words:
16+
- bagage
17+
- bagages
18+
- bestwebua
19+
- changeloglint
20+
- configurator
21+
- codebases
22+
- codeclimate
23+
- commitspell
24+
- ffaker
25+
- gemspecs
26+
- hostnames
27+
- lefthook
28+
- markdownlint
29+
- mocktools
30+
- mdlrc
31+
- rubocop
32+
- shortcuting
33+
- simplecov
34+
- stdlib
35+
- substeps
36+
- yamlint

.circleci/linter_configs/.cspell.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
3+
enableGlobDot: true
4+
5+
patterns:
6+
- name: GithubUser
7+
pattern: /\[@.+\]/gmx
8+
- name: MarkdownCode
9+
pattern: /`{1,3}.+`{1,3}/gmx
10+
- name: MarkdownCodeBlock
11+
pattern: /^\s*```[\s\S]*?^\s*```/gmx
12+
13+
languageSettings:
14+
- languageId: markdown
15+
ignoreRegExpList:
16+
- Email
17+
- GithubUser
18+
- MarkdownCode
19+
- MarkdownCodeBlock
20+
21+
words:
22+
- Commiting
23+
- Trotsenko
24+
- Vladislav
25+
- bestwebua
26+
- codebases
27+
- gemspecs
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
3+
exclude_paths:
4+
- '.circleci/**/*.rb'
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
3+
no_tty: true
4+
skip_output:
5+
- meta
6+
7+
commit-linters:
8+
commands:
9+
commitspell:
10+
run: .circleci/scripts/commitspell.sh -c '.circleci/linter_configs/.commitspell.yml'
11+
12+
code-style-linters:
13+
commands:
14+
reek:
15+
run: bundle exec reek
16+
rubocop:
17+
run: bundle exec rubocop -c '.circleci/linter_configs/.rubocop.yml'
18+
shellcheck:
19+
glob: '*.{sh}'
20+
run: shellcheck --norc {all_files}
21+
yamllint:
22+
run: yamllint -c '.circleci/linter_configs/.yamllint.yml' .
23+
24+
code-performance-linters:
25+
commands:
26+
fasterer:
27+
run: bundle exec fasterer
28+
29+
code-vulnerability-linters:
30+
commands:
31+
bundle-audit:
32+
run: bundle exec bundle-audit check -c '.circleci/linter_configs/.bundler-audit.yml' --update
33+
34+
code-documentation-linters:
35+
commands:
36+
cspell:
37+
run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}'
38+
markdownlint:
39+
run: markdownlint -c '.circleci/linter_configs/.markdownlint.yml' '**/*.md'
40+
41+
release-linters:
42+
commands:
43+
changeloglint:
44+
run: .circleci/scripts/changeloglint.sh

0 commit comments

Comments
 (0)