Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


[ENHANCEMENT] Set trim mode to honor dash #840

hron84 opened this Issue · 6 comments

4 participants


It would be nice if .rspec could accept the following snippet:

<% if test -%>
<% end -%>

I'm not quite sure I understand this. Can you expand your request a little?


If I understand correctly, erb parsing would produce a single line in this example?


The dash in ERB means no line break. If dash is at the ERB tag opening then no line break before the code if at end, not line break after.

So in the previous example: if test fails, it produces one line instead of two empty line + one line (--another-option), if test succeeds it produces two line instead of four with two empty (1st and 3rd).


We're rendering the .rspec file as ERB using the main ERB rendering API documented on the rdoc page. Not sure what else we can do here.

I think the ERB rendering is nice but this seems like a bit of an abuse of it, honestly. If you want conditional options I recommend you put them in an RSpec.configure block because then you're 100% in ruby land and there's no weird ruby/ERB/options-parsing semantics.

Alternately, you can put personal options in ~/.rspec or your personal options for one project in .rspec-local.

Do these meet your needs, @hron84?


I mean to this. My problem is not with options, but with parsing .rspec file itself.


I added a PR to this topic, see #846

@soulcutter soulcutter referenced this issue from a commit in soulcutter/rspec-core
@hron84 hron84 Adding trim option to ERB, closes #840 9adfb51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.