spec/unit/yes_no_spec.rb in tty-prompt-0.17.1 vs spec/unit/yes_no_spec.rb in tty-prompt-0.17.2

- old
+ new

@@ -93,9 +93,25 @@ "\e[1A\e[2K\e[1G", "Are you a human? \e[32mnope\e[0m\n" ].join) end + it "accepts regex conflicting characters as suffix" do + prompt.input << "]\n" + prompt.input.rewind + result = prompt.yes?("Are you a human? [ as yes and ] as no") do |q| + q.suffix "[/]" + end + expect(result).to eq(false) + expect(prompt.output.string).to eq([ + "Are you a human? [ as yes and ] as no \e[90m([/])\e[0m ", + "\e[2K\e[1GAre you a human? [ as yes and ] as no \e[90m([/])\e[0m ]", + "\e[2K\e[1GAre you a human? [ as yes and ] as no \e[90m([/])\e[0m ]\n", + "\e[1A\e[2K\e[1G", + "Are you a human? [ as yes and ] as no \e[32m]\e[0m\n" + ].join) + end + it "customizes question through options" do prompt.input << "\r" prompt.input.rewind result = prompt.yes?("Are you a human?", suffix: 'Agree/Disagree', positive: 'Agree', negative: 'Disagree')