To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!More about adding a collaborator
RSpec ships with general purpose output formatters. You can tell RSpec which
one to use using the
--format command line option.
When RSpec's built-in output formatters don't, however, give you everything
you need, you can write your own custom formatter and tell RSpec to use that
one instead. The simplest way is to subclass RSpec's
then override just the methods that you want to modify.
- Custom formatter
a file named "custom_formatter.rb" with:
class CustomFormatter # This registers the notifications this formatter supports, and tells # us that this was written against the RSpec 3.x formatter API. RSpec::Core::Formatters.register self, :example_started def initialize(output) @output = output end def example_started(notification) @output << "example: " << notification.example.description end end
a file named "example_spec.rb" with:
RSpec.describe "my group" do specify "my example" do end end
rspec example_spec.rb --require ./custom_formatter.rb --format CustomFormatter
- the output should contain "example: my example"
- the exit status should be 0
Last published over 5 years ago by myronmarston.
RSpec Core settings