You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-20Lines changed: 31 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# RspecTree
2
2
3
-
This is tree commandfor rspec test files.
3
+
`RspecTree` is a command-line tool for displaying the structure of RSpec test files in a tree format. It uses [prism](https://github.com/ruby/prism), the default parser introduced in Ruby 3.4, to parse and traverse the AST.
4
4
5
5
## Installation
6
6
@@ -14,31 +14,42 @@ If bundler is not being used to manage dependencies, install the gem by executin
14
14
15
15
## Usage
16
16
17
-
```
17
+
### Display All Describes, Contexts, and Examples
18
+
19
+
Use the `all` option to print all `describe`, `context`, and `example` blocks in a file:
20
+
21
+
```bash
18
22
$ rspec_tree all /path/to/your_spec.rb
19
-
desc: Sample
20
-
desc: First describe
21
-
├─────ctx: First context
22
-
├───────it: should do something
23
-
├───────ctx: First nested context
24
-
├─────────it: should do something
25
-
├───────it_behaves_like: shared example
26
-
desc: Second describe
27
-
├─────ctx: Second context
28
-
├───────it: should do something else
23
+
desc: SampleClass
24
+
├──desc: First describe
25
+
├────ctx: First context
26
+
├──────ctx: First nested context
27
+
├────────it: should do something
28
+
├──────it: should do something
29
+
├──desc: Second describe
30
+
├────ctx: Second context
31
+
├──────it: should do something else
29
32
```
30
33
31
-
```
34
+
### Display Only Describes and Contexts
35
+
36
+
Use the `ctx` option to print only `describe` and `context` blocks:
37
+
38
+
```bash
32
39
$ rspec_tree ctx /path/to/your_spec.rb
33
-
desc: Sample
34
-
desc: First describe
35
-
├─────ctx: First context
36
-
├───────ctx: First nested context
37
-
desc: Second describe
38
-
├─────ctx: Second context
40
+
desc: SampleClass
41
+
├──desc: First describe
42
+
├────ctx: First context
43
+
├──────ctx: First nested context
44
+
├──desc: Second describe
45
+
├────ctx: Second context
39
46
```
40
47
41
-
```
48
+
### Display Help Information
49
+
50
+
Run the `help` command to see all available commands:
51
+
52
+
```bash
42
53
$ rspec_tree help
43
54
Commands:
44
55
rspec_tree all [file] # Print all (describe, context, it, etc.)
0 commit comments