Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing method to RSpec3 formatter #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

temyers
Copy link

@temyers temyers commented Mar 8, 2017

Hi, this is a bit of a pre-emptive pull request, as I'd like a bit of guidance, and wasn't sure what to put into an issue, or what the specs should be.

I encountered the following issue when adding the ci_reporter to a project that contains specs that executes rake and specifically looks for the --format documentation output

 +/home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:186:in `block in duplicate_formatter_exists?': undefined method `output' for #<CI::Reporter::RSpec3::Formatter:0x0000000266db98> (NoMethodError)
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:185:in `any?'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:185:in `duplicate_formatter_exists?'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:178:in `register'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/formatters.rb:147:in `add'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:828:in `add_formatter'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:117:in `block in load_formatters_into'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:117:in `each'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:117:in `load_formatters_into'
       +	from /home/vagrant/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.5.4/lib/rspec/core/configuration_options.rb:23:in `configure'

I have a spec file containing:

RSpec.describe "My project" do
  def command(cmd)
    Bundler.with_clean_env do
      # Redirect stderr to stdout for simple command execution
      return `#{cmd} 2>&1`
    end
  end

  # ...

  it "should output with --format documentation" do
        expect(command("rake spec")).to include "should package myApp (FAILED - 1)"
   end

end

executing rake or rspec directly works as expected, but with the ci_reporter it fails.

This is only a partial implementation, since with the patch, the tests still fail because the documentation formatter is not used.

Should this be supported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant