rspec_in_context 1.2.1 → 1.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e63cf4bd9f911ee7f0434682e2b104578555086eba35590ff0c8d72214ef2f48
4
- data.tar.gz: d4737b49923e3a8080603987f4c490d19ed798f824ce0822dd0e349028683c79
3
+ metadata.gz: 7918c6472d5f4c9db81dc1ab9d715672a0b778e7f1c274328670c2ae94974239
4
+ data.tar.gz: 10c7ab93e0dce21ad6dd59c8afec5e8f95e7efcd5e4c083b59e37a99d780d546
5
5
  SHA512:
6
- metadata.gz: 589321b198f19691378d28b67aa92beb237ba1bf6ceca7f78fc6fee08ad983cf94467ce4b288007ae98e825ab57aaa441c872ee3a0234d674b88e7e733d2a762
7
- data.tar.gz: fac8b3dd1d6bb726f51fdd3377fcdf10092129d0e005bbd3133ff7169bd6dcf4a22fdedb97dc77602890b489014e2105e76b82c0a8480316d00250802a4b026f
6
+ metadata.gz: 1637e8eabdae200bca8c7d347c49d4f4e275c3792a9e655dcf01e07d61fbe93140645cedf7b575ce181ed17b874e3318fc67bb8593388a2034726d52f9704f61
7
+ data.tar.gz: 556f30fa702e4d72ec25d9ffc047876ea5595448bec06174cdf75b9071a2f20fd4927bc518683b005b83e2d9a1b53438d035afa7f1af9eb569451242b0646eed
data/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,58 +7,81 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [1.2.2] - 2026-04-21
11
+
12
+ ### Changed
13
+
14
+ - silent in_context now doesn't increment group level and i truly silent
15
+
9
16
  ## [1.2.1] - 2026-03-05
17
+
10
18
  ### Added
19
+
11
20
  - `LLMS.md` — comprehensive API reference for LLMs
12
21
  - `examples/` directory with real-world usage patterns (contexts and specs)
13
22
 
14
23
  ### Changed
24
+
15
25
  - Complete rewrite of `README.md` with better structure, real-world examples, and comparison with `shared_examples`
16
26
 
17
27
  ## [1.2.0] - 2026-01-27
28
+
18
29
  ### Breaking
30
+
19
31
  - **BREAKING** Minimum Ruby version is now 3.2
20
32
  - **BREAKING** `in_context` without namespace now raises `AmbiguousContextName` if the same context name exists in multiple namespaces. Specify the namespace explicitly to resolve.
21
33
  - Removed `codacy-coverage` dependency (incompatible with Ruby 4)
22
34
 
23
35
  ### Added
36
+
24
37
  - Nested `in_context` with blocks now work correctly (uses a stack instead of a single thread-local variable)
25
38
  - Input validation: `define_context` raises `InvalidContextName` for nil/empty names and `MissingDefinitionBlock` when no block is given
26
39
  - `AmbiguousContextName` error when a context name exists in multiple namespaces and no namespace is specified
27
40
 
28
41
  ### Changed
42
+
29
43
  - CI now tests Ruby 3.2, 3.3, 3.4, and head
30
44
  - GitHub Actions updated to v4 (checkout, setup-node)
31
45
  - Node updated to 20 in CI
32
46
  - Rubocop config uses `plugins` instead of deprecated `require`
33
47
 
34
48
  ### Fixed
49
+
35
50
  - Thread-safety for nested `in_context` calls with blocks (previous implementation silently overwrote the outer block)
36
51
  - Non-deterministic context resolution when multiple namespaces contained the same context name
37
52
  - Tests no longer depend on execution order (random order enabled)
38
53
  - Removed all global variables from test suite
39
54
 
40
55
  ## [1.1.0.3] - 2021-01-13
56
+
41
57
  ### Added
58
+
42
59
  - Reformating code with Prettier-ruby
43
60
 
44
61
  ## [1.1.0.2] - 2021-01-08
62
+
45
63
  ### Changed
64
+
46
65
  - Wrapping silent in_context in anonymous contexts
47
66
 
48
67
  ## [1.1.0.1] - 2020-12-27
68
+
49
69
  This is a release in order to test all type of actions
50
70
 
51
71
  ### Added
52
- - Cache support in github actions for ease of development
53
72
 
73
+ - Cache support in github actions for ease of development
54
74
 
55
75
  ## [1.1.0] - 2020-12-27
76
+
56
77
  ### Added
57
- - **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.
78
+
79
+ - **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.
58
80
 
59
81
  ## [1.0.1.2] - 2020-12-26
82
+
60
83
  ### Added
84
+
61
85
  - Changelog
62
86
  - Support ruby 3.0
63
87
 
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RspecInContext
4
+ module Formatters
5
+ # Prepended onto RSpec::Core::Formatters::DocumentationFormatter to
6
+ # hide the anonymous context wrappers that silent in_context creates.
7
+ #
8
+ # Without this patch, each silent in_context adds a blank line and an
9
+ # extra indentation level to --format documentation output.
10
+ module DocumentationFormatterPatch
11
+ def example_group_started(notification)
12
+ group = notification.group
13
+ # Double check: metadata + empty description.
14
+ # RSpec metadata inherits to children, but notification.group.description
15
+ # returns the group's OWN description (not the inherited/concatenated one).
16
+ # So named sub-contexts (non-empty description) pass through to super normally.
17
+ if group.metadata[:rspec_in_context_silent] == true &&
18
+ group.description.strip.empty?
19
+ return
20
+ end
21
+
22
+ super
23
+ end
24
+
25
+ def example_group_finished(notification)
26
+ group = notification.group
27
+ if group.metadata[:rspec_in_context_silent] == true &&
28
+ group.description.strip.empty?
29
+ return
30
+ end
31
+
32
+ super
33
+ end
34
+ end
35
+ end
36
+ end
@@ -161,7 +161,9 @@ module RspecInContext
161
161
  Thread.current[:test_block_stack].push(block)
162
162
  begin
163
163
  if context_to_exec.silent
164
- context { instance_exec(*args, &context_to_exec.block) }
164
+ context("", rspec_in_context_silent: true) do
165
+ instance_exec(*args, &context_to_exec.block)
166
+ end
165
167
  else
166
168
  context(
167
169
  context_name.to_s,
@@ -1,4 +1,4 @@
1
1
  module RspecInContext
2
2
  # Version of the gem
3
- VERSION = "1.2.1".freeze
3
+ VERSION = "1.2.2".freeze
4
4
  end
@@ -1,6 +1,13 @@
1
1
  require "rspec_in_context/version"
2
2
  require "rspec_in_context/in_context"
3
3
  require "rspec_in_context/context_management"
4
+ require "rspec_in_context/formatters/documentation_formatter_patch"
5
+
6
+ if defined?(RSpec::Core::Formatters::DocumentationFormatter)
7
+ RSpec::Core::Formatters::DocumentationFormatter.prepend(
8
+ RspecInContext::Formatters::DocumentationFormatterPatch,
9
+ )
10
+ end
4
11
 
5
12
  # Main wrapping module
6
13
  module RspecInContext
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_in_context
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis <Zaratan> Pasin
@@ -232,6 +232,7 @@ files:
232
232
  - examples/usage/request_spec.rb
233
233
  - lib/rspec_in_context.rb
234
234
  - lib/rspec_in_context/context_management.rb
235
+ - lib/rspec_in_context/formatters/documentation_formatter_patch.rb
235
236
  - lib/rspec_in_context/in_context.rb
236
237
  - lib/rspec_in_context/version.rb
237
238
  - package.json