-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Add step and API to add whole lines to a file #780
Conversation
607f376
to
50bc4c1
Compare
@@ -26,6 +26,28 @@ Feature: Append content to file | |||
When I run `cucumber` | |||
Then the features should all pass | |||
|
|||
Scenario: Append whole lines to a existing file |
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.
An existing
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.
Looks good! Found an easy typo.
Due to how multi-line string literals work in Gherkin, it is easy to accidentally have fewer newlines than intended when building up a file using append_to_file. To mitigate this while still allowing building up files without inserted newlines, this change introduces a new API method #append_lines_to_file and a corresponding step definition, that will ensure a newline is present between the original content and the added content.
50bc4c1
to
ac69b3e
Compare
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.
Wanted to say YAY you have such drive!
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.
Minor refactor, not needed here. Do if you want.
spec/aruba/api/filesystem_spec.rb
Outdated
@@ -4,6 +4,23 @@ | |||
RSpec.describe Aruba::Api::Filesystem do | |||
include_context "uses aruba API" | |||
|
|||
describe "#append_lines_to_file" do | |||
let(:path) { @file_path } |
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.
pop these as top level? Seem to be used in nearly all of the examples (I scrolled down past L40)
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.
That makes sense, yes.
adef003
to
99e13be
Compare
99e13be
to
6b65b2e
Compare
Summary
Add step and API to add whole lines to a file
Details
Due to how multi-line string literals work in Gherkin, it is easy to accidentally have fewer newlines than intended when building up a file using append_to_file.
To mitigate this while still allowing building up files without inserted newlines, this change introduces a new API method
#append_lines_to_file
and a corresponding step definition, that will ensure a newline is present between the original content and the added content.Motivation and Context
Fixes #662.
How Has This Been Tested?
A new Cucumber scenario and RSpec specs were added.
Types of changes
Checklist: