Skip to content

Commit

Permalink
Change to allow filtering symbol choice names
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Jul 16, 2020
1 parent a12e760 commit 9728d0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/tty/prompt/list.rb
Expand Up @@ -207,7 +207,7 @@ def choices(values = (not_set = true))
else
filter_value = @filter.join.downcase
@filter_cache[filter_value] ||= @choices.enabled.select do |choice|
choice.name.downcase.include?(filter_value)
choice.name.to_s.downcase.include?(filter_value)
end
end
else
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/select_spec.rb
Expand Up @@ -781,8 +781,8 @@ def exit_message(prompt, choice)
prompt.input << "g" << "\r"
prompt.input.rewind

answer = prompt.select("What size?", %w(Small Medium Large Huge), filter: true)
expect(answer).to eql("Large")
answer = prompt.select("What size?", %i(Small Medium Large Huge), filter: true)
expect(answer).to eql(:Large)

actual_prompt_output = prompt.output.string
expected_prompt_output =
Expand Down

0 comments on commit 9728d0a

Please sign in to comment.