Sha256: d5479a52384351e88f18a91b6c5b3e9f459996735113d1134f6757c9987a489f

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module RubyQuiz2
  describe SelectionRules do

    it "does not let a person be their own santa" do
      p1 = double(Person)
      p2 = double(Person)
      expect(p1).to receive(:==).with(p2).and_return(true)
      expect(subject.valid?(p1, p2)).to eq false
    end

    it "does not let a family members select each other" do
      santa = double(Person)
      giftee = double(Person)
      expect(santa).to receive(:related_to?).with(giftee).and_return(true)
      expect(subject.valid?(santa, giftee)).to eq false
    end

    describe "#valid_set?" do
      it "does not multiple people to have the same giftee" do
        s1 = double(Person)
        s2 = double(Person)
        g1 = double(Person)
        sel1 = Selection.new(s1, g1)
        sel2 = Selection.new(s2, g1)
        expect(subject.valid_set?([sel1, sel2])).to eq false
      end
      it "is valid in the basic case" do
        p1 = double(Person)
        p2 = double(Person)
        sel1 = Selection.new(p1, p2)
        sel2 = Selection.new(p2, p1)
        expect(subject.valid_set?([sel1, sel2])).to eq true
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_quiz_2-1.0.0 spec/lib/ruby_quiz_2/selection_rules_spec.rb