I want to add a test for a one-off task, but once it runs, in the future it should not get run as part of the full suite.
Asked
Active
Viewed 44 times
2 Answers
1
You can add a guard clause on the test method, or the test class for whether it should exist. For example:
def test_greet
greeter = HelloWorld.new
assert_equal "Hello world!", greeter.greet
end if ENV["ONEOFF"]
Or, for the whole test class:
class TestHello < Minitest::Test
def test_greet
greeter = HelloWorld.new
assert_equal "Hello world!", greeter.greet
end
end if ENV["ONEOFF"]
Then to have these run just define the ONEOFF environment variable when you run your test.

blowmage
- 8,854
- 2
- 35
- 40
0
If you're using Rspec, checkout Rspec filtering. That may be what you want: https://www.relishapp.com/rspec/rspec-core/v/2-14/docs/filtering/inclusion-filters

rdnewman
- 1,379
- 20
- 28