Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minitest support for file exclude pattern #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/test_boosters/boosters/minitest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Minitest < Base
FILE_PATTERN = "test/**/*_test.rb".freeze

def initialize
super(FILE_PATTERN, nil, split_configuration_path, command)
super(file_pattern, exclude_pattern, split_configuration_path, command)
end

def command
Expand All @@ -30,6 +30,14 @@ def command_from_env_var
ENV["MINITEST_BOOSTER_COMMAND"].to_s
end

def file_pattern
ENV["TEST_BOOSTERS_MINITEST_TEST_FILE_PATTERN"] || FILE_PATTERN
end

def exclude_pattern
ENV["TEST_BOOSTERS_MINITEST_TEST_EXCLUDE_PATTERN"]
end

private

def rails_app?
Expand Down
39 changes: 39 additions & 0 deletions spec/lib/test_boosters/boosters/minitest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,43 @@
end
end
end

describe "#file_pattern" do
before { ENV["TEST_BOOSTERS_MINITEST_TEST_FILE_PATTERN"] = "test/system/**/*_test.rb" }

context "when the TEST_BOOSTERS_MINITEST_TEST_FILE_PATTERN environment variable is set" do
it "returns its values" do
expect(booster.file_pattern).to eq("test/system/**/*_test.rb")
end
end

context "when the TEST_BOOSTERS_MINITEST_TEST_FILE_PATTERN environment variable is not set" do
before { ENV.delete("TEST_BOOSTERS_MINITEST_TEST_FILE_PATTERN") }

it "returns the default minitest path" do
expect(booster.file_pattern).to eq("test/**/*_test.rb")
end
end
end

describe "#exclude_pattern" do
before do
ENV["TEST_BOOSTERS_MINITEST_TEST_EXCLUDE_PATTERN"] =
"test/system/**/*_test.rb"
end

context "when the TEST_BOOSTERS_MINITEST_TEST_EXCLUDE_PATTERN environment variable is set" do
it "returns its values" do
expect(booster.exclude_pattern).to eq("test/system/**/*_test.rb")
end
end

context "when the TEST_BOOSTERS_MINITEST_TEST_FILE_PATTERN environment variable is not set" do
before { ENV.delete("TEST_BOOSTERS_MINITEST_TEST_EXCLUDE_PATTERN") }

it "returns nil" do
expect(booster.exclude_pattern).to be_nil
end
end
end
end