-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add minitest framework #846
Conversation
assert(slurm.respond_to?(:submit)) | ||
veryify_keywords(slurm, :submit, [:after, :afterok, :afternotok, :afterany]) | ||
verify_args(slurm, :submit, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces this line from rspec. Minitest doesn't have the same facility, but I've added some helper methods to do the same.
ood_core/spec/job/adapters/slurm_spec.rb
Line 11 in 65f8ac5
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afternotok, :afterany) } |
def test_submitting_with_hold | ||
slurm = slurm_instance | ||
stub_submit | ||
OodCore::Job::Adapters::Slurm::Batch.any_instance.expects(:submit_string).with(script_content, args: ["-H", "--export", "NONE"], env: {}) | ||
slurm.submit(build_script(submit_as_hold: true)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test replaces this rspec test below, and just reinforces my issue with rspec. Here in mintest we see what I have to stub Open3 because at some point calling submit
on an adapter will result in an Open3.capture3
call.
I guess I just like the explicit nature of Minitest. How is rspec stubbing Open3? I guess it doesn't need to? Like somehow calling submit
will stop execution once slurm.submit_string
is called? There's just a bit too much magic happening, to the point where I'm not really even sure what code is being executed during this test.
ood_core/spec/job/adapters/slurm_spec.rb
Lines 72 to 77 in 65f8ac5
context "with :submit_as_hold" do | |
context "as true" do | |
before { adapter.submit(build_script(submit_as_hold: true)) } | |
it { expect(slurm).to have_received(:submit_string).with(content, args: ["-H", "--export", "NONE"], env: {}) } | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome to see this. I much prefer minitest tests, both reading and writing them.
add minitest framework to begin refactoring from rspec.
Fixes #845