Skip to content

Commit

Permalink
Use only one runner
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexB52 committed Nov 24, 2024
1 parent 0235e6f commit fd0c53e
Show file tree
Hide file tree
Showing 43 changed files with 458 additions and 569 deletions.
4 changes: 2 additions & 2 deletions exe/retest
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ end
prompt = Retest::Prompt.new
repository = Retest::Repository.new(files: Retest::VersionControl.files, prompt: prompt)
command = Retest::Command.for_options(options)
runner = Retest::Runners.runner_for(command)
runner = Retest::Runner.new(command)
sounds = Retest::Sounds.for(options)

# All test runner
all_test_command = Retest::Command.for_options(options.merge(%w[--all]), stdout: nil)
all_test_runner = Retest::Runners.runner_for(all_test_command.to_s)
all_test_runner = Retest::Runner.new(all_test_command)
all_test_runner.add_observer(sounds)

sounds.play(:start)
Expand Down
17 changes: 8 additions & 9 deletions features/bundler-app/retest/retest_test/file_changes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_modifying_existing_file

modify_file('lib/bundler_app/bottles.rb')

assert_match "Test File Selected: test/bundler_app/test_bottles.rb", @output.read
assert_match "Test file: test/bundler_app/test_bottles.rb", @output.read
assert_match "12 runs, 12 assertions, 0 failures, 0 errors, 0 skips", @output.read
end

Expand All @@ -30,7 +30,7 @@ def test_modifying_existing_test_file

modify_file('test/bundler_app/test_bottles.rb')

assert_match "Test File Selected: test/bundler_app/test_bottles.rb", @output.read
assert_match "Test file: test/bundler_app/test_bottles.rb", @output.read
assert_match "12 runs, 12 assertions, 0 failures, 0 errors, 0 skips", @output.read
end

Expand All @@ -39,7 +39,7 @@ def test_creating_a_new_test_file

create_file 'test/bundler_app/test_foo.rb'

assert_match "Test File Selected: test/bundler_app/test_foo.rb", @output.read
assert_match "Test file: test/bundler_app/test_foo.rb", @output.read

ensure
delete_file 'test/bundler_app/test_foo.rb'
Expand All @@ -50,18 +50,17 @@ def test_creating_a_new_file

create_file 'lib/bundler_app/foo.rb'
assert_match <<~EXPECTED, @output.read
404 - Test File Not Found
Retest could not find a matching test file to run.
FileNotFound - Retest could not find a matching test file to run.
EXPECTED

create_file 'test/bundler_app/test_foo.rb'
assert_match "Test File Selected: test/bundler_app/test_foo.rb", @output.read
assert_match "Test file: test/bundler_app/test_foo.rb", @output.read

modify_file('lib/bundler_app/bottles.rb')
assert_match "Test File Selected: test/bundler_app/test_bottles.rb", @output.read
assert_match "Test file: test/bundler_app/test_bottles.rb", @output.read

modify_file('lib/bundler_app/foo.rb')
assert_match "Test File Selected: test/bundler_app/test_foo.rb", @output.read
assert_match "Test file: test/bundler_app/test_foo.rb", @output.read

ensure
delete_file 'lib/bundler_app/foo.rb'
Expand All @@ -75,7 +74,7 @@ def test_untracked_file
launch_retest @command

modify_file 'lib/bundler_app/foo.rb'
assert_match "Test File Selected: test/bundler_app/test_foo.rb", @output.read
assert_match "Test file: test/bundler_app/test_foo.rb", @output.read

ensure
delete_file 'lib/bundler_app/foo.rb'
Expand Down
2 changes: 1 addition & 1 deletion features/hanami-app/retest/retest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_modify_a_file

modify_file 'apps/web/controllers/books/create.rb'

assert_match "Test File Selected: spec/web/controllers/books/create_spec.rb", @output.read
assert_match "Test file: spec/web/controllers/books/create_spec.rb", @output.read
assert_match "4 runs, 7 assertions, 0 failures, 0 errors, 0 skips", @output.read
end
end
Expand Down
2 changes: 1 addition & 1 deletion features/rails-app/retest/retest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_modify_a_file

modify_file 'app/models/post.rb'

assert_match "Test File Selected: test/models/post_test.rb", @output.read
assert_match "Test file: test/models/post_test.rb", @output.read
assert_match "1 runs, 1 assertions, 0 failures, 0 errors, 0 skips", @output.read
end
end
Expand Down
2 changes: 1 addition & 1 deletion features/rspec-rails/retest/retest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_modify_a_file

modify_file 'app/models/post.rb'

assert_match "Test File Selected: spec/models/post_spec.rb", @output.read
assert_match "Test file: spec/models/post_spec.rb", @output.read
assert_match "2 examples, 0 failures", @output.read
end
end
Expand Down
17 changes: 8 additions & 9 deletions features/rspec-ruby/retest/retest_test/file_changes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_modifying_existing_file

modify_file('lib/bottles.rb')

assert_match "Test File Selected: spec/bottles_spec.rb", @output.read
assert_match "Test file: spec/bottles_spec.rb", @output.read
assert_match "12 examples, 0 failures", @output.read
end

Expand All @@ -30,7 +30,7 @@ def test_modifying_existing_test_file

modify_file('spec/bottles_spec.rb')

assert_match "Test File Selected: spec/bottles_spec.rb", @output.read
assert_match "Test file: spec/bottles_spec.rb", @output.read
assert_match "12 examples, 0 failures", @output.read
end

Expand All @@ -39,7 +39,7 @@ def test_creating_a_new_test_file

create_file 'foo_spec.rb'

assert_match "Test File Selected: foo_spec.rb", @output.read
assert_match "Test file: foo_spec.rb", @output.read

ensure
delete_file 'foo_spec.rb'
Expand All @@ -50,18 +50,17 @@ def test_creating_a_new_file

create_file 'foo.rb'
assert_match <<~EXPECTED, @output.read
404 - Test File Not Found
Retest could not find a matching test file to run.
FileNotFound - Retest could not find a matching test file to run.
EXPECTED

create_file 'foo_spec.rb'
assert_match "Test File Selected: foo_spec.rb", @output.read
assert_match "Test file: foo_spec.rb", @output.read

modify_file('lib/bottles.rb')
assert_match "Test File Selected: spec/bottles_spec.rb", @output.read
assert_match "Test file: spec/bottles_spec.rb", @output.read

modify_file('foo.rb')
assert_match "Test File Selected: foo_spec.rb", @output.read
assert_match "Test file: foo_spec.rb", @output.read

ensure
delete_file 'foo.rb'
Expand All @@ -75,7 +74,7 @@ def test_untracked_file
launch_retest @command

modify_file 'foo.rb'
assert_match "Test File Selected: foo_spec.rb", @output.read
assert_match "Test file: foo_spec.rb", @output.read

ensure
delete_file 'foo.rb'
Expand Down
2 changes: 1 addition & 1 deletion features/rspec-ruby/retest/retest_test/flags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def test_with_no_command

modify_file('lib/bottles.rb')

assert_match "Test File Selected: spec/bottles_spec.rb", @output.read
assert_match "Test file: spec/bottles_spec.rb", @output.read
end
end
17 changes: 8 additions & 9 deletions features/ruby-app/retest/retest_test/file_changes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_modifying_existing_file

modify_file('lib/bottles.rb')

assert_match "Test File Selected: test/bottles_test.rb", @output.read
assert_match "Test file: test/bottles_test.rb", @output.read
assert_match "12 runs, 12 assertions, 0 failures, 0 errors, 0 skips", @output.read
end

Expand All @@ -30,7 +30,7 @@ def test_modifying_existing_test_file

modify_file('test/bottles_test.rb')

assert_match "Test File Selected: test/bottles_test.rb", @output.read
assert_match "Test file: test/bottles_test.rb", @output.read
assert_match "12 runs, 12 assertions, 0 failures, 0 errors, 0 skips", @output.read
end

Expand All @@ -39,7 +39,7 @@ def test_creating_a_new_test_file

create_file 'foo_test.rb'

assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

ensure
delete_file 'foo_test.rb'
Expand All @@ -50,18 +50,17 @@ def test_creating_a_new_file

create_file 'foo.rb'
assert_match <<~EXPECTED, @output.read
404 - Test File Not Found
Retest could not find a matching test file to run.
FileNotFound - Retest could not find a matching test file to run.
EXPECTED

create_file 'foo_test.rb'
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

modify_file('lib/bottles.rb')
assert_match "Test File Selected: test/bottles_test.rb", @output.read
assert_match "Test file: test/bottles_test.rb", @output.read

modify_file('foo.rb')
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

ensure
delete_file 'foo.rb'
Expand All @@ -75,7 +74,7 @@ def test_untracked_file
launch_retest @command

modify_file 'foo.rb'
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

ensure
delete_file 'foo.rb'
Expand Down
2 changes: 1 addition & 1 deletion features/ruby-app/retest/retest_test/flags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def test_with_no_command

modify_file('lib/bottles.rb')

assert_match "Test File Selected: test/bottles_test.rb", @output.read
assert_match "Test file: test/bottles_test.rb", @output.read
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_displaying_options_on_matching_command
launch_retest('retest --ruby')

create_file 'foo_test.rb'
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

modify_file('lib/bottles.rb')
assert_match <<~EXPECTED.chomp, @output.read
Expand All @@ -39,7 +39,7 @@ def test_displaying_options_on_matching_command
@input.write "2\n"
wait

assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

ensure
delete_file 'foo_test.rb'
Expand Down
17 changes: 8 additions & 9 deletions features/ruby-bare/retest/retest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_modifying_existing_file

modify_file('program.rb')

assert_match "Test File Selected: program_test.rb", @output.read
assert_match "Test file: program_test.rb", @output.read
assert_match "1 runs, 1 assertions, 0 failures, 0 errors, 0 skips", @output.read
end

Expand All @@ -55,7 +55,7 @@ def test_modifying_existing_test_file

modify_file('program_test.rb')

assert_match "Test File Selected: program_test.rb", @output.read
assert_match "Test file: program_test.rb", @output.read
assert_match "1 runs, 1 assertions, 0 failures, 0 errors, 0 skips", @output.read
end

Expand All @@ -64,7 +64,7 @@ def test_creating_a_new_test_file

create_file 'foo_test.rb'

assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

delete_file 'foo_test.rb'
end
Expand All @@ -74,18 +74,17 @@ def test_creating_a_new_file

create_file 'foo.rb'
assert_match <<~EXPECTED, @output.read
404 - Test File Not Found
Retest could not find a matching test file to run.
FileNotFound - Retest could not find a matching test file to run.
EXPECTED

create_file 'foo_test.rb'
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

modify_file('program.rb')
assert_match "Test File Selected: program_test.rb", @output.read
assert_match "Test file: program_test.rb", @output.read

modify_file('foo.rb')
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

delete_file 'foo.rb'
delete_file 'foo_test.rb'
Expand All @@ -98,7 +97,7 @@ def test_untracked_file
launch_retest @command

modify_file 'foo.rb'
assert_match "Test File Selected: foo_test.rb", @output.read
assert_match "Test file: foo_test.rb", @output.read

delete_file 'foo.rb'
delete_file 'foo_test.rb'
Expand Down
2 changes: 1 addition & 1 deletion features/ruby-bare/retest/scenarios/auto_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def test_start_retest

modify_file('program.rb')

assert_match "Test File Selected: program_test.rb", @output.read
assert_match "Test file: program_test.rb", @output.read
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ def test_file_modification
modify_file('program.rb')

assert_match <<~EXPECTED, @output.read
Files Selected:
- changed: program.rb
- test: program_test.rb
Changed file: program.rb
Test file: program_test.rb
placeholders: program.rb and program_test.rb
EXPECTED
Expand Down
2 changes: 1 addition & 1 deletion features/ruby-bare/retest/scenarios/changed_placeholder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_file_modification
modify_file('program.rb')

assert_match <<~EXPECTED, @output.read
Changed File Selected: program.rb
Changed file: program.rb
file modified: program.rb
EXPECTED
end
Expand Down
Loading

0 comments on commit fd0c53e

Please sign in to comment.