Permalink
Browse files

added support for files ending in _tests.rb

  • Loading branch information...
1 parent 0614555 commit 97d39f52b769645fe5e05eb1400a9ba429a92351 @pastorius pastorius committed Nov 2, 2012
Showing with 22 additions and 9 deletions.
  1. +3 −1 lib/guard/test/inspector.rb
  2. +4 −4 spec/guard/test/inspector_spec.rb
  3. +4 −4 spec/guard/test_spec.rb
  4. +11 −0 test/succeeding_tests.rb
@@ -51,7 +51,9 @@ def clear_test_files_list
end
def check_test_files(path)
- Dir[File.join(path, '**', 'test_*.rb')] + Dir[File.join(path, '**', '*_test.rb')]
+ Dir[File.join(path, '**', 'test_*.rb')] +
+ Dir[File.join(path, '**', '*_test.rb')] +
+ Dir[File.join(path, '**', '*_tests.rb')]
end
end
@@ -8,7 +8,7 @@
it "should add all test files under the given dir" do
subject.clean(["test"]).should \
- == ["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
+ == ["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
end
it "should remove non-test files" do
@@ -30,17 +30,17 @@
it "should remove duplication" do
subject.clean(["test", "test"]).should \
- == ["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
+ == ["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
end
it "should remove test folder includes in other test folder" do
subject.clean(["test/unit", "test"]).should \
- == ["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
+ == ["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
end
it "should remove test files includes in test folder" do
subject.clean(["test/unit/failing_test.rb", "test"]).should \
- == ["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
+ == ["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"]
end
it "should remove test files includes in test folder (2)" do
View
@@ -50,7 +50,7 @@
describe "#run_all" do
it "runs all tests specified by the default :test_paths with a message" do
- runner.should_receive(:run).with(["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"],:message => "Running all tests"
+ runner.should_receive(:run).with(["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"],:message => "Running all tests"
)
subject.run_all
end
@@ -68,7 +68,7 @@
runner.should_receive(:run).with(["test/unit/error/error_test.rb", "test/unit/failing_test.rb"]).and_return(false)
subject.run_on_changes(["test/unit"])
- runner.should_receive(:run).with(["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"], :message => "Running all tests").and_return(true)
+ runner.should_receive(:run).with(["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"], :message => "Running all tests").and_return(true)
subject.run_all
runner.should_receive(:run).with(["test/unit/error/error_test.rb", "test/unit/failing_test.rb"]).and_return(true)
@@ -90,7 +90,7 @@
subject.reload
runner.should_receive(:run).with(["test/unit/error/error_test.rb", "test/unit/failing_test.rb"]).and_return(true)
- runner.should_receive(:run).with(["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"], :message => "Running all tests").and_return(true)
+ runner.should_receive(:run).with(["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"], :message => "Running all tests").and_return(true)
subject.run_on_changes(["test/unit"])
end
end
@@ -116,7 +116,7 @@
it "calls #run_all by default if the changed specs pass after failing" do
runner.should_receive(:run).with(["test/succeeding_test.rb"]).and_return(false, true)
- runner.should_receive(:run).with(["test/succeeding_test.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"], :message => "Running all tests")
+ runner.should_receive(:run).with(["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_old.rb", "test/unit/error/error_test.rb", "test/unit/failing_test.rb"], :message => "Running all tests")
subject.run_on_changes(["test/succeeding_test.rb"])
subject.run_on_changes(["test/succeeding_test.rb"])
View
@@ -0,0 +1,11 @@
+require 'test_helper'
+
+# encoding: utf-8
+class SucceedingTests < Test::Unit::TestCase
+ def test_succeeding1
+ assert_equal(true, true)
+ end
+ def test_succeeding2
+ assert_equal(true, true)
+ end
+end

0 comments on commit 97d39f5

Please sign in to comment.