lib/retest/repository.rb in retest-1.6.0 vs lib/retest/repository.rb in retest-1.6.1
- old
+ new
@@ -1,14 +1,14 @@
module Retest
class Repository
- attr_accessor :files, :cache, :input_stream, :output_stream
+ attr_accessor :files, :cache, :stdin, :stdout
- def initialize(files: [], cache: {}, input_stream: nil, output_stream: nil)
- @cache = cache
- @files = files
- @input_stream = input_stream || STDIN
- @output_stream = output_stream|| STDOUT
+ def initialize(files: [], cache: {}, stdin: $stdin, stdout: $stdout)
+ @cache = cache
+ @files = files
+ @stdin = stdin
+ @stdout = stdout
end
def find_test(path)
return unless path
return if path.empty?
@@ -59,11 +59,11 @@
tests[get_input]
end
end
def ask_question(tests)
- output_stream.puts(<<~QUESTION)
+ stdout.puts(<<~QUESTION)
We found few tests matching: #{@path}
#{list_options(tests)}
Which file do you want to use?
Enter the file number now:
@@ -75,9 +75,9 @@
"[#{index}] - #{file}"
end.join("\n")
end
def get_input
- input_stream.gets.chomp.to_i
+ stdin.gets.chomp.to_i
end
end
end
\ No newline at end of file