Sha256: 77292f03592c050a23a3a4775748e1c03581b0bf9e02f53d54514b01147b5b91

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module Gendered
  describe NameList do
    subject do
      described_class.new values
    end
    let :values do
      ["Sean","Theresa"] * 50
    end
    describe "#guess!" do
      it "guesses correctly" do
        guesser = double(Guesser)
        expect(guesser).to receive(:guess!)
        expect(Guesser).to receive(:new).with(subject.names).and_return(guesser)
        subject.guess!
      end

      it 'guesses correctly with country id' do
        guesser = double(Guesser)
        expect(guesser).to receive(:guess!).with('us')
        expect(Guesser).to receive(:new).with(subject.names).and_return(guesser)
        subject.guess!('us')
      end
    end
    context "when the values are strings" do
      it "sets the names" do
        subject.names.each.with_index do |name, index|
          expect(name.value).to eq values[index]
        end
      end
    end
    context "when the values are names" do
      let :values do
        [Name.new("Sean"),Name.new("Theresa")]
      end
      it "sets the names" do
        expect(subject.names).to eq values
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gendered-0.0.7 spec/lib/gendered/name_list_spec.rb
gendered-0.0.5 spec/lib/gendered/name_list_spec.rb