compare-code/spec/functional/utils_spec.rb

28 lines
571 B
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require 'rails_helper'
RSpec.describe 'Utils' do
describe 'Run' do
before :each do
extend Judge::Utils::Run
end
context "#command" do
it "如果参数正确command方法能正确输出" do
command("ls", "-l", "/tmp"){ |out, pid, status|
expect(status).to be true
expect(out.length).to be > 0
}
end
it "参数不正确command能给出错误号" do
command("unkown", "command"){ |out,pid,status|
expect(status).to be false
}
end
end
end
end