require 'spec_helper'

feature 'Project\'s ending' do
  include ActiveSupport::Testing::TimeHelpers

  background do
    @project = create(:project, state: 'online', sale_date: -1.seconds.from_now)
    @user = create(:user, password: 'test123')
    login
  end

  scenario 'After reaching ending date' do
    @project.finish
    travel (@project.online_days + 1).days

    visit '/'
    click_on 'Discover'
    click_on @project.name
    expect(page).to_not have_link('Contribute')
  end
end

require 'spec_helper'

feature 'Project\'s ending' do
  include ActiveSupport::Testing::TimeHelpers

  background do
    @project = create(:project, state: 'online', sale_date: -1.seconds.from_now)
    @user = create(:user, password: 'test123')
    login
  end

  scenario 'After reaching ending date' do
    @project.finish

    travel (@project.online_days + 1).days do
      visit '/'
      click_on 'Discover'
      click_on @project.name
      expect(page).to_not have_link('Contribute')
    end
  end
end

Remove time stub in test teardown
Remove time stub in test teardown

ActiveSupport::Testing::TimeHelpers does not include auto removal of
this type of stubs in test teardowns for now.
