My rspec:
it "can show the current month name" do
expect(Calendar.create_date_using_month(1)).to eq '2000-01-01 00:00:00 -0500'
end
failure:
expected: "2000-01-01 00:00:00 -0500"
got: 2000-01-01 00:00:00 -0500
For my code:
def self.create_date_using_month(n)
Time.new(2000,n,1)
end
Should / can I modify RSpec to match the actual string, not the date?
I tried: Date.strptime("{ 2000, 1, 1 }", "{ %Y, %m, %d }")
but it gives me
expected: #<Date: 2000-01-01 ((2451545j,0s,0n),+0s,2299161j)>
got: 2000-01-01 00:00:00 -0500
source
share