Rails/RSpec: 'Travel' time helper is not available in feature specs? -
i tried use rails' time helper method travel in 1 of feature specs:
scenario 'published_at allows set publishing date in future'   magazine_article.update_attribute(:published_at, time.now + 1.day)   expect { visit magazine_article_path(magazine_article.magazine_category, magazine_article) }          .to raise_error(activerecord::recordnotfound)    travel 2.days     visit magazine_article_path(magazine_article.magazine_category, magazine_article)     expect(page).to have_content('super awesome article')   end end    it's giving me this:
nomethoderror:    undefined method `travel' #<rspec::examplegroups::magazinearticles::asuser::viewing:0x007f84a7a95640>   what missing?
http://api.rubyonrails.org/classes/activesupport/testing/timehelpers.html
in order use these helpers have include them tests.
you can either including single test suit:
describe myclass   include activesupport::testing::timehelpers end   or globally:
rspec.configure |config|   config.include activesupport::testing::timehelpers end      
Comments
Post a Comment