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

Already on GitHub? Sign in to your account

prepend spec class name to <testsuite name=""> #23

Closed
morganchristiansson opened this Issue Feb 10, 2011 · 2 comments

Comments

Projects
None yet
3 participants

Hi.

We wanted the results to be grouped by the name of the spec file in hudson and ended up writing this monkeypatch:

module CI::Reporter
  class RSpec
    def description_for_with_classname(name_or_example)
      spec_name(name_or_example)+description_for_without_classname(name_or_example)
    end
    alias_method_chain :description_for, :classname
    def spec_name(name_or_example)
      m = %r{spec/(?:controllers|models)/(.*_spec).rb}.match(name_or_example.location)
      m&&(m[1].camelize+".")||""
    end
  end
end

Perhaps something that would be interesting to merge back into ci_reporter? Let me know if you have further questions.

Regards,
Morgan

Thanks, that was useful. For anyone else trying to do something similar, I thought I'd point out that I had to use name_or_example.file_path rather than name_or_example.location - maybe an rspec 2.8 thing?

@shepmaster shepmaster removed the 1.7.0 label Jun 3, 2014

Owner

shepmaster commented Jun 12, 2014

Thanks for the suggestion. If you'd like to see this in a recent version, please feel free to submit a pull request! I'm going to close this for now.

@shepmaster shepmaster closed this Jun 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment