Execute Rspec from Ruby

前端 未结 4 964
孤城傲影
孤城傲影 2020-12-09 04:15

I am trying to execute rspec from ruby, and get the status or number of failures from a method or something like that. Actually I am running something like this:

<         


        
4条回答
  •  攒了一身酷
    2020-12-09 04:40

    I suggest you to take a look into rspec source code to find out the answer. I think you can start with example_group_runner

    Edit: Ok here is the way:

    RSpec::Core::Runner::run(options, err, out)
    

    Options - array of directories, err & out - streams. For example

    RSpec::Core::Runner.run(['spec', 'another_specs'], $stderr, $stdout) 
    

提交回复
热议问题