Skip to content

Commit

Permalink
Add caret > to nudge the user to put a number
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexB52 committed Feb 25, 2024
1 parent bf6fec4 commit c10dd5a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_displaying_options_on_matching_command
assert_match "Test File Selected: foo_test.rb", stdout.tap(&:rewind).read

modify_file('lib/bottles.rb')
assert_match <<~EXPECTED, stdout.tap(&:rewind).read
assert_match <<~EXPECTED.chomp, stdout.tap(&:rewind).read
We found few tests matching: lib/bottles.rb
[0] - test/bottles_test.rb
Expand All @@ -64,6 +64,7 @@ def test_displaying_options_on_matching_command
Which file do you want to use?
Enter the file number now:
>
EXPECTED

assert_match "Test File Selected: foo_test.rb", stdout.tap(&:rewind).read
Expand Down
1 change: 1 addition & 0 deletions lib/retest/prompt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def ask_which_test_to_use(path, files)
Which file do you want to use?
Enter the file number now:
QUESTION
output.print("> ")

options.values[input.gets.chomp.to_i]
end
Expand Down
3 changes: 2 additions & 1 deletion test/retest/prompt_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_ask_which_test_to_use
result = @subject.ask_which_test_to_use("app/models/valuation/holdings.rb", files)

assert_equal "test/models/schedule/holdings_test.rb", result
assert_equal <<~EXPECTED, @subject.read_output
assert_equal <<~EXPECTED.chomp, @subject.read_output
We found few tests matching: app/models/valuation/holdings.rb
[0] - test/models/taxation/holdings_test.rb
Expand All @@ -45,6 +45,7 @@ def test_ask_which_test_to_use
Which file do you want to use?
Enter the file number now:
>
EXPECTED
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_find_test_user_input_question

@subject.find_test('app/models/billing_agent_customer.rb')

assert_equal <<~EXPECTED, @subject.prompt.read_output
assert_equal <<~EXPECTED.chomp, @subject.prompt.read_output
We found few tests matching: app/models/billing_agent_customer.rb
[0] - spec/models/billing_agent_customer_spec.rb
Expand All @@ -27,6 +27,7 @@ def test_find_test_user_input_question
Which file do you want to use?
Enter the file number now:
>
EXPECTED
end

Expand Down
3 changes: 2 additions & 1 deletion test/retest/repository_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_find_test_similar_files_but_no_exact_match

out, _ = capture_subprocess_io { @subject.find_test('app/models/valuation/holdings.rb') }

assert_match <<~EXPECTED, out
assert_match <<~EXPECTED.chomp, out
We found few tests matching: app/models/valuation/holdings.rb
[0] - test/models/taxation/holdings_test.rb
Expand All @@ -143,6 +143,7 @@ def test_find_test_similar_files_but_no_exact_match
Which file do you want to use?
Enter the file number now:
>
EXPECTED
end

Expand Down

0 comments on commit c10dd5a

Please sign in to comment.