parent
a620950383
commit
ed55e2bf3a
25 changed files with 529 additions and 131 deletions
|
|
@ -964,8 +964,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for new conference' do
|
||||
subject.registration_start_date = nil
|
||||
subject.registration_end_date = nil
|
||||
subject.call_for_papers = nil
|
||||
subject.venue = nil
|
||||
subject.rooms = []
|
||||
|
|
@ -978,8 +976,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration' do
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = nil
|
||||
subject.rooms = []
|
||||
subject.tracks = []
|
||||
|
|
@ -994,8 +993,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp' do
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.rooms = []
|
||||
subject.tracks = []
|
||||
|
|
@ -1011,8 +1011,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp, venue' do
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.rooms = []
|
||||
|
|
@ -1031,8 +1032,9 @@ describe Conference do
|
|||
|
||||
it 'calculates correct for conference with registration, cfp, venue, rooms' do
|
||||
subject.rooms = [create(:room)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.tracks = []
|
||||
|
|
@ -1052,8 +1054,9 @@ describe Conference do
|
|||
it 'calculates correct for conference with registration, cfp, venue, rooms, tracks' do
|
||||
subject.rooms = [create(:room)]
|
||||
subject.tracks = [create(:track)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.event_types = []
|
||||
|
|
@ -1075,8 +1078,9 @@ describe Conference do
|
|||
subject.rooms = [create(:room)]
|
||||
subject.tracks = [create(:track)]
|
||||
subject.event_types = [create(:event_type)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.difficulty_levels = []
|
||||
|
|
@ -1098,8 +1102,9 @@ describe Conference do
|
|||
subject.tracks = [create(:track)]
|
||||
subject.event_types = [create(:event_type)]
|
||||
subject.difficulty_levels = [create(:difficulty_level)]
|
||||
subject.registration_start_date = Date.today
|
||||
subject.registration_end_date = Date.today + 14
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.venue = create(:venue)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
|
|
@ -1112,26 +1117,30 @@ describe Conference do
|
|||
describe '#registration_weeks' do
|
||||
|
||||
it 'calculates new year' do
|
||||
subject.registration_start_date = Date.new(2013, 12, 31)
|
||||
subject.registration_end_date = Date.new(2013, 12, 30) + 6
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2013, 12, 31),
|
||||
end_date: Date.new(2013, 12, 30) + 6)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is one if start and end are 6 days apart' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 6
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 6)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is one if start and end date are the same' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26)
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26))
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is two if start and end are 10 days apart' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 10
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 10)
|
||||
expect(subject.registration_weeks).to eq(2)
|
||||
end
|
||||
end
|
||||
|
|
@ -1263,15 +1272,17 @@ describe Conference do
|
|||
describe '#get_registrations_per_week' do
|
||||
|
||||
it 'pads with zeros if there are no registrations' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 21
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 21)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are no registrations in one week' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 28
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 28)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
|
|
@ -1284,8 +1295,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'returns [1] if there is one registration on the first day' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 7
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 7)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1293,8 +1305,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'summarized correct if there are registrations every week' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 21
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 21)
|
||||
|
||||
create(:registration, conference: subject, created_at: Date.new(2014, 05, 26))
|
||||
create(:registration, conference: subject,
|
||||
|
|
@ -1306,8 +1319,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'summarized correct if there are registrations every week except the first' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 28
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 28)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
|
|
@ -1320,8 +1334,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'pads left' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 35
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 21)
|
||||
|
|
@ -1334,8 +1349,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'pads middle' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 35
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1346,8 +1362,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'pads right' do
|
||||
subject.registration_start_date = Date.new(2014, 05, 26)
|
||||
subject.registration_end_date = Date.new(2014, 05, 26) + 35
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1389,8 +1406,10 @@ describe Conference do
|
|||
context 'open registration' do
|
||||
|
||||
before do
|
||||
subject.registration_start_date = Date.today - 1
|
||||
subject.registration_end_date = Date.today + 7
|
||||
enrollment = create(:registration_period,
|
||||
start_date: Date.today - 1,
|
||||
end_date: Date.today + 7)
|
||||
subject.registration_period = enrollment
|
||||
end
|
||||
|
||||
it '#registration_open? is true' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue