17
rspec testlerinde eq
ve eql
kullanımı arasındaki fark nedir?Rspec `eq` vs` eql` `beklemede 'sınama
it "adds the correct information to entries" do
# book = AddressBook.new # => Replaced by line 4
book.add_entry('Ada Lovelace', '010.012.1815', '[email protected]')
new_entry = book.entries[0]
expect(new_entry.name).to eq('Ada Lovelace')
expect(new_entry.phone_number).to eq('010.012.1815')
expect(new_entry.email).to eq('[email protected]')
end
ve:
it "adds the correct information to entries" do
# book = AddressBook.new # => Replaced by line 4
book.add_entry('Ada Lovelace', '010.012.1815', '[email protected]')
new_entry = book.entries[0]
expect(new_entry.name).to eql('Ada Lovelace')
expect(new_entry.phone_number).to eql('010.012.1815')
expect(new_entry.email).to eql('[email protected]')
end
Bir tür dönüştürme, aynı nesne türü olarak karşılaştırılan nesnelerin veya nesnelerin aranması anlamına mı geliyor? – austinthesing
@austinthesing, "42.0 == 42", "true" ve "42.0.eql" üretir. 42 'yanlış' üretir. –