it { expect(Max.of(2)).to eq 2 } ✔ it { expect(Max.of(4,5)).to eq 5 } ✔ end module Max def self.of(*numbers) current_max = numbers.first numbers.each do |num| if num > current_max current_max = num end end current_max end end
it { expect(Max.of(2)).to eq 2 } ✔ it { expect(Max.of(4,5)).to eq 5 } ✔ end module Max def self.of(*numbers) current_max = numbers.first numbers.each do |num| if num > current_max current_max = num end end current_max end end
it { expect(Max.of(2)).to eq 2 } ✔ it { expect(Max.of(4,5)).to eq 5 } ✔ end module Max def self.of(*numbers) current_max = numbers.first numbers.each do |num| if true current_max = num end end current_max end end Mutation
it { expect(Max.of(2)).to eq 2 } ✔ it { expect(Max.of(4,5)).to eq 5 } ✔ it { expect(Max.of(7,6)).to eq 7 } ✘ end module Max def self.of(*numbers) numbers.last end end
it { expect(Max.of(2)).to eq 2 } ✔ it { expect(Max.of(4,5)).to eq 5 } ✔ it { expect(Max.of(7,6)).to eq 7 } ✔ end module Max def self.of(*numbers) current_max = numbers.first numbers.each do |num| if num > current_max current_max = num end end current_max end end