Skip to content

Commit

Permalink
Add tests for job.repeat argument validation
Browse files Browse the repository at this point in the history
Addresses #31.
  • Loading branch information
rfdonnelly committed Mar 29, 2016
1 parent 101e8eb commit c1a54d4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/dsl_command_error_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,34 @@ def clear
EOF
end
end

describe 'job.repeat command' do
it 'requires an Integer' do
e = assert_raises(Jobrnr::TypeError) do
@obj.job :id do
stub :caller_source, 'file:line' do
repeat '5'
end
end
end
assert_equal(Jobrnr::Util.strip_heredoc(<<-EOF).strip, e.message)
'repeat' expects a positive Integer but was given value of '5' of type 'String' @ file:line
EOF
end

it 'requires a positive Integer' do
e = assert_raises(Jobrnr::TypeError) do
@obj.job :id do
stub :caller_source, 'file:line' do
repeat -1
end
end
end
assert_equal(Jobrnr::Util.strip_heredoc(<<-EOF).strip, e.message)
'repeat' expects a positive Integer but was given value of '-1' of type 'Fixnum' @ file:line
EOF
end
end
end

describe 'import command' do
Expand Down

0 comments on commit c1a54d4

Please sign in to comment.