rspec - 向测试添加多种类型

cdm*_*cdm 7 ruby rspec

想知道是否可以用多种类型标记测试,例如:

  it 'should run as part of smoke or integration tests', :type => 'smoke,integration' do
    response = @sample_request.echo("EXAMPLE5", "EXAMPLE6")
    expect(response.status).to equal(200)
  end
Run Code Online (Sandbox Code Playgroud)

并在应用两个过滤器中的任何一个时运行它:

bundle exec rspec --tag type:smoke
Run Code Online (Sandbox Code Playgroud)

或者

bundle exec rspec --tag type:integration
Run Code Online (Sandbox Code Playgroud)

ake*_*err 8

您应该能够使用数组来做到这一点。

it '...', :type => ['smoke', 'integration'] do