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

Avoid line continuations without parentheses. #138

Merged
merged 1 commit into from
Mar 13, 2018

Conversation

nickcharlton
Copy link
Member

This causes unexpected behaviour: The not_to spec will always pass,
whilst the to include specs don't test for the presence of the command
line, rather nothing. This is because Ruby treats the include as having no
argument and the string below as a string literal.

If we wrap in parentheses, the positive spec fails as the path is
relative to the root partition.

The solution here is to provide a full path when comparing
gemfile='...'. This also fixes a broken expectation where not_to and
to were flipped.

This causes unexpected behaviour: The `not_to` spec will always pass,
whilst the `to include` specs don't test for the presence of the command
line, rather nothing. This is because Ruby treats the `include` as having no
argument and the string below as a string literal.

If we wrap in parentheses, the positive spec fails as the path is
relative to the root partition.

The solution here is to provide a full path when comparing
`gemfile='...'`. This also fixes a broken expectation where `not_to` and
`to` were flipped.
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=0')
expect(output).not_to include(
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=1')
"bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see Hound is not enabled, so this line (and similar ones above) is not being barked at for not ending on a comma. Is that ok by you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, that's an error under Ruby 1.8.7, which is still being run in CI. Removing the trailing comma fixes this.

One option here would be to first go about dropping support for 1.8.7. What do you think?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. One one hand, I'm for dropping 1.8.7, but on the other hand I don't find coding style a good enough reason for it.

I'm happy to leave it as is for now.

expect(content_of 'gemfiles/1.0.0.gemfile.lock').not_to include
current_directory
expect(content_of("gemfiles/1.0.0.gemfile.lock")).
not_to include(current_directory)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve 👍 This code is 43.7% better without this ambiguity.

@nickcharlton nickcharlton merged commit 8382afa into master Mar 13, 2018
@nickcharlton nickcharlton deleted the nc-fix-acceptance-tests branch March 13, 2018 14:07
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.

2 participants