Skip to content

Commit

Permalink
Avoid using <<- in install_instruciton test
Browse files Browse the repository at this point in the history
- Use of `<<-` with leading spaces may lead a problem, but
we cannot use `<<~` introduced in ruby 2.3.0 since we should
support lower versions of ruby.
  • Loading branch information
Ted committed Jan 7, 2019
1 parent 48c5988 commit 3dedbc9
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions test/instance_agent/plugins/codedeploy/install_instruction_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ class InstallInstructionTest < InstanceAgentTestCase
context "Parsing a delete file" do
context "an empty delete file" do
setup do
@parse_string = <<-END
END
@parse_string = ""
end

should "return an empty command collection" do
Expand All @@ -243,9 +242,7 @@ class InstallInstructionTest < InstanceAgentTestCase

context "a single file to delete" do
setup do
@parse_string = <<-END
test_delete_path
END
@parse_string = "test_delete_path\n"
File.stubs(:exist?).with("test_delete_path").returns(true)
end

Expand Down Expand Up @@ -281,10 +278,7 @@ class InstallInstructionTest < InstanceAgentTestCase

context "multiple files to delete" do
setup do
@parse_string = <<-END
test_delete_path
another_delete_path
END
@parse_string = "test_delete_path\nanother_delete_path\n"
File.stubs(:directory?).returns(false)
File.stubs(:exist?).with("test_delete_path").returns(true)
File.stubs(:exist?).with("another_delete_path").returns(true)
Expand Down Expand Up @@ -315,11 +309,7 @@ class InstallInstructionTest < InstanceAgentTestCase

context "removes mangled line at the end" do
setup do
@parse_string = <<-END
test_delete_path
another_delete_path
END
@parse_string << "mangled"
@parse_string = "test_delete_path\nanother_delete_path\nmangled"
File.stubs(:exist?).with("test_delete_path").returns(true)
File.stubs(:exist?).with("another_delete_path").returns(true)
end
Expand All @@ -338,7 +328,7 @@ class InstallInstructionTest < InstanceAgentTestCase

context "correctly determines method from file type" do
setup do
@parse_string = 'foo'
@parse_string = "foo\n"
@instruction_file = mock
@instruction_file.stubs(:path).returns("test/123-cleanup")
File.stubs(:open).with("test/123-cleanup", 'r').returns(@instruction_file)
Expand Down

0 comments on commit 3dedbc9

Please sign in to comment.