15

I'm using Rspec to test a rails app.

Is there a way to list all the pending examples without running the full test suite?

deb
  • 12,326
  • 21
  • 67
  • 86

3 Answers3

11

Run the rspec command passing --tag pending

For example: bundle exec rspec spec --tag pending

dogenpunk
  • 4,332
  • 1
  • 21
  • 29
  • 1
    I love this answer, but it won't list specs which have `pending` calls inside `it` blocks. This is not necessarily disadvantage, but it's good to be aware of that. – skalee Oct 02 '12 at 15:41
  • 5
    `bundle exec rspec spec` says I have 15 pending examples, but adding `--tag pending` I just get `All examples were filtered out`. Whatever this is doing, it's not listing all pending examples. – David Moles Oct 16 '15 at 22:24
6

For rspec 3.9, spec --dry-run is what I wanted.

me@host> bundle exec rspec -v
RSpec 3.9
  - rspec-core 3.9.2
  - rspec-expectations 3.9.1
  - rspec-mocks 3.9.1
  - rspec-rails 4.0.0.beta3
  - rspec-support 3.9.3

me@host> bundle exec rspec spec --dry-run
Randomized with seed 17761
...........................****..............................................................................................................................................................................*******................................................................................................................*****.*.*...................................................................................................................

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Klass completed
     # Not yet implemented
     # ./spec/models/klass.rb:79

  2) Klass completed with errors
     # Not yet implemented
     # ./spec/models/klass.rb:103
spyle
  • 1,960
  • 26
  • 23
1

When you have

it 'does something'

lines without an actual spec block for it, you can simply find them through the search functionality of your editor and the power of regular expressions:

^ *it{1} {1}('|").*{1}('|")\n

To test the regexp it you could use http://rubular.com/. It always helped me with building regular expressions.

jo.
  • 53
  • 5