rspec - 向测试添加多种类型

rspec - add multiple types to a test

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

  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

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

bundle exec rspec --tag type:smoke

bundle exec rspec --tag type:integration

你应该可以使用数组来做到这一点。

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