Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-20.04 ]
ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0', '3.1' ]
ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2' ]
include:
- os: macos-latest
ruby: '2.7'
Expand Down
2 changes: 1 addition & 1 deletion lib/stack_master/commands/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def check_files

if !@options.overwrite
[@stack_master_filename, @stack_json_filename, @parameters_filename, @region_parameters_filename].each do |filename|
if File.exists?(filename)
if File.exist?(filename)
StackMaster.stderr.puts("Aborting: #{filename} already exists. Use --overwrite to force overwriting file.")
return false
end
Expand Down
2 changes: 1 addition & 1 deletion lib/stack_master/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def self.search_up_and_chdir(config_file)

dir = Dir.pwd
parent_dir = File.expand_path("..", Dir.pwd)
while parent_dir != dir && !File.exists?(File.join(dir, config_file))
while parent_dir != dir && !File.exist?(File.join(dir, config_file))
dir = parent_dir
parent_dir = File.expand_path("..", dir)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/stack_master/parameter_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.load(parameter_files: [], parameters: {})
private

def self.load_parameters(file_name)
file_exists = File.exists?(file_name)
file_exists = File.exist?(file_name)
StackMaster.debug file_exists ? " #{file_name} found" : " #{file_name} not found"
file_exists ? load_file(file_name) : {}
end
Expand Down
4 changes: 0 additions & 4 deletions spec/stack_master/aws_driver/s3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
end

describe '#upload_files' do
before do
allow(File).to receive(:read).and_return('file content')
end

Comment on lines -12 to -15
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid stubbing File.read. This resolves the flaky behaviour in CI.

context 'when set_region is called' do
it 'defaults to that region' do
s3_driver.set_region('default')
Expand Down
2 changes: 1 addition & 1 deletion spec/stack_master/parameter_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
end

def file_mock(file_name, exists: false, read: nil)
allow(File).to receive(:exists?).with(file_name).and_return(exists)
allow(File).to receive(:exist?).with(file_name).and_return(exists)
allow(File).to receive(:read).with(file_name).and_return(read) if read
end

Expand Down
2 changes: 1 addition & 1 deletion spec/stack_master/parameter_resolvers/one_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
it 'we return an error' do
allow_any_instance_of(described_class).to receive(:`).with("op --version").and_return(true)
allow_any_instance_of(described_class).to receive(:`).with("op get item --vault='Shared' 'password title' 2>&1").and_return('{key: value }')
expect { resolver.resolve(the_password) }.to raise_error(StackMaster::ParameterResolvers::OnePassword::OnePasswordInvalidResponse, /Failed to parse JSON returned, {key: value }: \d+: unexpected token at '{key: value }'/)
expect { resolver.resolve(the_password) }.to raise_error(StackMaster::ParameterResolvers::OnePassword::OnePasswordInvalidResponse, /Failed to parse JSON returned, {key: value }:.* unexpected token at '{key: value }'/)
Copy link
Member Author

Choose a reason for hiding this comment

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

Be more lenient with the error message expectation here. Different versions of Ruby provide slightly different error messages.

end
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/stack_master/parameter_resolvers/stack_output_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def resolve(value)
let(:outputs) { [] }

before do
allow(StackMaster.cloud_formation_driver).to receive(:region).and_return(region)
Copy link
Member Author

Choose a reason for hiding this comment

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

Stub out the default AWS region. This prevents specs failing in development environments where the default
region is not us-east-1.

allow(Aws::CloudFormation::Client).to receive(:new).and_return(cf)
cf.stub_responses(:describe_stacks, { stacks: stacks })
end
Expand Down