/usr/share/doc/ruby-rspec-core/features/command_line/format_option.feature is in ruby-rspec-core 3.7.0c1e0m0s1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | Feature: `--format` option
Use the `--format` option to tell RSpec how to format the output.
RSpec ships with several formatters built in. By default, it uses the progress
formatter, which generates output like this:
....F.....*.....
A '.' represents a passing example, 'F' is failing, and '*' is pending.
Use the documentation formatter to see the documentation strings passed to
`describe`, `it`, and their aliases:
```bash
$ rspec spec --format documentation
```
You can also specify an output target (`$stdout` by default) with an `--out`
option immediately following the `--format` option:
```bash
$ rspec spec --format documentation --out rspec.txt
```
Run `rspec --help` to see a listing of available formatters.
Background:
Given a file named "example_spec.rb" with:
"""ruby
RSpec.describe "something" do
it "does something that passes" do
expect(5).to eq(5)
end
it "does something that fails" do
expect(5).to eq(4)
end
it "does something that is pending", :pending => true do
expect(5).to be < 3
end
it "does something that is skipped", :skip => true do
expect(5).to be < 3
end
end
"""
Scenario: Progress bar format (default)
When I run `rspec --format progress example_spec.rb`
Then the output should contain ".F**"
Scenario: Documentation format
When I run `rspec example_spec.rb --format documentation`
Then the output should contain:
"""
something
does something that passes
does something that fails (FAILED - 1)
does something that is pending (PENDING: No reason given)
does something that is skipped (PENDING: No reason given)
"""
Scenario: Documentation format saved to a file
When I run `rspec example_spec.rb --format documentation --out rspec.txt`
Then the file "rspec.txt" should contain:
"""
something
does something that passes
does something that fails (FAILED - 1)
does something that is pending (PENDING: No reason given)
does something that is skipped (PENDING: No reason given)
"""
Scenario: Multiple formats and output targets
When I run `rspec example_spec.rb --format progress --format documentation --out rspec.txt`
Then the output should contain ".F**"
And the file "rspec.txt" should contain:
"""
something
does something that passes
does something that fails (FAILED - 1)
does something that is pending (PENDING: No reason given)
does something that is skipped (PENDING: No reason given)
"""
|