-
Notifications
You must be signed in to change notification settings - Fork 17
Adds a newline at the very end of the authorized_keys file #9
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,12 +49,10 @@ | |
| end | ||
| end | ||
|
|
||
| it 'does not leave a blank line' do | ||
| it 'includes a newline after the last key' do | ||
| subject.write! keys | ||
|
|
||
| expect( | ||
| keys_file.readlines.select { |line| line =~ /^$\n/ } | ||
| ).to be_empty | ||
| expect(keys_file.read).to end_with("\n") | ||
| end | ||
| end | ||
|
|
||
|
|
@@ -80,6 +78,7 @@ | |
|
|
||
| before do | ||
| keys_file.write existing_keys.join("\n") | ||
| keys_file.write "\n" | ||
| keys_file.rewind | ||
| end | ||
|
|
||
|
|
@@ -132,6 +131,7 @@ | |
|
|
||
| before do | ||
| keys_file.write keys.join("\n") | ||
| keys_file.write "\n" | ||
| keys_file.rewind | ||
| end | ||
|
|
||
|
|
@@ -152,12 +152,10 @@ | |
| end | ||
| end | ||
|
|
||
| it 'does not leave a blank line' do | ||
| subject.delete! key | ||
| it 'includes a newline after the last key' do | ||
| subject.write! keys | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, oops. Looks like a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, my bad, nice catch. C&P error. I'll fix shortly.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fixed this in 4dd6f26, no worries. ❤️
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for wrapping this up 🎊 |
||
|
|
||
| expect( | ||
| keys_file.readlines.select { |line| line =~ /^$\n/ } | ||
| ).to be_empty | ||
| expect(keys_file.read).to end_with("\n") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might need to update this test to satisfy content = keys_file.read
expect(content).to end_with("\n") unless content.empty? |
||
| end | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still want a newline if
content.empty?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually - scratch that. We don't need a newline if the content is empty 😄