Added documentation for the new method added

This commit is contained in:
Gopesh Tulsyan 2014-05-30 23:52:56 +05:30
parent 506b616341
commit fae5981dc4
3 changed files with 16 additions and 11 deletions

View file

@ -100,14 +100,6 @@ class Conference < ActiveRecord::Base
# * +false+ -> If the conference dates are not set or today isn't in the
# registration period.
# * +true+ -> If today is in the registration period.
def registration_dates_given?
if self.registration_start_date.blank? || self.registration_end_date.blank?
false
else
true
end
end
def registration_open?
today = Date.current
if registration_dates_given?
@ -116,6 +108,19 @@ class Conference < ActiveRecord::Base
false
end
end
##
# Checks if the registration dates for the conference are provided
#
# ====Returns
# * +false+ -> If the conference registration dates are not set
# * +true+ -> If conference registration dates are set
def registration_dates_given?
if self.registration_start_date.blank? || self.registration_end_date.blank?
false
else
true
end
end
##
# Checks if the call for papers for the conference is currently open

View file

@ -1,9 +1,9 @@
= content_for :brand do
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
%div#program
= render 'program'
%div#registration
= render 'registration'
%div#callforpapers
= render 'call_for_papers'

View file

@ -11,7 +11,7 @@ describe 'conference/show.html.haml' do
end
it 'renders program partial' do
expect(render).to include("#{@conference.description}")
expect(rendered).to include("#{@conference.description}")
expect(view).to render_template(partial: 'conference/_program')
end
@ -21,6 +21,6 @@ describe 'conference/show.html.haml' do
end
it 'renders call_for_papers partial' do
expect(render).to include("#{@conference.call_for_papers.description}")
expect(rendered).to include("#{@conference.call_for_papers.description}")
end
end