rspec_in_context 1.1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.git-hooks/pre_push/rubocop.rb +1 -1
- data/.github/workflows/test_and_publish.yml +24 -7
- data/.github/workflows/test_only.yml +20 -3
- data/.github/workflows/verify_version_change.yml +6 -2
- data/.gitignore +7 -0
- data/.prettierrc.js +5 -0
- data/.rubocop-remote-fc7fff8f41d19bde0dcc446ded612e75.yml +153 -0
- data/.rubocop.yml +19 -43
- data/.ruby-version +1 -1
- data/CHANGELOG.md +35 -4
- data/README.md +26 -7
- data/TODO.md +44 -0
- data/lib/rspec_in_context/context_management.rb +1 -1
- data/lib/rspec_in_context/in_context.rb +134 -37
- data/lib/rspec_in_context/version.rb +1 -1
- data/lib/rspec_in_context.rb +10 -4
- data/package.json +26 -0
- data/rspec_in_context.gemspec +22 -20
- data/yarn.lock +13 -0
- metadata +30 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 730a3e4b4ffb390f1331ac01a19295c91c8c7d21b356e23618bc10d619645f2a
|
|
4
|
+
data.tar.gz: 74b2c2d9f4f4921a7611d678dfc7202226bd123a670148564b6302d6f951a772
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21923024896432dbcd2e4234306df21ccb3e3ef8eddb3325c576322e5d54a8e54ad4169c2b94b9b3cb8b43ab78531a20f5dd61e9fa7653b6e54832eb05a84948
|
|
7
|
+
data.tar.gz: 44badaca77e3c8994c0fc9faea35c8877d1d50c73bdee4a3caaeebd6497c336545c8e6ac3743c8b639fa4e6b1c1193a523ea5dd3beb4996e72eda6fccdbd9b3b
|
|
@@ -2,18 +2,18 @@ name: Test and Release
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches:
|
|
5
|
+
branches:
|
|
6
6
|
- main
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
tests:
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
ruby: [2
|
|
12
|
+
ruby: ['3.2', '3.3', '3.4', '4.0']
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
17
|
- name: Set up Ruby
|
|
18
18
|
uses: ruby/setup-ruby@v1
|
|
19
19
|
with:
|
|
@@ -23,16 +23,33 @@ jobs:
|
|
|
23
23
|
run: bundle exec rubocop
|
|
24
24
|
- name: Run tests
|
|
25
25
|
run: bundle exec rspec
|
|
26
|
+
prettier:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- name: Set up Ruby
|
|
31
|
+
uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
ruby-version: '3.4'
|
|
34
|
+
bundler-cache: true
|
|
35
|
+
- name: Set up Node
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
|
+
with:
|
|
38
|
+
node-version: '22'
|
|
39
|
+
- name: Install yarn dep
|
|
40
|
+
run: yarn install
|
|
41
|
+
- name: Check prettier
|
|
42
|
+
run: yarn prettier -c 'lib/**/*.rb' 'spec/**/*.rb' '*.gemspec' Gemfile
|
|
26
43
|
release:
|
|
27
|
-
needs: [tests]
|
|
44
|
+
needs: [tests, prettier]
|
|
28
45
|
runs-on: ubuntu-latest
|
|
29
46
|
|
|
30
47
|
steps:
|
|
31
|
-
- uses: actions/checkout@
|
|
48
|
+
- uses: actions/checkout@v4
|
|
32
49
|
- name: Set up Ruby
|
|
33
50
|
uses: ruby/setup-ruby@v1
|
|
34
51
|
with:
|
|
35
|
-
ruby-version: 3.
|
|
52
|
+
ruby-version: '3.4'
|
|
36
53
|
bundler-cache: true
|
|
37
54
|
- name: Prepare credentials
|
|
38
55
|
env:
|
|
@@ -43,4 +60,4 @@ jobs:
|
|
|
43
60
|
- name: Fetch tags from remote
|
|
44
61
|
run: "git fetch -t"
|
|
45
62
|
- name: Publish if version change
|
|
46
|
-
run: 'git diff
|
|
63
|
+
run: 'git diff $(git tag --sort=-v:refname | head -1) -- lib/rspec_in_context/version.rb | grep -E "^\+.*VERSION" && rake release || echo "No release for now"'
|
|
@@ -2,18 +2,18 @@ name: Tests
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches-ignore:
|
|
5
|
+
branches-ignore:
|
|
6
6
|
- main
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
tests:
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
ruby: [2
|
|
12
|
+
ruby: ['3.2', '3.3', '3.4', '4.0']
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
17
|
- name: Set up Ruby
|
|
18
18
|
uses: ruby/setup-ruby@v1
|
|
19
19
|
with:
|
|
@@ -23,3 +23,20 @@ jobs:
|
|
|
23
23
|
run: bundle exec rubocop
|
|
24
24
|
- name: Run tests
|
|
25
25
|
run: bundle exec rspec
|
|
26
|
+
prettier:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- name: Set up Ruby
|
|
31
|
+
uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
ruby-version: '3.4'
|
|
34
|
+
bundler-cache: true
|
|
35
|
+
- name: Set up Node
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
|
+
with:
|
|
38
|
+
node-version: '22'
|
|
39
|
+
- name: Install yarn dep
|
|
40
|
+
run: yarn install
|
|
41
|
+
- name: Check prettier
|
|
42
|
+
run: yarn prettier -c 'lib/**/*.rb' 'spec/**/*.rb' '*.gemspec' Gemfile
|
|
@@ -10,7 +10,7 @@ jobs:
|
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
14
|
- name: Fetch main branch
|
|
15
15
|
run: git fetch origin main:main
|
|
16
16
|
- name: Verify if there's a change in version
|
|
@@ -18,4 +18,8 @@ jobs:
|
|
|
18
18
|
- name: Print new version
|
|
19
19
|
run: 'git diff main -- lib/rspec_in_context/version.rb | grep -E "^\+.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?"'
|
|
20
20
|
- name: Verify if higher version
|
|
21
|
-
run:
|
|
21
|
+
run: |
|
|
22
|
+
NEW_VERSION=$(git diff main -- lib/rspec_in_context/version.rb | grep -E "^\+.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?")
|
|
23
|
+
OLD_VERSION=$(git diff main -- lib/rspec_in_context/version.rb | grep -E "^-.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?")
|
|
24
|
+
HIGHEST=$(echo -e "$OLD_VERSION\n$NEW_VERSION" | sort -V | tail -1)
|
|
25
|
+
[[ "$HIGHEST" == "$NEW_VERSION" && "$OLD_VERSION" != "$NEW_VERSION" ]]
|
data/.gitignore
CHANGED
data/.prettierrc.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Relaxed.Ruby.Style
|
|
2
|
+
## Version 2.5
|
|
3
|
+
|
|
4
|
+
Style/Alias:
|
|
5
|
+
Enabled: false
|
|
6
|
+
StyleGuide: https://relaxed.ruby.style/#stylealias
|
|
7
|
+
|
|
8
|
+
Style/AsciiComments:
|
|
9
|
+
Enabled: false
|
|
10
|
+
StyleGuide: https://relaxed.ruby.style/#styleasciicomments
|
|
11
|
+
|
|
12
|
+
Style/BeginBlock:
|
|
13
|
+
Enabled: false
|
|
14
|
+
StyleGuide: https://relaxed.ruby.style/#stylebeginblock
|
|
15
|
+
|
|
16
|
+
Style/BlockDelimiters:
|
|
17
|
+
Enabled: false
|
|
18
|
+
StyleGuide: https://relaxed.ruby.style/#styleblockdelimiters
|
|
19
|
+
|
|
20
|
+
Style/CommentAnnotation:
|
|
21
|
+
Enabled: false
|
|
22
|
+
StyleGuide: https://relaxed.ruby.style/#stylecommentannotation
|
|
23
|
+
|
|
24
|
+
Style/Documentation:
|
|
25
|
+
Enabled: false
|
|
26
|
+
StyleGuide: https://relaxed.ruby.style/#styledocumentation
|
|
27
|
+
|
|
28
|
+
Layout/DotPosition:
|
|
29
|
+
Enabled: false
|
|
30
|
+
StyleGuide: https://relaxed.ruby.style/#layoutdotposition
|
|
31
|
+
|
|
32
|
+
Style/DoubleNegation:
|
|
33
|
+
Enabled: false
|
|
34
|
+
StyleGuide: https://relaxed.ruby.style/#styledoublenegation
|
|
35
|
+
|
|
36
|
+
Style/EndBlock:
|
|
37
|
+
Enabled: false
|
|
38
|
+
StyleGuide: https://relaxed.ruby.style/#styleendblock
|
|
39
|
+
|
|
40
|
+
Style/FormatString:
|
|
41
|
+
Enabled: false
|
|
42
|
+
StyleGuide: https://relaxed.ruby.style/#styleformatstring
|
|
43
|
+
|
|
44
|
+
Style/IfUnlessModifier:
|
|
45
|
+
Enabled: false
|
|
46
|
+
StyleGuide: https://relaxed.ruby.style/#styleifunlessmodifier
|
|
47
|
+
|
|
48
|
+
Style/Lambda:
|
|
49
|
+
Enabled: false
|
|
50
|
+
StyleGuide: https://relaxed.ruby.style/#stylelambda
|
|
51
|
+
|
|
52
|
+
Style/ModuleFunction:
|
|
53
|
+
Enabled: false
|
|
54
|
+
StyleGuide: https://relaxed.ruby.style/#stylemodulefunction
|
|
55
|
+
|
|
56
|
+
Style/MultilineBlockChain:
|
|
57
|
+
Enabled: false
|
|
58
|
+
StyleGuide: https://relaxed.ruby.style/#stylemultilineblockchain
|
|
59
|
+
|
|
60
|
+
Style/NegatedIf:
|
|
61
|
+
Enabled: false
|
|
62
|
+
StyleGuide: https://relaxed.ruby.style/#stylenegatedif
|
|
63
|
+
|
|
64
|
+
Style/NegatedWhile:
|
|
65
|
+
Enabled: false
|
|
66
|
+
StyleGuide: https://relaxed.ruby.style/#stylenegatedwhile
|
|
67
|
+
|
|
68
|
+
Style/NumericPredicate:
|
|
69
|
+
Enabled: false
|
|
70
|
+
StyleGuide: https://relaxed.ruby.style/#stylenumericpredicate
|
|
71
|
+
|
|
72
|
+
Style/ParallelAssignment:
|
|
73
|
+
Enabled: false
|
|
74
|
+
StyleGuide: https://relaxed.ruby.style/#styleparallelassignment
|
|
75
|
+
|
|
76
|
+
Style/PercentLiteralDelimiters:
|
|
77
|
+
Enabled: false
|
|
78
|
+
StyleGuide: https://relaxed.ruby.style/#stylepercentliteraldelimiters
|
|
79
|
+
|
|
80
|
+
Style/PerlBackrefs:
|
|
81
|
+
Enabled: false
|
|
82
|
+
StyleGuide: https://relaxed.ruby.style/#styleperlbackrefs
|
|
83
|
+
|
|
84
|
+
Style/Semicolon:
|
|
85
|
+
Enabled: false
|
|
86
|
+
StyleGuide: https://relaxed.ruby.style/#stylesemicolon
|
|
87
|
+
|
|
88
|
+
Style/SignalException:
|
|
89
|
+
Enabled: false
|
|
90
|
+
StyleGuide: https://relaxed.ruby.style/#stylesignalexception
|
|
91
|
+
|
|
92
|
+
Style/SingleLineBlockParams:
|
|
93
|
+
Enabled: false
|
|
94
|
+
StyleGuide: https://relaxed.ruby.style/#stylesinglelineblockparams
|
|
95
|
+
|
|
96
|
+
Style/SingleLineMethods:
|
|
97
|
+
Enabled: false
|
|
98
|
+
StyleGuide: https://relaxed.ruby.style/#stylesinglelinemethods
|
|
99
|
+
|
|
100
|
+
Layout/SpaceBeforeBlockBraces:
|
|
101
|
+
Enabled: false
|
|
102
|
+
StyleGuide: https://relaxed.ruby.style/#layoutspacebeforeblockbraces
|
|
103
|
+
|
|
104
|
+
Layout/SpaceInsideParens:
|
|
105
|
+
Enabled: false
|
|
106
|
+
StyleGuide: https://relaxed.ruby.style/#layoutspaceinsideparens
|
|
107
|
+
|
|
108
|
+
Style/SpecialGlobalVars:
|
|
109
|
+
Enabled: false
|
|
110
|
+
StyleGuide: https://relaxed.ruby.style/#stylespecialglobalvars
|
|
111
|
+
|
|
112
|
+
Style/StringLiterals:
|
|
113
|
+
Enabled: false
|
|
114
|
+
StyleGuide: https://relaxed.ruby.style/#stylestringliterals
|
|
115
|
+
|
|
116
|
+
Style/TrailingCommaInArguments:
|
|
117
|
+
Enabled: false
|
|
118
|
+
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarguments
|
|
119
|
+
|
|
120
|
+
Style/TrailingCommaInArrayLiteral:
|
|
121
|
+
Enabled: false
|
|
122
|
+
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarrayliteral
|
|
123
|
+
|
|
124
|
+
Style/TrailingCommaInHashLiteral:
|
|
125
|
+
Enabled: false
|
|
126
|
+
StyleGuide: https://relaxed.ruby.style/#styletrailingcommainhashliteral
|
|
127
|
+
|
|
128
|
+
Style/SymbolArray:
|
|
129
|
+
Enabled: false
|
|
130
|
+
StyleGuide: http://relaxed.ruby.style/#stylesymbolarray
|
|
131
|
+
|
|
132
|
+
Style/WhileUntilModifier:
|
|
133
|
+
Enabled: false
|
|
134
|
+
StyleGuide: https://relaxed.ruby.style/#stylewhileuntilmodifier
|
|
135
|
+
|
|
136
|
+
Style/WordArray:
|
|
137
|
+
Enabled: false
|
|
138
|
+
StyleGuide: https://relaxed.ruby.style/#stylewordarray
|
|
139
|
+
|
|
140
|
+
Lint/AmbiguousRegexpLiteral:
|
|
141
|
+
Enabled: false
|
|
142
|
+
StyleGuide: https://relaxed.ruby.style/#lintambiguousregexpliteral
|
|
143
|
+
|
|
144
|
+
Lint/AssignmentInCondition:
|
|
145
|
+
Enabled: false
|
|
146
|
+
StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
|
|
147
|
+
|
|
148
|
+
Layout/LineLength:
|
|
149
|
+
Enabled: false
|
|
150
|
+
|
|
151
|
+
Metrics:
|
|
152
|
+
Enabled: false
|
|
153
|
+
|
data/.rubocop.yml
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
inherit_from:
|
|
2
2
|
- http://relaxed.ruby.style/rubocop.yml
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
inherit_gem:
|
|
5
|
+
prettier: rubocop.yml
|
|
6
|
+
|
|
7
|
+
plugins:
|
|
5
8
|
- rubocop-performance
|
|
6
9
|
|
|
7
10
|
AllCops:
|
|
8
11
|
NewCops: enable
|
|
9
12
|
DisplayStyleGuide: true
|
|
10
13
|
DisplayCopNames: true
|
|
14
|
+
SuggestExtensions: false
|
|
11
15
|
Exclude:
|
|
12
16
|
- 'bin/*'
|
|
13
17
|
- 'vendor/**/*'
|
|
18
|
+
- 'node_modules/**/*'
|
|
14
19
|
|
|
15
20
|
Metrics/BlockLength:
|
|
16
21
|
Exclude:
|
|
@@ -22,50 +27,21 @@ Metrics/BlockLength:
|
|
|
22
27
|
Lint/EmptyBlock:
|
|
23
28
|
Enabled: false
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- spec/rspec_in_context/in_context_spec.rb
|
|
28
|
-
|
|
29
|
-
Naming/MethodParameterName:
|
|
30
|
+
# Development dependencies in gemspec is a valid pattern for gems
|
|
31
|
+
Gemspec/DevelopmentDependencies:
|
|
30
32
|
Enabled: false
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Style/TrailingCommaInArrayLiteral:
|
|
37
|
-
Enabled: true
|
|
38
|
-
EnforcedStyleForMultiline: comma
|
|
39
|
-
|
|
40
|
-
Style/TrailingCommaInHashLiteral:
|
|
41
|
-
Enabled: true
|
|
42
|
-
EnforcedStyleForMultiline: comma
|
|
43
|
-
|
|
44
|
-
Layout/MultilineArrayLineBreaks:
|
|
45
|
-
Enabled: true
|
|
46
|
-
|
|
47
|
-
Layout/MultilineHashKeyLineBreaks:
|
|
48
|
-
Enabled: true
|
|
49
|
-
|
|
50
|
-
Layout/MultilineMethodArgumentLineBreaks:
|
|
51
|
-
Enabled: true
|
|
52
|
-
|
|
53
|
-
Layout/FirstArrayElementLineBreak:
|
|
54
|
-
Enabled: true
|
|
55
|
-
|
|
56
|
-
Layout/FirstHashElementLineBreak:
|
|
57
|
-
Enabled: true
|
|
34
|
+
### Prettier
|
|
35
|
+
Style/OptionalBooleanParameter:
|
|
36
|
+
Enabled: false
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
Enabled:
|
|
38
|
+
Style/GuardClause:
|
|
39
|
+
Enabled: false
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
|
|
41
|
+
# We legitimately reopen RSpec in multiple files and define separate helper modules
|
|
42
|
+
Style/OneClassPerFile:
|
|
43
|
+
Enabled: false
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
AutoCorrect: true
|
|
69
|
-
Exclude:
|
|
70
|
-
- Gemfile
|
|
71
|
-
- Guardfile
|
|
45
|
+
### End Prettier
|
|
46
|
+
Naming/MethodParameterName:
|
|
47
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.1
|
data/CHANGELOG.md
CHANGED
|
@@ -6,16 +6,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
## [1.
|
|
10
|
-
|
|
9
|
+
## [1.2.0] - 2026-01-27
|
|
10
|
+
### Breaking
|
|
11
|
+
- **BREAKING** Minimum Ruby version is now 3.2
|
|
12
|
+
- **BREAKING** `in_context` without namespace now raises `AmbiguousContextName` if the same context name exists in multiple namespaces. Specify the namespace explicitly to resolve.
|
|
13
|
+
- Removed `codacy-coverage` dependency (incompatible with Ruby 4)
|
|
11
14
|
|
|
12
15
|
### Added
|
|
13
|
-
-
|
|
16
|
+
- Nested `in_context` with blocks now work correctly (uses a stack instead of a single thread-local variable)
|
|
17
|
+
- Input validation: `define_context` raises `InvalidContextName` for nil/empty names and `MissingDefinitionBlock` when no block is given
|
|
18
|
+
- `AmbiguousContextName` error when a context name exists in multiple namespaces and no namespace is specified
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- CI now tests Ruby 3.2, 3.3, 3.4, and head
|
|
22
|
+
- GitHub Actions updated to v4 (checkout, setup-node)
|
|
23
|
+
- Node updated to 20 in CI
|
|
24
|
+
- Rubocop config uses `plugins` instead of deprecated `require`
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Thread-safety for nested `in_context` calls with blocks (previous implementation silently overwrote the outer block)
|
|
28
|
+
- Non-deterministic context resolution when multiple namespaces contained the same context name
|
|
29
|
+
- Tests no longer depend on execution order (random order enabled)
|
|
30
|
+
- Removed all global variables from test suite
|
|
31
|
+
|
|
32
|
+
## [1.1.0.3] - 2021-01-13
|
|
33
|
+
### Added
|
|
34
|
+
- Reformating code with Prettier-ruby
|
|
14
35
|
|
|
15
36
|
## [1.1.0.2] - 2021-01-08
|
|
16
37
|
### Changed
|
|
17
38
|
- Wrapping silent in_context in anonymous contexts
|
|
18
39
|
|
|
40
|
+
## [1.1.0.1] - 2020-12-27
|
|
41
|
+
This is a release in order to test all type of actions
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- Cache support in github actions for ease of development
|
|
45
|
+
|
|
46
|
+
|
|
19
47
|
## [1.1.0] - 2020-12-27
|
|
20
48
|
### Added
|
|
21
49
|
- **BREAKING** Option to silence in_context block. They used to always wrap themself into a context block with their name. This is not the case anymore. All in_context are silent unless explicitely declared as not.
|
|
@@ -25,7 +53,10 @@ This is a release in order to test all type of actions
|
|
|
25
53
|
- Changelog
|
|
26
54
|
- Support ruby 3.0
|
|
27
55
|
|
|
28
|
-
[Unreleased]: https://github.com/zaratan/rspec_in_context/compare/v1.
|
|
56
|
+
[Unreleased]: https://github.com/zaratan/rspec_in_context/compare/v1.2.0...HEAD
|
|
57
|
+
[1.2.0]: https://github.com/zaratan/rspec_in_context/compare/v1.1.0.3...v1.2.0
|
|
58
|
+
[1.1.0.3]: https://github.com/zaratan/rspec_in_context/compare/v1.1.0.2...v1.1.0.3
|
|
59
|
+
[1.1.0.2]: https://github.com/zaratan/rspec_in_context/compare/v1.1.0.1...v1.1.0.2
|
|
29
60
|
[1.1.0.1]: https://github.com/zaratan/rspec_in_context/releases/tag/v1.1.0.1
|
|
30
61
|
[1.1.0]: https://github.com/zaratan/rspec_in_context/releases/tag/v1.1.0
|
|
31
62
|
[1.0.1.2]: https://github.com/zaratan/rspec_in_context/releases/tag/v1.0.1.2
|
data/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# RspecInContext
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/rspec_in_context)
|
|
4
|
-
[](https://www.codacy.com/gh/zaratan/rspec_in_context/dashboard?utm_source=github.com&utm_medium=referral&utm_content=zaratan/rspec_in_context&utm_campaign=Badge_Grade)
|
|
5
4
|

|
|
6
5
|
|
|
7
6
|
This gem is here to help you write better shared_examples in Rspec.
|
|
@@ -115,8 +114,10 @@ end
|
|
|
115
114
|
|
|
116
115
|
* You can add variable instantiation relative to your test where you exactly want:
|
|
117
116
|
|
|
118
|
-
`
|
|
119
|
-
But it
|
|
117
|
+
`instantiate_context` is an alias of `execute_tests` so you can't use both.
|
|
118
|
+
But it lets you describe what the block will do better.
|
|
119
|
+
|
|
120
|
+
> **Note**: The old spelling `instanciate_context` still works but is deprecated and will emit a warning.
|
|
120
121
|
|
|
121
122
|
#### Variable usage
|
|
122
123
|
|
|
@@ -198,18 +199,18 @@ Or
|
|
|
198
199
|
RSpec.define_context "this is a namespaced context", ns: "namespace name"
|
|
199
200
|
```
|
|
200
201
|
|
|
201
|
-
* When you want to use a namespaced in_context, you have two
|
|
202
|
+
* When you want to use a namespaced in_context, you have two choices:
|
|
202
203
|
|
|
203
|
-
Ignore any namespace and it will try to find a corresponding in_context in
|
|
204
|
+
Ignore any namespace and it will try to find a corresponding in_context in any namespace (the ones defined without namespace have the priority). **Note**: if the same context name exists in multiple namespaces, an `AmbiguousContextName` error will be raised — you must specify the namespace explicitly.
|
|
204
205
|
```ruby
|
|
205
206
|
define_context "namespaced context", ns: "namespace name" do
|
|
206
207
|
[...]
|
|
207
208
|
end
|
|
208
209
|
|
|
209
|
-
in_context "namespaced context"
|
|
210
|
+
in_context "namespaced context" # Works if only one namespace has this name
|
|
210
211
|
```
|
|
211
212
|
|
|
212
|
-
Pass a namespace and it will look only in this
|
|
213
|
+
Pass a namespace and it will look only in this namespace.
|
|
213
214
|
```ruby
|
|
214
215
|
define_context "namespaced context", ns: "namespace name" do
|
|
215
216
|
[...]
|
|
@@ -268,6 +269,24 @@ end
|
|
|
268
269
|
```
|
|
269
270
|
Will print "MyNiceClass with my_var defined works" and "MyNiceClass without my_var defined doesn't work". Which is valid and readable documentation.
|
|
270
271
|
|
|
272
|
+
## Migrating to 1.2.0
|
|
273
|
+
|
|
274
|
+
### Breaking changes
|
|
275
|
+
|
|
276
|
+
- **Ruby >= 3.2 required.** Older Rubies are no longer supported.
|
|
277
|
+
- **`AmbiguousContextName` error.** If the same context name exists in multiple namespaces and you call `in_context` without specifying a namespace, `AmbiguousContextName` is now raised instead of silently picking one. Fix: add `ns:` to disambiguate.
|
|
278
|
+
- **`ActiveSupport` removed.** The gem no longer depends on `activesupport`. This should be transparent, but if you were relying on `HashWithIndifferentAccess` behavior from the gem's internals, note that contexts are now stored in a plain `Hash` with string-normalized keys (symbols and strings still work interchangeably).
|
|
279
|
+
|
|
280
|
+
### Deprecations
|
|
281
|
+
|
|
282
|
+
- **`instanciate_context`** is deprecated (typo). Use `instantiate_context` or `execute_tests` instead. The old method still works but emits a warning to `$stderr`.
|
|
283
|
+
|
|
284
|
+
### New features
|
|
285
|
+
|
|
286
|
+
- **Input validation**: `define_context` now raises `InvalidContextName` (nil/empty name) and `MissingDefinitionBlock` (no block).
|
|
287
|
+
- **`clear_all_contexts!`**: Call `RspecInContext::InContext.clear_all_contexts!` to free all stored contexts for memory cleanup in long-running suites.
|
|
288
|
+
- **Thread-safety**: The context registry is now protected by a Mutex for `parallel_tests` in thread mode.
|
|
289
|
+
|
|
271
290
|
## Development
|
|
272
291
|
|
|
273
292
|
|
data/TODO.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# TODO
|
|
2
|
+
|
|
3
|
+
Issues identified during review of the codebase and PR #21.
|
|
4
|
+
|
|
5
|
+
## PR #21 — Resolved
|
|
6
|
+
|
|
7
|
+
- [x] Stack leak if `find_context` raises — moved `find_context` before `push`
|
|
8
|
+
- [x] Indentation of `spec.metadata` in gemspec — fixed by prettier
|
|
9
|
+
- [ ] `.ruby-version` 4.0.1 vs CI matrix — `head` covers it, revisit if contributor confusion arises
|
|
10
|
+
|
|
11
|
+
## P0 — Before merge
|
|
12
|
+
|
|
13
|
+
- [x] Quote prettier globs in CI — quoted `'lib/**/*.rb'` etc. in both workflow files
|
|
14
|
+
- [x] Gitignore `.rubocop-remote-*.yml` — added pattern to `.gitignore`
|
|
15
|
+
|
|
16
|
+
## P1 — Réduction des dépendances
|
|
17
|
+
|
|
18
|
+
- [x] Retirer `active_support/all` — remplacé `HashWithIndifferentAccess` par `Hash` avec `.to_s` sur les clés, retiré `present?`. Temps de boot des tests : 0.27s → 0.08s
|
|
19
|
+
- [x] Retirer `faker` — retiré de `spec_helper.rb` et `rspec_in_context.gemspec`
|
|
20
|
+
|
|
21
|
+
## P1 — Robustesse face aux internals RSpec
|
|
22
|
+
|
|
23
|
+
- [x] Smoke test pour `hooks.instance_variable_get(:@owner)` — vérifie que `@owner` est non-nil et est une Class
|
|
24
|
+
- [x] Smoke test pour le prepend de `ContextManagement` sur `ExampleGroup.subclass`
|
|
25
|
+
- [x] Resserrer les contraintes de version — `rspec "~> 3.0"`, `rake "~> 13.0"`, `activesupport` retiré
|
|
26
|
+
|
|
27
|
+
## P2 — Qualité de l'API
|
|
28
|
+
|
|
29
|
+
- [x] Ajouter `RspecInContext::Error` comme classe de base — `NoContextFound` et `AmbiguousContextName` en héritent
|
|
30
|
+
- [x] Retirer le `instance_exec` inutile dans `define_context`
|
|
31
|
+
- [x] Corriger les typos dans les commentaires (`find` → `found`, `overriden` → `overridden`, `colisions` → `collisions`)
|
|
32
|
+
- [x] Corriger `instanciate_context` — ajouté `instantiate_context` comme alias principal, l'ancien émet un deprecation warning
|
|
33
|
+
|
|
34
|
+
## P2 — Tests
|
|
35
|
+
|
|
36
|
+
- [x] Renforcer les tests — block delivery guard dynamique (voir `spec/support/block_delivery_guard.rb`) détecte les blocs non-consommés et les groupes vides. Les `expect(true).to be_truthy` restants sont acceptables car le guard couvre la disparition silencieuse.
|
|
37
|
+
- [x] Sémantique de `test_inexisting_context` — vérifiée et documentée. Appelle `find_context` au runtime, qui est la première opération de `in_context`. Le comportement est identique.
|
|
38
|
+
|
|
39
|
+
## P3 — Nice to have
|
|
40
|
+
|
|
41
|
+
- [x] Ajouter `clear_all_contexts!` pour le nettoyage mémoire — `RspecInContext::InContext.clear_all_contexts!` réinitialise le registre. Test ajouté avec sauvegarde/restauration du state.
|
|
42
|
+
- [x] Ajouter un Mutex autour de `@contexts` — `@contexts_mutex` protège l'initialisation et le clear. Thread-safe pour `parallel_tests` en mode thread.
|
|
43
|
+
- [x] Corriger les typos restantes dans les commentaires — fait avec les fixes P2
|
|
44
|
+
- [x] Section migration dans le README — section "Migrating to 1.2.0" ajoutée avec breaking changes, deprecations, et nouvelles features. Mise à jour de la mention `instanciate_context` → `instantiate_context`.
|
|
@@ -6,7 +6,7 @@ module RspecInContext
|
|
|
6
6
|
# @api private
|
|
7
7
|
# prepending a RSpec method so we can know when a describe/context block finish
|
|
8
8
|
# its reading
|
|
9
|
-
def subclass(parent, description, args, registration_collection, &
|
|
9
|
+
def subclass(parent, description, args, registration_collection, &)
|
|
10
10
|
subclass = super
|
|
11
11
|
RspecInContext::InContext.remove_context(subclass)
|
|
12
12
|
subclass
|
|
@@ -2,13 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
# Base module
|
|
4
4
|
module RspecInContext
|
|
5
|
-
#
|
|
6
|
-
class
|
|
5
|
+
# Base error class for all gem errors
|
|
6
|
+
class Error < StandardError
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Error type when no context is found from its name (and eventually namespace)
|
|
10
|
+
class NoContextFound < Error
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Error type when define_context is called without a block
|
|
14
|
+
class MissingDefinitionBlock < ArgumentError
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Error type when context_name is nil or empty
|
|
18
|
+
class InvalidContextName < ArgumentError
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Error type when multiple namespaces contain a context with the same name
|
|
22
|
+
class AmbiguousContextName < Error
|
|
23
|
+
end
|
|
7
24
|
|
|
8
25
|
# Context struct
|
|
9
26
|
# @attr [Proc] block what will be executed in the test context
|
|
10
27
|
# @attr [Class] owner current rspec context class. This will be used to know where a define_context has been defined
|
|
11
|
-
# @attr [String | Symbol] name represent the name by which the context can be
|
|
28
|
+
# @attr [String | Symbol] name represent the name by which the context can be found.
|
|
12
29
|
# @attr [String | Symbol] namespace namespace for context names to avoid collisions
|
|
13
30
|
# @attr [Boolean] silent does the in_context wrap itself into a context with its name or an anonymous context
|
|
14
31
|
Context = Struct.new(:block, :owner, :name, :namespace, :silent)
|
|
@@ -17,6 +34,9 @@ module RspecInContext
|
|
|
17
34
|
module InContext
|
|
18
35
|
# Name of the Global context
|
|
19
36
|
GLOBAL_CONTEXT = :global_context
|
|
37
|
+
# Mutex protecting @contexts for thread-safety (e.g. parallel_tests in thread mode)
|
|
38
|
+
@contexts_mutex = Mutex.new
|
|
39
|
+
|
|
20
40
|
class << self
|
|
21
41
|
# Hook for easier inclusion of the gem in RSpec
|
|
22
42
|
# @api private
|
|
@@ -25,51 +45,105 @@ module RspecInContext
|
|
|
25
45
|
end
|
|
26
46
|
|
|
27
47
|
# Contexts container + creation
|
|
48
|
+
# Keys are normalized to strings so symbols and strings are interchangeable.
|
|
28
49
|
# @api private
|
|
29
50
|
def contexts
|
|
30
|
-
@
|
|
51
|
+
@contexts_mutex.synchronize do
|
|
52
|
+
@contexts ||= Hash.new { |hash, key| hash[key.to_s] = {} }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Remove all stored contexts (both scoped and global).
|
|
57
|
+
# Useful for memory cleanup in long-running test suites with
|
|
58
|
+
# dynamically generated contexts.
|
|
59
|
+
def clear_all_contexts!
|
|
60
|
+
@contexts_mutex.synchronize { @contexts = nil }
|
|
31
61
|
end
|
|
32
62
|
|
|
33
63
|
# Meta method to add a new context
|
|
34
64
|
# @api private
|
|
35
65
|
#
|
|
36
|
-
# @note Will warn if a context is
|
|
37
|
-
|
|
66
|
+
# @note Will warn if a context is overridden
|
|
67
|
+
# @raise [InvalidContextName] if context_name is nil or empty
|
|
68
|
+
# @raise [MissingDefinitionBlock] if no block is provided
|
|
69
|
+
def add_context(
|
|
70
|
+
context_name,
|
|
71
|
+
owner = nil,
|
|
72
|
+
namespace = nil,
|
|
73
|
+
silent = true,
|
|
74
|
+
&block
|
|
75
|
+
)
|
|
76
|
+
if context_name.nil? ||
|
|
77
|
+
(context_name.respond_to?(:empty?) && context_name.empty?)
|
|
78
|
+
raise InvalidContextName, "context_name cannot be nil or empty"
|
|
79
|
+
end
|
|
80
|
+
unless block
|
|
81
|
+
raise MissingDefinitionBlock, "define_context requires a block"
|
|
82
|
+
end
|
|
83
|
+
|
|
38
84
|
namespace ||= GLOBAL_CONTEXT
|
|
39
|
-
|
|
40
|
-
|
|
85
|
+
ns_key = namespace.to_s
|
|
86
|
+
name_key = context_name.to_s
|
|
87
|
+
if contexts.dig(ns_key, name_key)
|
|
88
|
+
warn("Overriding an existing context: #{context_name}@#{namespace}")
|
|
89
|
+
end
|
|
90
|
+
contexts[ns_key][name_key] = Context.new(
|
|
91
|
+
block,
|
|
92
|
+
owner,
|
|
93
|
+
context_name,
|
|
94
|
+
namespace,
|
|
95
|
+
silent,
|
|
96
|
+
)
|
|
41
97
|
end
|
|
42
98
|
|
|
43
99
|
# Find a context.
|
|
44
100
|
# @api private
|
|
101
|
+
# @raise [NoContextFound] if no context is found
|
|
102
|
+
# @raise [AmbiguousContextName] if multiple namespaces contain the same context name
|
|
45
103
|
def find_context(context_name, namespace = nil)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
104
|
+
name_key = context_name.to_s
|
|
105
|
+
result =
|
|
106
|
+
if namespace && !namespace.to_s.empty?
|
|
107
|
+
contexts.dig(namespace.to_s, name_key)
|
|
108
|
+
else
|
|
109
|
+
find_context_across_all_namespaces(name_key)
|
|
110
|
+
end
|
|
111
|
+
result ||
|
|
51
112
|
(raise NoContextFound, "No context found with name #{context_name}")
|
|
52
113
|
end
|
|
53
114
|
|
|
54
115
|
# Look into every namespace to find the context
|
|
116
|
+
# Uses dig to avoid auto-vivifying empty namespace entries
|
|
55
117
|
# @api private
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
118
|
+
# @raise [AmbiguousContextName] if multiple namespaces contain the same context name
|
|
119
|
+
def find_context_across_all_namespaces(name_key)
|
|
120
|
+
matching_namespaces =
|
|
121
|
+
contexts.select do |_, namespaced_contexts|
|
|
122
|
+
namespaced_contexts[name_key]
|
|
123
|
+
end
|
|
124
|
+
if matching_namespaces.size > 1
|
|
125
|
+
namespace_names = matching_namespaces.keys.join(", ")
|
|
126
|
+
raise AmbiguousContextName,
|
|
127
|
+
"Context '#{name_key}' exists in multiple namespaces (#{namespace_names}). " \
|
|
128
|
+
"Please specify a namespace."
|
|
129
|
+
end
|
|
130
|
+
matching_namespaces.values.first&.[](name_key)
|
|
59
131
|
end
|
|
60
132
|
|
|
61
133
|
# @api private
|
|
62
134
|
# Delete a context
|
|
63
135
|
def remove_context(current_class)
|
|
64
136
|
contexts.each_value do |namespaced_contexts|
|
|
65
|
-
namespaced_contexts.delete_if
|
|
137
|
+
namespaced_contexts.delete_if do |_, context|
|
|
138
|
+
context.owner == current_class
|
|
139
|
+
end
|
|
66
140
|
end
|
|
67
141
|
end
|
|
68
142
|
|
|
69
143
|
# @api private
|
|
70
144
|
# Define a context from outside a RSpec.describe block
|
|
71
|
-
def outside_define_context(context_name, namespace, silent, &
|
|
72
|
-
InContext.add_context(context_name, nil, namespace, silent, &
|
|
145
|
+
def outside_define_context(context_name, namespace, silent, &)
|
|
146
|
+
InContext.add_context(context_name, nil, namespace, silent, &)
|
|
73
147
|
end
|
|
74
148
|
end
|
|
75
149
|
|
|
@@ -84,46 +158,69 @@ module RspecInContext
|
|
|
84
158
|
# @param block Content that will be re-injected (see #execute_tests)
|
|
85
159
|
def in_context(context_name, *args, namespace: nil, ns: nil, &block)
|
|
86
160
|
namespace ||= ns
|
|
87
|
-
Thread.current[:test_block] = block
|
|
88
161
|
context_to_exec = InContext.find_context(context_name, namespace)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
162
|
+
Thread.current[:test_block_stack] ||= []
|
|
163
|
+
Thread.current[:test_block_stack].push(block)
|
|
164
|
+
begin
|
|
165
|
+
if context_to_exec.silent
|
|
166
|
+
context { instance_exec(*args, &context_to_exec.block) }
|
|
167
|
+
else
|
|
168
|
+
context(
|
|
169
|
+
context_name.to_s,
|
|
170
|
+
) { instance_exec(*args, &context_to_exec.block) }
|
|
92
171
|
end
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
context(context_name.to_s) do
|
|
96
|
-
instance_exec(*args, &context_to_exec.block)
|
|
172
|
+
ensure
|
|
173
|
+
Thread.current[:test_block_stack].pop
|
|
97
174
|
end
|
|
98
175
|
end
|
|
99
176
|
|
|
100
177
|
# Used in context definition
|
|
101
178
|
# Place where you want to re-inject code passed in argument of in_context
|
|
102
|
-
#
|
|
103
|
-
# For convenience and readability, a `instanciate_context` alias have been defined
|
|
104
179
|
# (for more examples look at tests)
|
|
105
180
|
def execute_tests
|
|
106
|
-
|
|
181
|
+
current_block = Thread.current[:test_block_stack]&.last
|
|
182
|
+
instance_exec(¤t_block) if current_block
|
|
183
|
+
end
|
|
184
|
+
alias instantiate_context execute_tests
|
|
185
|
+
|
|
186
|
+
# @deprecated Use {#instantiate_context} or {#execute_tests} instead
|
|
187
|
+
def instanciate_context
|
|
188
|
+
warn(
|
|
189
|
+
"DEPRECATION: `instanciate_context` is deprecated due to a typo. " \
|
|
190
|
+
"Use `instantiate_context` or `execute_tests` instead.",
|
|
191
|
+
uplevel: 1,
|
|
192
|
+
)
|
|
193
|
+
execute_tests
|
|
107
194
|
end
|
|
108
|
-
alias instanciate_context execute_tests
|
|
109
195
|
|
|
110
196
|
# Let you define a context that can be reused later
|
|
111
197
|
#
|
|
112
198
|
# @param context_name [String, Symbol] The name of the context that will be re-used later
|
|
113
199
|
# @param namespace [String, Symbol] namespace name where the context will be stored.
|
|
114
|
-
# It helps reducing
|
|
200
|
+
# It helps reducing collisions when you define "global" contexts
|
|
115
201
|
# @param ns [String, Symbol] Alias of namespace
|
|
116
202
|
# @param block [Proc] Contain the code that will be injected with #in_context later
|
|
117
203
|
# @param silent [Boolean] Does the in_context wrap itself into a context with its name or an anonymous context
|
|
118
204
|
# @param print_context [Boolean] Reverse alias of silent
|
|
119
205
|
#
|
|
120
206
|
# @note contexts are scoped to the block they are defined in.
|
|
121
|
-
def define_context(
|
|
207
|
+
def define_context(
|
|
208
|
+
context_name,
|
|
209
|
+
namespace: nil,
|
|
210
|
+
ns: nil,
|
|
211
|
+
silent: true,
|
|
212
|
+
print_context: nil,
|
|
213
|
+
&
|
|
214
|
+
)
|
|
122
215
|
namespace ||= ns
|
|
123
|
-
silent = print_context.nil?
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
216
|
+
silent = !print_context unless print_context.nil?
|
|
217
|
+
InContext.add_context(
|
|
218
|
+
context_name,
|
|
219
|
+
hooks.instance_variable_get(:@owner),
|
|
220
|
+
namespace,
|
|
221
|
+
silent,
|
|
222
|
+
&
|
|
223
|
+
)
|
|
127
224
|
end
|
|
128
225
|
end
|
|
129
226
|
end
|
data/lib/rspec_in_context.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'active_support/all'
|
|
4
3
|
require "rspec_in_context/version"
|
|
5
4
|
require "rspec_in_context/in_context"
|
|
6
5
|
require "rspec_in_context/context_management"
|
|
@@ -24,9 +23,16 @@ module RSpec
|
|
|
24
23
|
# @param silent [Boolean] Does the in_context should wrap itself into a context block with its name
|
|
25
24
|
# @param print_context [Boolean] Reverse alias of silent
|
|
26
25
|
# @param block [Proc] code that will be injected later
|
|
27
|
-
def self.define_context(
|
|
26
|
+
def self.define_context(
|
|
27
|
+
name,
|
|
28
|
+
namespace: nil,
|
|
29
|
+
ns: nil,
|
|
30
|
+
silent: true,
|
|
31
|
+
print_context: nil,
|
|
32
|
+
&
|
|
33
|
+
)
|
|
28
34
|
namespace ||= ns
|
|
29
|
-
silent = print_context.nil?
|
|
30
|
-
RspecInContext::InContext.outside_define_context(name, namespace, silent, &
|
|
35
|
+
silent = !print_context unless print_context.nil?
|
|
36
|
+
RspecInContext::InContext.outside_define_context(name, namespace, silent, &)
|
|
31
37
|
end
|
|
32
38
|
end
|
data/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rspec_in_context",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"repository": "git@github.com:denispasin/rspec_in_context.git",
|
|
6
|
+
"author": "Denis <Zaratan> Pasin <zaratan@hey.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@prettier/plugin-ruby": "^4.0",
|
|
10
|
+
"prettier": "^3.8.1"
|
|
11
|
+
},
|
|
12
|
+
"prettier": {
|
|
13
|
+
"trailingComma": "es5",
|
|
14
|
+
"plugins": [
|
|
15
|
+
"@prettier/plugin-ruby"
|
|
16
|
+
],
|
|
17
|
+
"overrides": [
|
|
18
|
+
{
|
|
19
|
+
"files": "*.rb",
|
|
20
|
+
"options": {
|
|
21
|
+
"parser": "ruby"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
data/rspec_in_context.gemspec
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path(
|
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require "rspec_in_context/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name
|
|
9
|
-
spec.version
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
8
|
+
spec.name = "rspec_in_context"
|
|
9
|
+
spec.version = RspecInContext::VERSION
|
|
10
|
+
spec.authors = ["Denis <Zaratan> Pasin"]
|
|
11
|
+
spec.email = ["denis@pasin.fr"]
|
|
12
12
|
|
|
13
|
-
spec.summary
|
|
14
|
-
|
|
13
|
+
spec.summary =
|
|
14
|
+
'This gem is here to help DRYing your tests cases by giving a better "shared_examples".'
|
|
15
|
+
spec.homepage = "https://github.com/denispasin/rspec_in_context"
|
|
15
16
|
|
|
16
17
|
# Specify which files should be added to the gem when it is released.
|
|
17
18
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
18
|
-
spec.files
|
|
19
|
+
spec.files =
|
|
19
20
|
Dir.chdir(File.expand_path(__dir__)) do
|
|
20
|
-
`git ls-files -z`.split("\x0")
|
|
21
|
+
`git ls-files -z`.split("\x0")
|
|
22
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
21
23
|
end
|
|
22
|
-
spec.bindir
|
|
23
|
-
spec.executables
|
|
24
|
+
spec.bindir = "exe"
|
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
26
|
spec.require_paths = ["lib"]
|
|
25
|
-
spec.required_ruby_version =
|
|
26
|
-
spec.license =
|
|
27
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
28
|
+
spec.license = "MIT"
|
|
27
29
|
|
|
28
|
-
spec.add_dependency "
|
|
29
|
-
spec.add_dependency "rspec", "> 3.0"
|
|
30
|
+
spec.add_dependency "rspec", "~> 3.0"
|
|
30
31
|
|
|
31
32
|
spec.add_development_dependency "bundler"
|
|
32
33
|
spec.add_development_dependency "bundler-audit", "> 0.6.0"
|
|
33
|
-
|
|
34
|
-
spec.add_development_dependency "faker", "> 1.8"
|
|
34
|
+
|
|
35
35
|
spec.add_development_dependency "guard-rspec", "> 4.7"
|
|
36
|
-
spec.add_development_dependency "overcommit",
|
|
37
|
-
spec.add_development_dependency "
|
|
36
|
+
spec.add_development_dependency "overcommit", "> 0.46"
|
|
37
|
+
spec.add_development_dependency "prettier"
|
|
38
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
38
39
|
spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
|
|
39
|
-
spec.add_development_dependency "rubocop", "
|
|
40
|
+
spec.add_development_dependency "rubocop", "~> 1.82"
|
|
40
41
|
spec.add_development_dependency "rubocop-performance"
|
|
41
42
|
spec.add_development_dependency "simplecov", "> 0.16"
|
|
42
43
|
spec.add_development_dependency "solargraph"
|
|
43
44
|
spec.add_development_dependency "yard"
|
|
45
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
44
46
|
end
|
data/yarn.lock
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
# yarn lockfile v1
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
"@prettier/plugin-ruby@^4.0":
|
|
6
|
+
version "4.0.4"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-4.0.4.tgz#73d85fc2a1731a3f62b57ac3116cf1c234027cb6"
|
|
8
|
+
integrity sha512-lCpvfS/dQU5WrwN3AQ5vR8qrvj2h5gE41X08NNzAAXvHdM4zwwGRcP2sHSxfu6n6No+ljWCVx95NvJPFTTjCTg==
|
|
9
|
+
|
|
10
|
+
prettier@^3.8.1:
|
|
11
|
+
version "3.8.1"
|
|
12
|
+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.8.1.tgz#edf48977cf991558f4fcbd8a3ba6015ba2a3a173"
|
|
13
|
+
integrity sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==
|
metadata
CHANGED
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec_in_context
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis <Zaratan> Pasin
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: activesupport
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '2.0'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '2.0'
|
|
27
12
|
- !ruby/object:Gem::Dependency
|
|
28
13
|
name: rspec
|
|
29
14
|
requirement: !ruby/object:Gem::Requirement
|
|
30
15
|
requirements:
|
|
31
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
32
17
|
- !ruby/object:Gem::Version
|
|
33
18
|
version: '3.0'
|
|
34
19
|
type: :runtime
|
|
35
20
|
prerelease: false
|
|
36
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
22
|
requirements:
|
|
38
|
-
- - "
|
|
23
|
+
- - "~>"
|
|
39
24
|
- !ruby/object:Gem::Version
|
|
40
25
|
version: '3.0'
|
|
41
26
|
- !ruby/object:Gem::Dependency
|
|
@@ -67,75 +52,61 @@ dependencies:
|
|
|
67
52
|
- !ruby/object:Gem::Version
|
|
68
53
|
version: 0.6.0
|
|
69
54
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: 2.1.0
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: 2.1.0
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: faker
|
|
55
|
+
name: guard-rspec
|
|
85
56
|
requirement: !ruby/object:Gem::Requirement
|
|
86
57
|
requirements:
|
|
87
58
|
- - ">"
|
|
88
59
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
60
|
+
version: '4.7'
|
|
90
61
|
type: :development
|
|
91
62
|
prerelease: false
|
|
92
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
64
|
requirements:
|
|
94
65
|
- - ">"
|
|
95
66
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
67
|
+
version: '4.7'
|
|
97
68
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
69
|
+
name: overcommit
|
|
99
70
|
requirement: !ruby/object:Gem::Requirement
|
|
100
71
|
requirements:
|
|
101
72
|
- - ">"
|
|
102
73
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
74
|
+
version: '0.46'
|
|
104
75
|
type: :development
|
|
105
76
|
prerelease: false
|
|
106
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
78
|
requirements:
|
|
108
79
|
- - ">"
|
|
109
80
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
81
|
+
version: '0.46'
|
|
111
82
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
83
|
+
name: prettier
|
|
113
84
|
requirement: !ruby/object:Gem::Requirement
|
|
114
85
|
requirements:
|
|
115
|
-
- - "
|
|
86
|
+
- - ">="
|
|
116
87
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0
|
|
88
|
+
version: '0'
|
|
118
89
|
type: :development
|
|
119
90
|
prerelease: false
|
|
120
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
92
|
requirements:
|
|
122
|
-
- - "
|
|
93
|
+
- - ">="
|
|
123
94
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0
|
|
95
|
+
version: '0'
|
|
125
96
|
- !ruby/object:Gem::Dependency
|
|
126
97
|
name: rake
|
|
127
98
|
requirement: !ruby/object:Gem::Requirement
|
|
128
99
|
requirements:
|
|
129
100
|
- - "~>"
|
|
130
101
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '
|
|
102
|
+
version: '13.0'
|
|
132
103
|
type: :development
|
|
133
104
|
prerelease: false
|
|
134
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
106
|
requirements:
|
|
136
107
|
- - "~>"
|
|
137
108
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
109
|
+
version: '13.0'
|
|
139
110
|
- !ruby/object:Gem::Dependency
|
|
140
111
|
name: rspec_junit_formatter
|
|
141
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,16 +125,16 @@ dependencies:
|
|
|
154
125
|
name: rubocop
|
|
155
126
|
requirement: !ruby/object:Gem::Requirement
|
|
156
127
|
requirements:
|
|
157
|
-
- - "
|
|
128
|
+
- - "~>"
|
|
158
129
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: '
|
|
130
|
+
version: '1.82'
|
|
160
131
|
type: :development
|
|
161
132
|
prerelease: false
|
|
162
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
134
|
requirements:
|
|
164
|
-
- - "
|
|
135
|
+
- - "~>"
|
|
165
136
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: '
|
|
137
|
+
version: '1.82'
|
|
167
138
|
- !ruby/object:Gem::Dependency
|
|
168
139
|
name: rubocop-performance
|
|
169
140
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -220,7 +191,6 @@ dependencies:
|
|
|
220
191
|
- - ">="
|
|
221
192
|
- !ruby/object:Gem::Version
|
|
222
193
|
version: '0'
|
|
223
|
-
description:
|
|
224
194
|
email:
|
|
225
195
|
- denis@pasin.fr
|
|
226
196
|
executables: []
|
|
@@ -233,8 +203,10 @@ files:
|
|
|
233
203
|
- ".github/workflows/verify_version_change.yml"
|
|
234
204
|
- ".gitignore"
|
|
235
205
|
- ".overcommit.yml"
|
|
206
|
+
- ".prettierrc.js"
|
|
236
207
|
- ".rspec"
|
|
237
208
|
- ".rubocop-http---relaxed-ruby-style-rubocop-yml"
|
|
209
|
+
- ".rubocop-remote-fc7fff8f41d19bde0dcc446ded612e75.yml"
|
|
238
210
|
- ".rubocop.yml"
|
|
239
211
|
- ".ruby-gemset"
|
|
240
212
|
- ".ruby-version"
|
|
@@ -243,18 +215,21 @@ files:
|
|
|
243
215
|
- Guardfile
|
|
244
216
|
- README.md
|
|
245
217
|
- Rakefile
|
|
218
|
+
- TODO.md
|
|
246
219
|
- bin/console
|
|
247
220
|
- bin/setup
|
|
248
221
|
- lib/rspec_in_context.rb
|
|
249
222
|
- lib/rspec_in_context/context_management.rb
|
|
250
223
|
- lib/rspec_in_context/in_context.rb
|
|
251
224
|
- lib/rspec_in_context/version.rb
|
|
225
|
+
- package.json
|
|
252
226
|
- rspec_in_context.gemspec
|
|
227
|
+
- yarn.lock
|
|
253
228
|
homepage: https://github.com/denispasin/rspec_in_context
|
|
254
229
|
licenses:
|
|
255
230
|
- MIT
|
|
256
|
-
metadata:
|
|
257
|
-
|
|
231
|
+
metadata:
|
|
232
|
+
rubygems_mfa_required: 'true'
|
|
258
233
|
rdoc_options: []
|
|
259
234
|
require_paths:
|
|
260
235
|
- lib
|
|
@@ -262,15 +237,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
262
237
|
requirements:
|
|
263
238
|
- - ">="
|
|
264
239
|
- !ruby/object:Gem::Version
|
|
265
|
-
version: 2.
|
|
240
|
+
version: 3.2.0
|
|
266
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
242
|
requirements:
|
|
268
243
|
- - ">="
|
|
269
244
|
- !ruby/object:Gem::Version
|
|
270
245
|
version: '0'
|
|
271
246
|
requirements: []
|
|
272
|
-
rubygems_version: 3.
|
|
273
|
-
signing_key:
|
|
247
|
+
rubygems_version: 3.6.9
|
|
274
248
|
specification_version: 4
|
|
275
249
|
summary: This gem is here to help DRYing your tests cases by giving a better "shared_examples".
|
|
276
250
|
test_files: []
|