Removed duplicate methods date_range_string and date_string.

Added tests for date_string function

corrections in the test
This commit is contained in:
gotens1211 2017-02-23 15:20:53 +05:30
parent 3bf8b2472d
commit ec1adbada8
5 changed files with 56 additions and 56 deletions

View file

@ -68,24 +68,6 @@ class Conference < ActiveRecord::Base
after_create :create_free_ticket
def date_range_string
startstr = 'Unknown - '
endstr = 'Unknown'
if start_date.month == end_date.month && start_date.year == end_date.year
startstr = start_date.strftime('%B %d - ')
endstr = end_date.strftime('%d, %Y')
elsif start_date.month != end_date.month && start_date.year == end_date.year
startstr = start_date.strftime('%B %d - ')
endstr = end_date.strftime('%B %d, %Y')
else
startstr = start_date.strftime('%B %d, %Y - ')
endstr = end_date.strftime('%B %d, %Y')
end
result = startstr + endstr
result
end
##
# Checks if the user is registered to the conference
#