parent
63d2980fe3
commit
27fc0acbf8
24 changed files with 388 additions and 116 deletions
|
|
@ -966,8 +966,9 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for new conference' do
|
||||
subject.registration_start_date = nil
|
||||
subject.registration_end_date = nil
|
||||
subject.audience = create(:audience,
|
||||
registration_start_date: nil,
|
||||
registration_end_date: nil)
|
||||
subject.call_for_papers = nil
|
||||
subject.venue = nil
|
||||
subject.rooms = []
|
||||
|
|
@ -980,8 +981,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.call_for_papers = nil
|
||||
subject.rooms = []
|
||||
subject.tracks = []
|
||||
|
|
@ -996,8 +998,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.rooms = []
|
||||
subject.tracks = []
|
||||
|
|
@ -1013,8 +1016,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.rooms = []
|
||||
|
|
@ -1033,8 +1037,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.tracks = []
|
||||
|
|
@ -1054,8 +1059,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.event_types = []
|
||||
|
|
@ -1077,8 +1083,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
subject.difficulty_levels = []
|
||||
|
|
@ -1100,8 +1107,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.audience = create(:audience,
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.today + 14)
|
||||
subject.venue = create(:venue)
|
||||
subject.call_for_papers = create(:call_for_papers)
|
||||
subject.venue = create(:venue)
|
||||
|
|
@ -1114,26 +1122,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2013, 12, 31),
|
||||
registration_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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 10)
|
||||
expect(subject.registration_weeks).to eq(2)
|
||||
end
|
||||
end
|
||||
|
|
@ -1265,15 +1277,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 28)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
|
|
@ -1286,8 +1300,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 7)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1295,8 +1310,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 21)
|
||||
|
||||
create(:registration, conference: subject, created_at: Date.new(2014, 05, 26))
|
||||
create(:registration, conference: subject,
|
||||
|
|
@ -1308,8 +1324,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 28)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
|
|
@ -1322,8 +1339,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 21)
|
||||
|
|
@ -1336,8 +1354,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1348,8 +1367,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.audience = create(:audience,
|
||||
registration_start_date: Date.new(2014, 05, 26),
|
||||
registration_end_date: Date.new(2014, 05, 26) + 35)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
|
|
@ -1391,8 +1411,10 @@ describe Conference do
|
|||
context 'open registration' do
|
||||
|
||||
before do
|
||||
subject.registration_start_date = Date.today - 1
|
||||
subject.registration_end_date = Date.today + 7
|
||||
audience = create(:audience,
|
||||
registration_start_date: Date.today - 1,
|
||||
registration_end_date: Date.today + 7)
|
||||
subject.audience = audience
|
||||
end
|
||||
|
||||
it '#registration_open? is true' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue