28 lines
571 B
Ruby
28 lines
571 B
Ruby
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
|