Reputation: 101
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.
Upvotes: 0
Views: 46
Reputation: 8984
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.
Upvotes: 1
Reputation: 1399
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
Upvotes: 0