is_current method added to check an event is current and function addded to refresh conference_wide_information

This commit is contained in:
AnithaPal 2016-07-15 16:28:03 -04:00
parent 35afdcead4
commit febd3451ad
8 changed files with 74 additions and 2 deletions

View file

@ -327,4 +327,29 @@ describe Event do
expect(other_event.week).to eq 48
end
end
describe 'is_current?' do
let(:past_event) { create(:event, program: conference.program) }
let(:future_event) { create(:event, program: conference.program) }
before do
event.update_attributes(start_time: "#{Time.current}")
past_event.update_attributes(start_time: "#{Time.current - 2.days}")
future_event.update_attributes(start_time: "#{Time.current + 2.days}")
end
it 'returns false for a completed event' do
expect(past_event.is_current?).to be_falsey
end
it 'returns false for a future event' do
expect(future_event.is_current?).to be_falsey
end
it 'returns true for a current event' do
expect(event.is_current?).to be_truthy
end
end
end