-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit ddffa6c Author: Code Manager <code_manager@agent-694ff4-0> Date: Tue Oct 10 13:11:34 2023 +0000 Fix undefined local 'path' Fixed failing tests after refactoring around(:all) into before/after(:all): ``Failure/Error: FileUtils.rm_f(path) NameError: undefined local variable or method `path'...`` commit 10821c5 Author: Gavin Didrichsen <[email protected]> Date: Thu Oct 5 21:00:17 2023 +0100 (CAT-1488) - Fix some rubocop warnings Signed-off-by: Gavin Didrichsen <[email protected]> commit 831c41d Author: Gavin Didrichsen <[email protected]> Date: Thu Oct 5 20:34:03 2023 +0100 (CAT-1488) - Split around(:all) into before/after(:all) This fixes duplicate code warnings occurring during the acceptance tests. Signed-off-by: Gavin Didrichsen <[email protected]> commit d2cec4b Author: Gavin Didrichsen <[email protected]> Date: Thu Oct 5 20:32:51 2023 +0100 (CAT-1488) - Refactor duplicated shared examples and context This fixes duplicate definition warnings in the acceptance tests. Signed-off-by: Gavin Didrichsen <[email protected]>
- Loading branch information
1 parent
cdfcf11
commit 3168827
Showing
6 changed files
with
43 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
RSpec.shared_examples 'a saved configuration file' do |new_content| | ||
it 'saves the setting' do | ||
# Force the command to run if not already | ||
subject.exit_status | ||
expect(File).to exist(ENV.fetch('PDK_ANSWER_FILE', nil)) | ||
|
||
actual_content = File.open(ENV.fetch('PDK_ANSWER_FILE', nil), 'rb:utf-8', &:read) | ||
expect(actual_content).to eq(new_content) | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
spec/acceptance/support/a_saved_json_configuration_file.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
RSpec.shared_examples 'a saved JSON configuration file' do |new_json_content| | ||
it 'saves the setting' do | ||
# Force the command to run if not already | ||
subject.exit_status | ||
expect(File).to exist(ENV.fetch('PDK_ANSWER_FILE', nil)) | ||
|
||
actual_content_raw = File.open(ENV.fetch('PDK_ANSWER_FILE', nil), 'rb:utf-8', &:read) | ||
actual_json_content = JSON.parse(actual_content_raw) | ||
expect(actual_json_content).to eq(new_json_content) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
RSpec.shared_context 'with a fake answer file' do |initial_content = nil| | ||
before(:all) do | ||
fake_answer_file = Tempfile.new('mock_answers.json') | ||
unless initial_content.nil? | ||
require 'json' | ||
fake_answer_file.binmode | ||
fake_answer_file.write(JSON.pretty_generate(initial_content)) | ||
end | ||
fake_answer_file.close | ||
ENV['PDK_ANSWER_FILE'] = fake_answer_file.path | ||
end | ||
|
||
after(:all) do | ||
FileUtils.rm_f(ENV.fetch('PDK_ANSWER_FILE', nil)) # Need actual file calls here | ||
ENV.delete('PDK_ANSWER_FILE') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters