File: eql_spec.rb

package info (click to toggle)
ruby-tty-prompt 0.23.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,452 kB
  • sloc: ruby: 8,847; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

RSpec.describe TTY::Prompt::Choice, "#==" do
  it "is true with the same name and value attributes" do
    expect(described_class.new(:large, 1))
      .to eq(described_class.new(:large, 1))
  end

  it "is false with different name attribute" do
    expect(described_class.new(:large, 1))
      .not_to eq(described_class.new(:medium, 1))
  end

  it "is false with different value attribute" do
    expect(described_class.new(:large, 1))
      .not_to eq(described_class.new(:large, 2))
  end

  it "is false with different key attribute" do
    expect(described_class.new(:large, 1, key: "j"))
      .not_to eq(described_class.new(:large, 2, key: "k"))
  end

  it "is false with non-choice object" do
    expect(described_class.new(:large, 1)).not_to eq(:other)
  end
end