ruby on rails - Past time while testing with Rspec -
i'm curious on practices around testing time in rspec, ie. datetime data type , date data type. on shorthand, problem have, i'm trying test lsting page ie. index.html.erb looking past tense time method use not future tense time method.
require 'spec_helper' describe 'list objects' 'shows objects' object11 = object.create( title: 'local stuff', description: 'an article on local disputes', posted_from: 'new jersey', posted_by: 'ned flanders', posted_at: 6.days.from_now <-- looking past tense time method use. ) visit objects_url expect(page).to have_text(object1.title) expect(page).to have_text(object1.description) expect(page).to have_text(object1.posted_from) expect(page).to have_text(object1.posted_by) expect(page).to have_text(object1.posted_from) expect(page).to have_text(object1.posted_at)
i believe looking #ago
method:
object11 = object.create( title: 'local stuff', description: 'an article on local disputes', posted_from: 'new jersey', posted_by: 'ned flanders', posted_at: 6.days.ago )
Comments
Post a Comment