Sha256: a64ea8199e47feef409826aae939f6464785c40ade716d23a985e67f80ba09fb

Contents?: true

Size: 348 Bytes

Versions: 13

Compression:

Stored size: 348 Bytes

Contents

# encoding: utf-8

RSpec.describe TTY::Prompt::Choices, '#find_by' do
  it "finds a matching choice by key name" do
    collection = [{name: 'large'},{name: 'medium'},{name: 'small'}]
    choice = TTY::Prompt::Choice.from(name: 'small')
    choices = described_class[*collection]
    expect(choices.find_by(:name, 'small')).to eq(choice)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tty-prompt-0.17.2 spec/unit/choices/find_by_spec.rb
tty-prompt-0.17.1 spec/unit/choices/find_by_spec.rb
tty-prompt-0.17.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.12.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.11.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.10.1 spec/unit/choices/find_by_spec.rb
tty-prompt-0.10.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.9.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.8.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.7.1 spec/unit/choices/find_by_spec.rb
tty-prompt-0.7.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.6.0 spec/unit/choices/find_by_spec.rb
tty-prompt-0.5.0 spec/unit/choices/find_by_spec.rb