Commit 1dc1a348 authored by Houssem El Fekih's avatar Houssem El Fekih Committed by Oleksandr Slynko

Changed formatter to inherited from BaseFormatter

* This will help to use multiple formatters. I.e. documentation
* Also fixed rspec_1 support
parent 5552ebcb
......@@ -34,6 +34,7 @@ gem install rspec-instafail
# .rspec
--require rspec/instafail
--format RSpec::Instafail
--format progress # to keep dots appear
```
Alternatives
......
module RSpec
version = Gem.loaded_specs["rspec-core"].version
require "rspec/instafail/rspec_#{[3, version.segments.first].min}"
rescue
require "rspec/instafail/rspec_1"
end
require 'rspec/core/formatters/progress_formatter'
require 'rspec/core/formatters/base_formatter'
module RSpec
class Instafail < RSpec::Core::Formatters::ProgressFormatter
class Instafail < RSpec::Core::Formatters::BaseFormatter
RSpec::Core::Formatters.register self, :example_failed
def initialize(output)
......
......@@ -60,7 +60,7 @@ describe 'RSpec::Instafail' do
context 'Rspec 3.x' do
before :all do
Bundler.with_clean_env do
@rspec_result = `cd spec/rspec_3 && bundle exec rspec a_test.rb -I ../../lib --require rspec/instafail --format RSpec::Instafail --no-color --order defined`
@rspec_result = `cd spec/rspec_3 && bundle exec rspec a_test.rb -I ../../lib --require rspec/instafail --format RSpec::Instafail --format progress --no-color --order defined`
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment