Skip to content

Commit

Permalink
fix warnings in tests due to the way arguments are passed to assert_m…
Browse files Browse the repository at this point in the history
…atch
  • Loading branch information
Dv Dasari committed May 29, 2016
1 parent d03ef4d commit 3c7a4ba
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
16 changes: 8 additions & 8 deletions test/functional/output_default_defined_jobs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OutputDefaultDefinedJobsTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah$/, output
assert_match(/^.+ .+ .+ .+ blahblah$/, output)
end

test "A plain command with no job template set" do
Expand All @@ -24,7 +24,7 @@ class OutputDefaultDefinedJobsTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ \/bin\/bash -l -c 'blahblah'$/, output
assert_match(/^.+ .+ .+ .+ \/bin\/bash -l -c 'blahblah'$/, output)
end

test "A plain command with a job_template using a normal parameter" do
Expand All @@ -37,7 +37,7 @@ class OutputDefaultDefinedJobsTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ \/bin\/bash -l -c 'cd \/tmp \&\& blahblah'$/, output
assert_match(/^.+ .+ .+ .+ \/bin\/bash -l -c 'cd \/tmp \&\& blahblah'$/, output)
end

test "A plain command that overrides the job_template set" do
Expand All @@ -50,8 +50,8 @@ class OutputDefaultDefinedJobsTest < Whenever::TestCase
file


assert_match /^.+ .+ .+ .+ \/bin\/sh -l -c 'blahblah'$/, output
assert_no_match /bash/, output
assert_match(/^.+ .+ .+ .+ \/bin\/sh -l -c 'blahblah'$/, output)
assert_no_match(/bash/, output)
end

test "A plain command that overrides the job_template set using a parameter" do
Expand All @@ -65,8 +65,8 @@ class OutputDefaultDefinedJobsTest < Whenever::TestCase
file


assert_match /^.+ .+ .+ .+ \/bin\/sh -l -c 'cd \/tmp && blahblah'$/, output
assert_no_match /bash/, output
assert_match(/^.+ .+ .+ .+ \/bin\/sh -l -c 'cd \/tmp && blahblah'$/, output)
assert_no_match(/bash/, output)
end

test "A plain command that is conditional on default environent and path" do
Expand All @@ -81,7 +81,7 @@ class OutputDefaultDefinedJobsTest < Whenever::TestCase
end
file

assert_match /blahblah/, output
assert_match(/blahblah/, output)
end

# runner
Expand Down
10 changes: 5 additions & 5 deletions test/functional/output_defined_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OutputDefinedJobTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ before during after$/, output
assert_match(/^.+ .+ .+ .+ before during after$/, output)
end

test "defined job with a :task and some options" do
Expand All @@ -24,7 +24,7 @@ class OutputDefinedJobTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ before during after happy birthday$/, output
assert_match(/^.+ .+ .+ .+ before during after happy birthday$/, output)
end

test "defined job with a :task and an option where the option is set globally" do
Expand All @@ -38,7 +38,7 @@ class OutputDefinedJobTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ before during after happy$/, output
assert_match(/^.+ .+ .+ .+ before during after happy$/, output)
end

test "defined job with a :task and an option where the option is set globally and locally" do
Expand All @@ -52,7 +52,7 @@ class OutputDefinedJobTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ before during after local$/, output
assert_match(/^.+ .+ .+ .+ before during after local$/, output)
end

test "defined job with a :task and an option that is not set" do
Expand All @@ -65,7 +65,7 @@ class OutputDefinedJobTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ before during after :option1$/, output
assert_match(/^.+ .+ .+ .+ before during after :option1$/, output)
end

test "defined job that uses a :path where none is explicitly set" do
Expand Down
46 changes: 23 additions & 23 deletions test/functional/output_redirection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> \/dev\/null 2>&1$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> \/dev\/null 2>&1$/, output)
end


Expand All @@ -25,7 +25,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> logfile.log 2>&1$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> logfile.log 2>&1$/, output)
end

test "command when the error and standard output is set by the command" do
Expand All @@ -37,7 +37,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> dev_null 2>> dev_err$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> dev_null 2>> dev_err$/, output)
end

test "command when the output is set and the comand overrides it" do
Expand All @@ -50,8 +50,8 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_no_match /.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output
assert_match /^.+ .+ .+ .+ blahblah >> otherlog.log 2>&1$/, output
assert_no_match(/.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output)
assert_match(/^.+ .+ .+ .+ blahblah >> otherlog.log 2>&1$/, output)
end

test "command when the output is set and the comand overrides with standard and error" do
Expand All @@ -64,8 +64,8 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_no_match /.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output
assert_match /^.+ .+ .+ .+ blahblah >> dev_null 2>> dev_err$/, output
assert_no_match(/.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output)
assert_match(/^.+ .+ .+ .+ blahblah >> dev_null 2>> dev_err$/, output)
end

test "command when the output is set and the comand rejects it" do
Expand All @@ -78,8 +78,8 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_no_match /.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output
assert_match /^.+ .+ .+ .+ blahblah$/, output
assert_no_match(/.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output)
assert_match(/^.+ .+ .+ .+ blahblah$/, output)
end

test "command when the output is set and is overridden by the :set option" do
Expand All @@ -92,8 +92,8 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_no_match /.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output
assert_match /^.+ .+ .+ .+ blahblah >> otherlog.log 2>&1/, output
assert_no_match(/.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, output)
assert_match(/^.+ .+ .+ .+ blahblah >> otherlog.log 2>&1/, output)
end

test "command when the error and standard output is set" do
Expand All @@ -106,7 +106,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> dev_null 2>> dev_err$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> dev_null 2>> dev_err$/, output)
end

test "command when error output is set" do
Expand All @@ -119,7 +119,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah 2>> dev_null$/, output
assert_match(/^.+ .+ .+ .+ blahblah 2>> dev_null$/, output)
end

test "command when the standard output is set" do
Expand All @@ -132,7 +132,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> dev_out$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> dev_out$/, output)
end

test "command when error output is set by the command" do
Expand All @@ -144,7 +144,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah 2>> dev_err$/, output
assert_match(/^.+ .+ .+ .+ blahblah 2>> dev_err$/, output)
end

test "command when standard output is set by the command" do
Expand All @@ -156,7 +156,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> dev_out$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> dev_out$/, output)
end

test "command when standard output is set to nil" do
Expand All @@ -168,7 +168,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah > \/dev\/null$/, output
assert_match(/^.+ .+ .+ .+ blahblah > \/dev\/null$/, output)
end

test "command when standard error is set to nil" do
Expand All @@ -180,7 +180,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah 2> \/dev\/null$/, output
assert_match(/^.+ .+ .+ .+ blahblah 2> \/dev\/null$/, output)
end

test "command when standard output and standard error is set to nil" do
Expand All @@ -192,7 +192,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah > \/dev\/null 2>&1$/, output
assert_match(/^.+ .+ .+ .+ blahblah > \/dev\/null 2>&1$/, output)
end

test "command when standard output is set and standard error is set to nil" do
Expand All @@ -204,7 +204,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> my.log 2> \/dev\/null$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> my.log 2> \/dev\/null$/, output)
end

test "command when standard output is nil and standard error is set" do
Expand All @@ -216,7 +216,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> \/dev\/null 2>> my_error.log$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> \/dev\/null 2>> my_error.log$/, output)
end

test "command when the deprecated :cron_log is set" do
Expand All @@ -229,7 +229,7 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah >> cron.log 2>&1$/, output
assert_match(/^.+ .+ .+ .+ blahblah >> cron.log 2>&1$/, output)
end


Expand All @@ -243,6 +243,6 @@ class OutputRedirectionTest < Whenever::TestCase
end
file

assert_match /^.+ .+ .+ .+ blahblah 2>&1 | logger -t whenever_cron$/, output
assert_match(/^.+ .+ .+ .+ blahblah 2>&1 | logger -t whenever_cron$/, output)
end
end

0 comments on commit 3c7a4ba

Please sign in to comment.