May expect { ... }.to_not be changed to expect { ... }.not_to?

Hi, I’m Takumi Tsunokake.

I think
expect { … }.not_to rails_error
is more grammatical and natural than
expect { … }.to_not rails_error

Are there any backgrounds and reasons of decision for expect
{ … }.to_not, not expect { … }.not_to?

I’m happy if expect { … }.to_not is changed to expect
{ … }.not_to.

Best Regards :slight_smile:


Takumi Tsunokake


@bekkou68

On Sep 7, 2010, at 10:35 PM, Takumi Tsunokake wrote:

Hi, I’m Takumi Tsunokake.

I think
expect { … }.not_to rails_error
is more grammatical and natural than
expect { … }.to_not rails_error

I think you mean raise_error (I’ve made the same mistake a few times).
I’m pretty sure they’re equally valid, grammatically speaking:

Expect x not to y
Expect x to not y

Are there any backgrounds and reasons of decision for expect
{ … }.to_not, not expect { … }.not_to?

I’m happy if expect { … }.to_not is changed to expect
{ … }.not_to.

It’s because it aligns better with should[not]. I think it would be
more confusing if we had [not
]to and [should_]not.

HTH,
David

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs