17
rspecテストでeq
とeql
を使用する違いは何ですか?rspec `eq`と` expect`テストのeql`
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
と::
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
タイプ変換は、同じタイプのオブジェクトであると比較されるオブジェクトまたは物を探していることを意味しますか? – austinthesing
これは、 '42.0 == 42'が' true'と '42.0.eql 'を生成することを意味していますか? 42は 'false'を生成する。 –