Make the spec aware of our new default event_types

This commit is contained in:
Henne Vogelsang 2014-07-16 14:11:09 +02:00
parent 064e0a3fd7
commit 1d3c84c24d

View file

@ -13,42 +13,45 @@ feature EventType do
visit admin_conference_eventtypes_path( visit admin_conference_eventtypes_path(
conference_id: conference.short_title) conference_id: conference.short_title)
expect(page.all('div.nested-fields').count == 2).to be true
# Add event type # Add event type
click_link 'Add event_type' click_link 'Add event_type'
expect(page.all('div.nested-fields').count == 1).to be true expect(page.all('div.nested-fields').count == 3).to be true
page. page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). find('div.nested-fields:nth-of-type(3) div:nth-of-type(1) input').
set('Example event type') set('Example event type')
page. page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input'). find('div.nested-fields:nth-of-type(3) div:nth-of-type(2) input').
set('60') set('60')
page. page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) input'). find('div.nested-fields:nth-of-type(3) div:nth-of-type(3) input').
set('0') set('0')
page. page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input'). find('div.nested-fields:nth-of-type(3) div:nth-of-type(4) input').
set('300') set('300')
click_button 'Update Conference' click_button 'Update Conference'
# Validations # Validations
expect(flash).to eq('Event types were successfully updated.') expect(flash).to eq('Event types were successfully updated.')
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input'). expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(1) input').
value).to eq('Example event type') value).to eq('Example event type')
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input'). expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(2) input').
value).to eq('60') value).to eq('60')
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(3) input'). expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(3) input').
value).to eq('0') value).to eq('0')
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input'). expect(find('div.nested-fields:nth-of-type(3) div:nth-of-type(4) input').
value).to eq('300') value).to eq('300')
# Remove event type # Remove event type
click_link 'Remove event_type' within("div.nested-fields:nth-of-type(3)") do
expect(page.all('div.nested-fields').count == 0).to be true click_link 'Remove event_type'
end
expect(page.all('div.nested-fields').count == 2).to be true
click_button 'Update Conference' click_button 'Update Conference'
expect(flash).to eq('Event types were successfully updated.') expect(flash).to eq('Event types were successfully updated.')
expect(page.all('div.nested-fields').count == 0).to be true expect(page.all('div.nested-fields').count == 2).to be true
end end
end end