17
Was ist der Unterschied zwischen der Verwendung von eq
und eql
in RSPC-Tests? Gibt es einen Unterschied zwischen:Rspec `eq` vs` eql` in `expect` Tests
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
und:
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
Würde eine Typkonvertierung bedeuten, dass die Objekte oder Dinge, die verglichen werden, denselben Objekttyp haben? – austinthesing
@austinthesing bedeutet, dass '42.0 == 42'' true' und '42.0.eql erzeugt? 42 'erzeugt "falsch". –