Skip to content

Instantly share code, notes, and snippets.

@hidakatsuya
Last active February 17, 2022 05:28
Show Gist options
  • Save hidakatsuya/d976711de32b47da6d6b8bff4cb799c8 to your computer and use it in GitHub Desktop.
Save hidakatsuya/d976711de32b47da6d6b8bff4cb799c8 to your computer and use it in GitHub Desktop.
RSpec の spec の構造のみ出力するコマンド

RSpec の spec ファイルの構造のみ出力する

git grep -h -E "([^\._](describe|context|it) '.+' do|it_behaves_like .*$)" -- spec/path/to/*_spec.rb

Output:

describe 'a' do
  it 'aa' do
describe 'b' do
  context 'bbb1' do
    it 'bbb1b' do
  context 'bbb2' do
    it 'bbb2b' do
describe 'c' do
  it_behave_like 'cc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment