diff --git a/exe/retest b/exe/retest index 2776843b..251ace71 100755 --- a/exe/retest +++ b/exe/retest @@ -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) diff --git a/features/bundler-app/retest/retest_test/file_changes_test.rb b/features/bundler-app/retest/retest_test/file_changes_test.rb index b632b561..ea08577a 100644 --- a/features/bundler-app/retest/retest_test/file_changes_test.rb +++ b/features/bundler-app/retest/retest_test/file_changes_test.rb @@ -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 @@ -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 @@ -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' @@ -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' @@ -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' diff --git a/features/hanami-app/retest/retest_test.rb b/features/hanami-app/retest/retest_test.rb index 5f385522..6fbf3503 100644 --- a/features/hanami-app/retest/retest_test.rb +++ b/features/hanami-app/retest/retest_test.rb @@ -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 diff --git a/features/rails-app/retest/retest_test.rb b/features/rails-app/retest/retest_test.rb index 8eb1b600..0542491e 100644 --- a/features/rails-app/retest/retest_test.rb +++ b/features/rails-app/retest/retest_test.rb @@ -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 diff --git a/features/rspec-rails/retest/retest_test.rb b/features/rspec-rails/retest/retest_test.rb index 11c19ba1..a8a796c2 100644 --- a/features/rspec-rails/retest/retest_test.rb +++ b/features/rspec-rails/retest/retest_test.rb @@ -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 diff --git a/features/rspec-ruby/retest/retest_test/file_changes_test.rb b/features/rspec-ruby/retest/retest_test/file_changes_test.rb index 2fe24a89..52668e80 100644 --- a/features/rspec-ruby/retest/retest_test/file_changes_test.rb +++ b/features/rspec-ruby/retest/retest_test/file_changes_test.rb @@ -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 @@ -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 @@ -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' @@ -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' @@ -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' diff --git a/features/rspec-ruby/retest/retest_test/flags_test.rb b/features/rspec-ruby/retest/retest_test/flags_test.rb index c882ae16..66da617d 100644 --- a/features/rspec-ruby/retest/retest_test/flags_test.rb +++ b/features/rspec-ruby/retest/retest_test/flags_test.rb @@ -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 \ No newline at end of file diff --git a/features/ruby-app/retest/retest_test/file_changes_test.rb b/features/ruby-app/retest/retest_test/file_changes_test.rb index 0e6ea7a7..83faa66d 100644 --- a/features/ruby-app/retest/retest_test/file_changes_test.rb +++ b/features/ruby-app/retest/retest_test/file_changes_test.rb @@ -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 @@ -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 @@ -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' @@ -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' @@ -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' diff --git a/features/ruby-app/retest/retest_test/flags_test.rb b/features/ruby-app/retest/retest_test/flags_test.rb index 8fd86f64..25dd51c8 100644 --- a/features/ruby-app/retest/retest_test/flags_test.rb +++ b/features/ruby-app/retest/retest_test/flags_test.rb @@ -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 \ No newline at end of file diff --git a/features/ruby-app/retest/retest_test/matching_unmatching_command_test.rb b/features/ruby-app/retest/retest_test/matching_unmatching_command_test.rb index e9356174..0714afbd 100644 --- a/features/ruby-app/retest/retest_test/matching_unmatching_command_test.rb +++ b/features/ruby-app/retest/retest_test/matching_unmatching_command_test.rb @@ -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 @@ -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' diff --git a/features/ruby-bare/retest/retest_test.rb b/features/ruby-bare/retest/retest_test.rb index c525f9da..a4612478 100644 --- a/features/ruby-bare/retest/retest_test.rb +++ b/features/ruby-bare/retest/retest_test.rb @@ -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 @@ -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 @@ -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 @@ -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' @@ -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' diff --git a/features/ruby-bare/retest/scenarios/auto_flag.rb b/features/ruby-bare/retest/scenarios/auto_flag.rb index 3cf701d7..31867189 100644 --- a/features/ruby-bare/retest/scenarios/auto_flag.rb +++ b/features/ruby-bare/retest/scenarios/auto_flag.rb @@ -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 \ No newline at end of file diff --git a/features/ruby-bare/retest/scenarios/changed_and_test_placeholders.rb b/features/ruby-bare/retest/scenarios/changed_and_test_placeholders.rb index 1f3172b9..0ab62ff6 100644 --- a/features/ruby-bare/retest/scenarios/changed_and_test_placeholders.rb +++ b/features/ruby-bare/retest/scenarios/changed_and_test_placeholders.rb @@ -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 diff --git a/features/ruby-bare/retest/scenarios/changed_placeholder.rb b/features/ruby-bare/retest/scenarios/changed_placeholder.rb index f681e3a8..5b23b2ba 100644 --- a/features/ruby-bare/retest/scenarios/changed_placeholder.rb +++ b/features/ruby-bare/retest/scenarios/changed_placeholder.rb @@ -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 diff --git a/features/ruby-bare/retest/scenarios/force_polling.rb b/features/ruby-bare/retest/scenarios/force_polling.rb index d2231775..eb3dbfa4 100644 --- a/features/ruby-bare/retest/scenarios/force_polling.rb +++ b/features/ruby-bare/retest/scenarios/force_polling.rb @@ -21,7 +21,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 @@ -30,7 +30,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 @@ -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' @@ -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('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 ensure delete_file 'foo.rb' @@ -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' diff --git a/features/ruby-bare/retest/scenarios/multiple_commands.rb b/features/ruby-bare/retest/scenarios/multiple_commands.rb index ad0eeec0..5f1d31b9 100644 --- a/features/ruby-bare/retest/scenarios/multiple_commands.rb +++ b/features/ruby-bare/retest/scenarios/multiple_commands.rb @@ -17,10 +17,13 @@ def test_file_modification modify_file('program.rb') + log("Changed file: #{changed_file}") + + log("Test file: #{cached_test_file}") + assert_match <<~EXPECTED, @output.read - Files Selected: - - changed: program.rb - - test: program_test.rb + Changed file: program.rb + Test file: program_test.rb files: program.rb and program_test.rb hello world diff --git a/lib/retest.rb b/lib/retest.rb index 5045bac2..0535a4aa 100644 --- a/lib/retest.rb +++ b/lib/retest.rb @@ -4,7 +4,7 @@ require 'observer' require "retest/version" -require "retest/runners" +require "retest/runner" require "retest/repository" require "retest/matching_options" require "retest/options" diff --git a/lib/retest/command/base.rb b/lib/retest/command/base.rb index efa45ad8..72f342f9 100644 --- a/lib/retest/command/base.rb +++ b/lib/retest/command/base.rb @@ -7,6 +7,22 @@ def initialize(all: false, file_system: FileSystem, command: nil) @command = command end + def changed_type? + to_s.include?('') + end + + def test_type? + to_s.include?('') + end + + def variable_type? + test_type? && changed_type? + end + + def hardcoded_type? + !test_type? && !changed_type? + end + def to_s raise NotImplementedError end diff --git a/lib/retest/program.rb b/lib/retest/program.rb index 7b74e309..1886fea7 100644 --- a/lib/retest/program.rb +++ b/lib/retest/program.rb @@ -21,7 +21,8 @@ def run(file, force_run: false) end clear_terminal - runner.run changed_files: [file], test_files: [repository.find_test(file)] + test_file = repository.find_test(file) if runner.command.test_type? + runner.run changed_files: [file], test_files: [test_file] end def diff(branch) diff --git a/lib/retest/runner.rb b/lib/retest/runner.rb new file mode 100644 index 00000000..292823a7 --- /dev/null +++ b/lib/retest/runner.rb @@ -0,0 +1,86 @@ +require_relative "runner/cached_test_file" + +module Retest + class Runner + include Observable + include CachedTestFile + + attr_accessor :command, :stdout + def initialize(command, stdout: $stdout) + @stdout = stdout + @command = command + end + + def ==(obj) + return false unless obj.command + + command.to_s == obj.command.to_s && self.class == obj.class + end + + def run(changed_files: [], test_files: []) + changed_file = changed_files.is_a?(Array) ? changed_files.first : changed_files + test_file = test_files.is_a?(Array) ? test_files.first : test_files + + self.cached_test_file = test_file + + if command.to_s.include?('') + if changed_file.nil? + print_changed_file_not_found + return + end + log("Changed file: #{changed_file}") + end + + if command.to_s.include?('') + if cached_test_file.nil? + print_test_file_not_found + return + end + log("Test file: #{cached_test_file}") + end + + system_run command.to_s + .gsub('', cached_test_file.to_s) + .gsub('', changed_file.to_s) + end + + def run_all_tests(tests_string) + log("Test Files Selected: #{tests_string}") + system_run command.to_s.gsub('', tests_string) + end + + def sync(added:, removed:) + purge_test_file(removed) + end + + def running? + @running + end + + private + + def system_run(command) + @running = true + result = system(command) ? :tests_pass : :tests_fail + changed + notify_observers(result) + @running = false + end + + def log(message) + stdout.puts(message) + end + + def print_changed_file_not_found + log(<<~ERROR) + FileNotFound - Retest could not find a changed file to run. + ERROR + end + + def print_test_file_not_found + log(<<~ERROR) + FileNotFound - Retest could not find a matching test file to run. + ERROR + end + end +end diff --git a/lib/retest/runner/cached_test_file.rb b/lib/retest/runner/cached_test_file.rb new file mode 100644 index 00000000..b2a6f909 --- /dev/null +++ b/lib/retest/runner/cached_test_file.rb @@ -0,0 +1,19 @@ +module Retest + module CachedTestFile + attr_reader :cached_test_file + + def cached_test_file=(value) + @cached_test_file = value || cached_test_file + end + + def purge_test_file(purged) + return if purged.empty? + + if purged.is_a?(Array) && purged.include?(cached_test_file) + @cached_test_file = nil + elsif purged.is_a?(String) && purged == cached_test_file + @cached_test_file = nil + end + end + end +end diff --git a/lib/retest/runners.rb b/lib/retest/runners.rb deleted file mode 100644 index bc82ecab..00000000 --- a/lib/retest/runners.rb +++ /dev/null @@ -1,23 +0,0 @@ -require_relative 'runners/runner' -require_relative 'runners/test_runner' -require_relative 'runners/change_runner' -require_relative 'runners/variable_runner' - -module Retest - module Runners - class NotSupportedError < StandardError; end - - module_function - - def runner_for(command, **opts) - for_test = command.to_s.include?('') - for_change = command.to_s.include?('') - - if for_test && for_change then VariableRunner - elsif for_test then TestRunner - elsif for_change then ChangeRunner - else Runner - end.new command, **opts - end - end -end \ No newline at end of file diff --git a/lib/retest/runners/cached_test_file.rb b/lib/retest/runners/cached_test_file.rb deleted file mode 100644 index 5002a8ce..00000000 --- a/lib/retest/runners/cached_test_file.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Retest - module Runners - module CachedTestFile - def cached_test_file - @cached_test_file - end - - def cached_test_file=(value) - @cached_test_file = value || @cached_test_file - end - - def purge_test_file(purged) - return if purged.empty? - - if purged.is_a?(Array) && purged.include?(cached_test_file) - @cached_test_file = nil - elsif purged.is_a?(String) && purged == cached_test_file - @cached_test_file = nil - end - end - end - end -end diff --git a/lib/retest/runners/change_runner.rb b/lib/retest/runners/change_runner.rb deleted file mode 100644 index 99c1a4ca..00000000 --- a/lib/retest/runners/change_runner.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Retest - module Runners - class ChangeRunner < Runner - def run(changed_files: [], test_files: []) - changed_file = changed_files - changed_file = changed_files.first if changed_files.is_a?(Array) - - return print_file_not_found unless changed_file - - log("Changed File Selected: #{changed_file}") - system_run command.to_s.gsub('', changed_file) - end - - private - - def print_file_not_found - log(<<~ERROR) - 404 - File Not Found - Retest could not find a changed file to run. - ERROR - end - end - end -end \ No newline at end of file diff --git a/lib/retest/runners/runner.rb b/lib/retest/runners/runner.rb deleted file mode 100644 index 54e14bfd..00000000 --- a/lib/retest/runners/runner.rb +++ /dev/null @@ -1,48 +0,0 @@ -module Retest - module Runners - class Runner - include Observable - - attr_accessor :command, :stdout - def initialize(command, stdout: $stdout) - @stdout = stdout - @command = command - end - - def ==(obj) - return false unless obj.command - - command.to_s == obj.command.to_s && self.class == obj.class - end - - def run(changed_files: [], test_files: []) - system_run command.to_s - end - - def run_all_tests(tests_string) - raise NotSupportedError, 'cannot run multiple test files against this command' - end - - def sync(added:, removed:) - end - - def running? - @running - end - - private - - def system_run(command) - @running = true - result = system(command) ? :tests_pass : :tests_fail - changed - notify_observers(result) - @running = false - end - - def log(message) - stdout.puts(message) - end - end - end -end diff --git a/lib/retest/runners/test_runner.rb b/lib/retest/runners/test_runner.rb deleted file mode 100644 index 1820ba7b..00000000 --- a/lib/retest/runners/test_runner.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative "cached_test_file" - -module Retest - module Runners - class TestRunner < Runner - include CachedTestFile - - def run(changed_files: [], test_files: []) - changed_file = changed_files - changed_file = changed_files.first if changed_files.is_a?(Array) - - test_file = test_files - test_file = test_files.first if test_files.is_a?(Array) - - self.cached_test_file = test_file - - return print_file_not_found unless cached_test_file - - log("Test File Selected: #{cached_test_file}") - system_run command.to_s.gsub('', cached_test_file) - end - - def run_all_tests(tests_string) - log("Test Files Selected: #{tests_string}") - system_run command.to_s.gsub('', tests_string) - end - - def sync(added:, removed:) - purge_test_file(removed) - end - - private - - def print_file_not_found - log(<<~ERROR) - 404 - Test File Not Found - Retest could not find a matching test file to run. - ERROR - end - end - end -end diff --git a/lib/retest/runners/variable_runner.rb b/lib/retest/runners/variable_runner.rb deleted file mode 100644 index e9f3dff7..00000000 --- a/lib/retest/runners/variable_runner.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative "cached_test_file" - -module Retest - module Runners - class VariableRunner < Runner - include CachedTestFile - - def run(changed_files: [], test_files: []) - changed_file = changed_files.is_a?(Array) ? changed_files.first : changed_files - test_file = test_files.is_a?(Array) ? test_files.first : test_files - - self.cached_test_file = test_file - - return print_file_not_found unless cached_test_file - - log(<<~FILES) - Files Selected: - - changed: #{changed_file} - - test: #{cached_test_file} - - FILES - - system_run command.to_s - .gsub('', cached_test_file) - .gsub('', changed_file) - end - - def sync(added:, removed:) - purge_test_file(removed) - end - - private - - def print_file_not_found - log(<<~ERROR) - 404 - Test File Not Found - Retest could not find a matching test file to run. - ERROR - end - end - end -end diff --git a/path.rb b/path.rb new file mode 100644 index 00000000..e69de29b diff --git a/test/retest/command/hardcoded_test.rb b/test/retest/command/hardcoded_test.rb index e8dcf882..8385f011 100644 --- a/test/retest/command/hardcoded_test.rb +++ b/test/retest/command/hardcoded_test.rb @@ -10,6 +10,34 @@ def setup include CommandInterface + def test_test? + refute Hardcoded.new(command: 'echo "hello world"').test_type? + assert Hardcoded.new(command: 'echo ').test_type? + refute Hardcoded.new(command: 'echo ').test_type? + assert Hardcoded.new(command: 'echo & ').test_type? + end + + def test_variable? + refute Hardcoded.new(command: 'echo "hello world"').variable_type? + refute Hardcoded.new(command: 'echo ').variable_type? + refute Hardcoded.new(command: 'echo ').variable_type? + assert Hardcoded.new(command: 'echo & ').variable_type? + end + + def test_changed? + refute Hardcoded.new(command: 'echo "hello world"').changed_type? + refute Hardcoded.new(command: 'echo ').changed_type? + assert Hardcoded.new(command: 'echo ').changed_type? + assert Hardcoded.new(command: 'echo & ').changed_type? + end + + def test_hardcoded? + assert Hardcoded.new(command: 'echo "hello world"').hardcoded_type? + refute Hardcoded.new(command: 'echo ').hardcoded_type? + refute Hardcoded.new(command: 'echo ').hardcoded_type? + refute Hardcoded.new(command: 'echo & ').hardcoded_type? + end + def test_to_s assert_equal 'echo "hello world"', @subject.to_s end diff --git a/test/retest/command/rails_test.rb b/test/retest/command/rails_test.rb index 2811eef7..f57c3845 100644 --- a/test/retest/command/rails_test.rb +++ b/test/retest/command/rails_test.rb @@ -10,6 +10,20 @@ def setup include CommandInterface + def test_type + all_cmd = Rails.new(all: true, file_system: FakeFS.new([])) + refute all_cmd.test_type? + refute all_cmd.variable_type? + refute all_cmd.changed_type? + assert all_cmd.hardcoded_type? + + cmd = Rails.new(all: false, file_system: FakeFS.new([])) + assert cmd.test_type? + refute cmd.variable_type? + refute cmd.changed_type? + refute cmd.hardcoded_type? + end + def test_to_s assert_equal 'bin/rails test', Rails.new(all: true, file_system: FakeFS.new(['bin/rails'])).to_s assert_equal 'bundle exec rails test', Rails.new(all: true, file_system: FakeFS.new([])).to_s diff --git a/test/retest/command/rake_test.rb b/test/retest/command/rake_test.rb index 436cf766..488c6682 100644 --- a/test/retest/command/rake_test.rb +++ b/test/retest/command/rake_test.rb @@ -10,6 +10,20 @@ def setup include CommandInterface + def test_type + all_cmd = Rake.new(all: true, file_system: FakeFS.new([])) + refute all_cmd.test_type? + refute all_cmd.variable_type? + refute all_cmd.changed_type? + assert all_cmd.hardcoded_type? + + cmd = Rake.new(all: false, file_system: FakeFS.new([])) + assert cmd.test_type? + refute cmd.variable_type? + refute cmd.changed_type? + refute cmd.hardcoded_type? + end + def test_to_s assert_equal 'bin/rake test', Rake.new(all: true, file_system: FakeFS.new(['bin/rake'])).to_s assert_equal 'bundle exec rake test', Rake.new(all: true, file_system: FakeFS.new([])).to_s diff --git a/test/retest/command/rspec_test.rb b/test/retest/command/rspec_test.rb index 908a9a62..7aaf9bf9 100644 --- a/test/retest/command/rspec_test.rb +++ b/test/retest/command/rspec_test.rb @@ -10,6 +10,20 @@ def setup include CommandInterface + def test_type + all_cmd = Rspec.new(all: true, file_system: FakeFS.new([])) + refute all_cmd.test_type? + refute all_cmd.variable_type? + refute all_cmd.changed_type? + assert all_cmd.hardcoded_type? + + cmd = Rspec.new(all: false, file_system: FakeFS.new([])) + assert cmd.test_type? + refute cmd.variable_type? + refute cmd.changed_type? + refute cmd.hardcoded_type? + end + def test_to_s assert_equal 'bin/rspec', Rspec.new(all: true, file_system: FakeFS.new(['bin/rspec'])).to_s assert_equal 'bundle exec rspec', Rspec.new(all: true, file_system: FakeFS.new([])).to_s diff --git a/test/retest/command/ruby_test.rb b/test/retest/command/ruby_test.rb index adc0eb14..3b5230bc 100644 --- a/test/retest/command/ruby_test.rb +++ b/test/retest/command/ruby_test.rb @@ -10,6 +10,20 @@ def setup include CommandInterface + def test_type + all_cmd = Ruby.new(all: true, file_system: FakeFS.new([])) + assert all_cmd.test_type? + refute all_cmd.variable_type? + refute all_cmd.changed_type? + refute all_cmd.hardcoded_type? + + cmd = Ruby.new(all: false, file_system: FakeFS.new([])) + assert cmd.test_type? + refute cmd.variable_type? + refute cmd.changed_type? + refute cmd.hardcoded_type? + end + def test_to_s assert_equal 'ruby ', Ruby.new(all: true, file_system: FakeFS.new(['bin/ruby'])).to_s assert_equal 'ruby ', Ruby.new(all: true, file_system: FakeFS.new([])).to_s diff --git a/test/retest/program_test.rb b/test/retest/program_test.rb index 78314bfb..fc5bae08 100644 --- a/test/retest/program_test.rb +++ b/test/retest/program_test.rb @@ -1,9 +1,15 @@ require 'test_helper' -# TODO : write missing tests module Retest class ProgramTest < MiniTest::Test class PauseTest < Minitest::Test + class RaisingRepository + class NotToBeCalledError < StandardError; end + def find_test(_) + raise NotToBeCalledError + end + end + def setup @subject = Program.new(repository: Repository.new, clear_window: false, stdout: StringIO.new) end @@ -23,6 +29,14 @@ def test_no_run_when_paused @subject.pause @subject.run('file_path') end + + def test_run_not_trigger_repository_find_test_when_hardcoded + @runner = Runner.new(Command::Hardcoded.new(command: 'echo ')) + @repository = RaisingRepository.new + @subject = Program.new(runner: @runner, repository: @repository) + + out, _ = capture_subprocess_io { @subject.run('path.rb') } + end end end end diff --git a/test/retest/runners/observable_runner.rb b/test/retest/runner/observable_runner.rb similarity index 97% rename from test/retest/runners/observable_runner.rb rename to test/retest/runner/observable_runner.rb index 1d356dc7..870e9b83 100644 --- a/test/retest/runners/observable_runner.rb +++ b/test/retest/runner/observable_runner.rb @@ -1,5 +1,5 @@ module Retest - module Runners + class Runner module OversableRunnerTests def test_publishes_event_after_running_command observer = MiniTest::Mock.new diff --git a/test/retest/runners/runner_interface.rb b/test/retest/runner/runner_interface.rb similarity index 97% rename from test/retest/runners/runner_interface.rb rename to test/retest/runner/runner_interface.rb index e637bb7e..131b3925 100644 --- a/test/retest/runners/runner_interface.rb +++ b/test/retest/runner/runner_interface.rb @@ -1,5 +1,5 @@ module Retest - module Runners + class Runner module RunnerInterfaceTest def test_behaviour assert_respond_to @subject, :== diff --git a/test/retest/runner_test.rb b/test/retest/runner_test.rb new file mode 100644 index 00000000..ca6cda23 --- /dev/null +++ b/test/retest/runner_test.rb @@ -0,0 +1,174 @@ +require 'test_helper' +require_relative 'runner/runner_interface' +require_relative 'runner/observable_runner' + +module Retest + class Runner + class RunnerInterfaceTests < MiniTest::Test + def setup + @command = Command::Hardcoded.new(command: "echo 'hello world'") + @subject = Runner.new(@command) + end + + include RunnerInterfaceTest + include OversableRunnerTests + + private + + def observable_act(subject) + subject.run + end + end + + class RunnerTest < MiniTest::Test + def setup + @command = Command::Hardcoded.new(command: "echo 'hello world'") + @subject = Runner.new(@command) + end + + def test_run + out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb']) } + + assert_match "hello world", out + + out, _ = capture_subprocess_io { @subject.run } + + assert_match "hello world", out + end + + def test_sync_files + @subject.cached_test_file = 'file_path_test.rb' + + @subject.sync(added: [], removed:['something.rb']) + assert_equal 'file_path_test.rb', @subject.cached_test_file + + @subject.sync(added: nil, removed:'something.rb') + assert_equal 'file_path_test.rb', @subject.cached_test_file + + @subject.sync(added: ['a.rb'], removed:['file_path_test.rb']) + assert_nil @subject.cached_test_file + + @subject.cached_test_file = 'file_path_test.rb' + @subject.sync(added: 'a.rb', removed:'file_path_test.rb') + assert_nil @subject.cached_test_file + end + end + + class VariableRunnerTest < MiniTest::Test + def setup + @command = Command::Hardcoded.new(command: "echo ' & '") + @subject = Runner.new(@command, stdout: StringIO.new) + end + + def output + @subject.stdout.string + end + + def test_files_selected_ouptut + _, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } + + assert_equal(<<~EXPECTED, output) + Changed file: file_path.rb + Test file: file_path_test.rb + EXPECTED + end + + def test_run_with_no_match + _, _ = capture_subprocess_io { @subject.run(changed_files: ['another_file_path.rb'], test_files: [nil]) } + + assert_equal(<<~EXPECTED, output) + Changed file: another_file_path.rb + FileNotFound - Retest could not find a matching test file to run. + EXPECTED + end + + def test_run_with_a_file_found + out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } + + assert_match "file_path.rb & file_path_test.rb", out + end + + def test_returns_last_command + out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } + + assert_match "file_path.rb & file_path_test.rb", out + + out, _ = capture_subprocess_io { @subject.run(changed_files: ['another_file_path.rb'], test_files: ['file_path_test.rb']) } + + assert_match "another_file_path.rb & file_path_test.rb", out + end + end + + class ChangeRunnerTest < MiniTest::Test + def setup + @command = Command::Hardcoded.new(command: "echo ''") + @subject = Runner.new(@command, stdout: StringIO.new) + end + + def output + @subject.stdout.string + end + + def test_run_with_no_file_found + _, _ = capture_subprocess_io { @subject.run } + + assert_equal(<<~EXPECTED, output) + FileNotFound - Retest could not find a changed file to run. + EXPECTED + end + + def test_run_with_a_file_found + out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb']) } + + assert_match "file_path.rb", out + end + end + + class TestRunnerTest < MiniTest::Test + def setup + @command = Command::Hardcoded.new(command: "echo 'touch '") + @subject = Runner.new(@command, stdout: StringIO.new) + end + + def output + @subject.stdout.string + end + + def test_run_with_no_file_found + _, _ = capture_subprocess_io { @subject.run(changed_files: [nil], test_files: [nil]) } + + assert_equal(<<~EXPECTED, output) + FileNotFound - Retest could not find a matching test file to run. + EXPECTED + end + + def test_run_with_a_file_found + out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } + + assert_match "touch file_path_test.rb", out + end + + def test_returns_last_command + out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } + + assert_match "touch file_path_test.rb", out + + out, _ = capture_subprocess_io { @subject.run(changed_files: ['some-weird-path.rb'], test_files: ['file_path_test.rb']) } + + assert_match "touch file_path_test.rb", out + end + + def test_run_all_tests + out, _ = capture_subprocess_io { @subject.run_all_tests('file_path.rb file_path_two.rb') } + + assert_equal(<<~EXPECATIONS, @subject.stdout.string) + Test Files Selected: file_path.rb file_path_two.rb + EXPECATIONS + + assert_equal(<<~EXPECATIONS, out) + touch file_path.rb file_path_two.rb + EXPECATIONS + end + end + end +end \ No newline at end of file diff --git a/test/retest/runners/change_runner_test.rb b/test/retest/runners/change_runner_test.rb deleted file mode 100644 index 0377934e..00000000 --- a/test/retest/runners/change_runner_test.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'test_helper' -require_relative 'runner_interface' -require_relative 'observable_runner' - -module Retest - module Runners - class ChangeRunnerInterfaceTests < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'touch '") - @subject = ChangeRunner.new(@command) - end - - include RunnerInterfaceTest - include OversableRunnerTests - - private - - def observable_act(subject) - subject.run(changed_files: ['file_path.rb']) - end - end - - class ChangeRunnerTest < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'touch '") - @subject = ChangeRunner.new(@command, stdout: StringIO.new) - end - - def output - @subject.stdout.string - end - - def test_run_with_no_file_found - _, _ = capture_subprocess_io { @subject.run } - - assert_equal(<<~EXPECTED, output) - 404 - File Not Found - Retest could not find a changed file to run. - EXPECTED - end - - def test_run_with_a_file_found - out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb']) } - - assert_match "touch file_path.rb", out - end - - def test_run_all_tests - assert_raises(NotSupportedError) { @subject.run_all_tests('file_path.rb file_path_two.rb') } - end - end - end -end \ No newline at end of file diff --git a/test/retest/runners/runner_test.rb b/test/retest/runners/runner_test.rb deleted file mode 100644 index 0a622f0d..00000000 --- a/test/retest/runners/runner_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'test_helper' -require_relative 'runner_interface' -require_relative 'observable_runner' - -module Retest - module Runners - class RunnerInterfaceTests < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'hello world'") - @subject = Runner.new(@command) - end - - include RunnerInterfaceTest - include OversableRunnerTests - - private - - def observable_act(subject) - subject.run - end - end - - class RunnerTest < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'hello world'") - @subject = Runner.new(@command) - end - - def test_run - out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb']) } - - assert_match "hello world", out - - out, _ = capture_subprocess_io { @subject.run } - - assert_match "hello world", out - end - - def test_run_all_tests - assert_raises(NotSupportedError) { @subject.run_all_tests('file_path.rb file_path_two.rb') } - end - end - end -end \ No newline at end of file diff --git a/test/retest/runners/test_runner_test.rb b/test/retest/runners/test_runner_test.rb deleted file mode 100644 index 964af06e..00000000 --- a/test/retest/runners/test_runner_test.rb +++ /dev/null @@ -1,88 +0,0 @@ -require 'test_helper' -require_relative 'runner_interface' -require_relative 'observable_runner' - -module Retest - module Runners - class TestRunnerInterfaceTests < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'touch '") - @subject = TestRunner.new(@command) - end - - include RunnerInterfaceTest - include OversableRunnerTests - - private - - def observable_act(subject) - subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) - end - end - - class TestRunnerTest < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'touch '") - @subject = TestRunner.new(@command, stdout: StringIO.new) - end - - def output - @subject.stdout.string - end - - def test_run_with_no_file_found - _, _ = capture_subprocess_io { @subject.run(changed_files: [nil], test_files: [nil]) } - - assert_equal(<<~EXPECTED, output) - 404 - Test File Not Found - Retest could not find a matching test file to run. - EXPECTED - end - - def test_run_with_a_file_found - out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } - - assert_match "touch file_path_test.rb", out - end - - def test_returns_last_command - out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } - - assert_match "touch file_path_test.rb", out - - out, _ = capture_subprocess_io { @subject.run(changed_files: ['some-weird-path.rb'], test_files: ['file_path_test.rb']) } - - assert_match "touch file_path_test.rb", out - end - - def test_sync_files - @subject.cached_test_file = 'file_path_test.rb' - - @subject.sync(added: [], removed:['something.rb']) - assert_equal 'file_path_test.rb', @subject.cached_test_file - - @subject.sync(added: nil, removed:'something.rb') - assert_equal 'file_path_test.rb', @subject.cached_test_file - - @subject.sync(added: ['a.rb'], removed:['file_path_test.rb']) - assert_nil @subject.cached_test_file - - @subject.cached_test_file = 'file_path_test.rb' - @subject.sync(added: 'a.rb', removed:'file_path_test.rb') - assert_nil @subject.cached_test_file - end - - def test_run_all_tests - out, _ = capture_subprocess_io { @subject.run_all_tests('file_path.rb file_path_two.rb') } - - assert_equal(<<~EXPECATIONS, @subject.stdout.string) - Test Files Selected: file_path.rb file_path_two.rb - EXPECATIONS - - assert_equal(<<~EXPECATIONS, out) - touch file_path.rb file_path_two.rb - EXPECATIONS - end - end - end -end \ No newline at end of file diff --git a/test/retest/runners/variable_runner_test.rb b/test/retest/runners/variable_runner_test.rb deleted file mode 100644 index a384174c..00000000 --- a/test/retest/runners/variable_runner_test.rb +++ /dev/null @@ -1,91 +0,0 @@ -require 'test_helper' -require_relative 'runner_interface' -require_relative 'observable_runner' - -module Retest - module Runners - class VariableRunnerInterfaceTests < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'touch & '") - @subject = VariableRunner.new(@command) - end - - include RunnerInterfaceTest - include OversableRunnerTests - - private - - def observable_act(subject) - subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) - end - end - - class VariableRunnerTest < MiniTest::Test - def setup - @command = Command::Hardcoded.new(command: "echo 'touch & '") - @subject = VariableRunner.new(@command, stdout: StringIO.new) - end - - def output - @subject.stdout.string - end - - def test_files_selected_ouptut - _, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } - - assert_equal(<<~EXPECTED, output) - Files Selected: - - changed: file_path.rb - - test: file_path_test.rb - - EXPECTED - end - - def test_run_with_no_match - _, _ = capture_subprocess_io { @subject.run(changed_files: ['another_file_path.rb'], test_files: [nil]) } - - assert_equal(<<~EXPECTED, output) - 404 - Test File Not Found - Retest could not find a matching test file to run. - EXPECTED - end - - def test_run_with_a_file_found - out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } - - assert_match "touch file_path.rb & file_path_test.rb", out - end - - def test_returns_last_command - out, _ = capture_subprocess_io { @subject.run(changed_files: ['file_path.rb'], test_files: ['file_path_test.rb']) } - - assert_match "touch file_path.rb & file_path_test.rb", out - - out, _ = capture_subprocess_io { @subject.run(changed_files: ['another_file_path.rb'], test_files: ['file_path_test.rb']) } - - assert_match "touch another_file_path.rb & file_path_test.rb", out - end - - def test_sync_files - @subject.cached_test_file = 'file_path_test.rb' - - @subject.sync(added: [], removed:['something.rb']) - assert_equal 'file_path_test.rb', @subject.cached_test_file - - @subject.sync(added: nil, removed:'something.rb') - assert_equal 'file_path_test.rb', @subject.cached_test_file - - @subject.sync(added: ['a.rb'], removed:['file_path_test.rb']) - assert_nil @subject.cached_test_file - - @subject.cached_test_file = 'file_path_test.rb' - @subject.sync(added: 'a.rb', removed:'file_path_test.rb') - assert_nil @subject.cached_test_file - end - - def test_run_all_tests - assert_raises(NotSupportedError) { @subject.run_all_tests('file_path.rb file_path_two.rb') } - end - end - end -end \ No newline at end of file diff --git a/test/retest/runners_test.rb b/test/retest/runners_test.rb deleted file mode 100644 index e1b1e153..00000000 --- a/test/retest/runners_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'test_helper' - -module Retest - class RunnersTest < MiniTest::Test - def test_runner_for - skip - command = Command::Rake.new(all: true) - assert_equal Runners::Runner.new('bundle exec rake test'), Runners.runner_for(command) - - command = Command::Hardcoded.new(command: 'echo ') - assert_equal Runners::TestRunner.new('echo '), Runners.runner_for(command) - - command = Command::Hardcoded.new(command: 'echo ') - assert_equal Runners::ChangeRunner.new('echo '), Runners.runner_for(command) - - command = Command::Hardcoded.new(command: 'echo & ') - assert_equal Runners::VariableRunner.new('echo & '), Runners.runner_for(command) - end - end -end \ No newline at end of file diff --git a/test/retest/sounds/sounds_interface.rb b/test/retest/sounds/sounds_interface.rb index aede674a..1da52bae 100644 --- a/test/retest/sounds/sounds_interface.rb +++ b/test/retest/sounds/sounds_interface.rb @@ -1,10 +1,6 @@ -require_relative '../runners/observable_runner' - module Retest module Sounds module SoundsInterfaceTests - include Runners::ObserverInterfaceTests - def test_interface assert_respond_to @subject, :play end