Is there a way (maybe some key) to tell rspec to skip pending tests and don't print information about them?
I have some auto generated tests like
pending "add some examples to (or delete) #{__FILE__}"
I run "bundle exec rspec spec/models --format documentation" and get somethin like this:
Rating
allows to rate first time
disallow to rate book twice
Customer
add some examples to (or delete) /home/richelieu/Code/first_model/spec/models/customer_spec.rb (PENDING: No reason given)
Category
add some examples to (or delete) /home/richelieu/Code/first_model/spec/models/category_spec.rb (PENDING: No reason given)
......
I want to keep this files, cause I gonna change them later, but for now I want output like:
Rating
allows to rate first time
disallow to rate book twice
Finished in 0.14011 seconds
10 examples, 0 failures, 8 pending
RSpec offers a number of different ways to indicate that an example is. disabled pending some action. `pending` any arbitrary reason with a failing example. `pending` any arbitrary reason with a passing example.
Running tests by their file or directory names is the most familiar way to run tests with RSpec. RSpec can take a file name or directory name and run the file or the contents of the directory. So you can do: rspec spec/jobs to run the tests found in the jobs directory.
The word describe is an RSpec keyword. It is used to define an “Example Group”. You can think of an “Example Group” as a collection of tests. The describe keyword can take a class name and/or string argument.
Take a look at tags -
You could do something like this in your test file
describe "the test I'm skipping for now" do
it "slow example", :skip => true do
#test here
end
end
and run your tests like this:
bundle exec rspec spec/models --format documentation --tag ~skip
where the ~
character excludes all tests with the following tag, in this case skip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With