I'm currently converting a whole bunch of acceptance tests from php into ruby and many of the tests use specific scenarios to test certain conditions. We use @dataProvider a lot and my google foo can't find any information if this functionality exists in the test-unit gem.

As a work around I'm manually calling a supporting method to give me the required values to test against and putting the test scenarios in var.each{} loops. It's not elegant but it works. I'd still prefer to use the dataProvider route if it's available though.

有帮助吗?

解决方案

Your Google foo is probably very good, however in Ruby something similar is called a fixture.

Fixtures in Ruby Unit Tests

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top