Question

in my rspec tests i have quite a few deep nested contexts like these:

describe "#mymethod"
  it_behaves_like "specific object"
end

shared_examples_for "specific object" do
  context "when it receives proper parameters" do
    context "when file is in a queue" do
      it "behaves as i want it to" do
       #...
    end
  end
end

as a result when i run my rspec tests i get results like those (or more complex) in sections "Pending"/"Failures"/"Failed examples":

mymethod behaves like specific object when it receives proper parameters when file is in a queue behaves as i want it to

those context strings sometimes tend to be unreadable for the lack of separators.

how can i monkey patch rspec to add them (f.ex. "|") automatically (or is there another preferred solution)? where do descriptor strings get concatenated in rspec?

Was it helpful?

Solution

RSpec has the notion of a separator hard-coded. Unfortunately, it is not configurable right now, but I guess the maintainers would consider a patch for review.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top