rubocop files update and auto correction

This commit is contained in:
raluka 2015-10-21 17:33:53 +02:00
parent 42e8bb11ea
commit 2a30b076b8
88 changed files with 519 additions and 452 deletions

View file

@ -1,7 +1,6 @@
require 'spec_helper'
feature Campaign do
let!(:conference) { create(:conference, short_title: 'osc14') }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
@ -18,7 +17,7 @@ feature Campaign do
click_button 'Create Campaign'
expect(flash).
to eq("Campaign creation failed. Name can't be blank and Utm campaign can't be blank")
to eq("Campaign creation failed. Name can't be blank and Utm campaign can't be blank")
fill_in 'campaign_name', with: 'Test Campaign'
fill_in 'campaign_utm_campaign', with: 'campaign'
@ -31,7 +30,7 @@ feature Campaign do
# Validations
expect(flash).
to eq('Campaign successfully created.')
to eq('Campaign successfully created.')
expect(find('#name_1').text).to eq('Test Campaign')
expect(find('#visits_1').text).to eq('0')
@ -46,7 +45,7 @@ feature Campaign do
fill_in 'campaign_name', with: 'Test Campaign 42'
click_button 'Update Campaign'
expect(flash).
to eq("Campaign 'Test Campaign 42' successfully updated.")
to eq("Campaign 'Test Campaign 42' successfully updated.")
end
end

View file

@ -1,7 +1,6 @@
require 'spec_helper'
feature Conference do
let!(:conference) { create(:conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
@ -17,14 +16,14 @@ feature Conference do
click_button 'Create Call for paper'
expect(flash).
to eq('Creating the call for papers failed. ' +
to eq('Creating the call for papers failed. ' +
"Start date can't be blank. End date can't be blank.")
today = Date.today - 1
page.execute_script(
"$('#conference-start-datepicker').val('#{today.strftime('%d/%m/%Y')}')")
"$('#conference-start-datepicker').val('#{today.strftime('%d/%m/%Y')}')")
page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
"$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '4'
@ -32,7 +31,7 @@ feature Conference do
# Validations
expect(flash).
to eq('Call for papers successfully created.')
to eq('Call for papers successfully created.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('4')
@ -50,10 +49,10 @@ feature Conference do
# Validate update with empty start date will not saved
page.execute_script(
"$('#conference-start-datepicker').val('')")
"$('#conference-start-datepicker').val('')")
click_button 'Update Call for paper'
expect(flash).
to eq('Updating call for papers failed. ' +
to eq('Updating call for papers failed. ' +
"Start date can't be blank.")
# Fill in date
@ -68,7 +67,7 @@ feature Conference do
# Validations
expect(flash).
to eq('Call for papers successfully updated.')
to eq('Call for papers successfully updated.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('0')

View file

@ -16,16 +16,16 @@ feature Conference do
today = Date.today - 1
page.
execute_script("$('#conference-start-datepicker').val('" +
execute_script("$('#conference-start-datepicker').val('" +
"#{today.strftime('%d/%m/%Y')}')")
page.
execute_script("$('#conference-end-datepicker').val('" +
execute_script("$('#conference-end-datepicker').val('" +
"#{(today + 7).strftime('%d/%m/%Y')}')")
click_button 'Create Conference'
expect(flash).
to eq('Conference was successfully created.')
to eq('Conference was successfully created.')
expect(Conference.count).to eq(expected_count)
expect(user.has_role? :organizer, Conference.last).to eq(true)
@ -46,22 +46,22 @@ feature Conference do
click_button 'Update Conference'
expect(flash).
to eq("Updating conference failed. Short title can't be blank.")
to eq("Updating conference failed. Short title can't be blank.")
fill_in 'conference_title', with: 'New Con'
fill_in 'conference_short_title', with: 'NewCon'
day = Date.today + 10
page.
execute_script("$('#conference-start-datepicker').val('" +
execute_script("$('#conference-start-datepicker').val('" +
"#{day.strftime('%d/%m/%Y')}')")
page.
execute_script("$('#conference-end-datepicker').val('" +
execute_script("$('#conference-end-datepicker').val('" +
"#{(day + 7).strftime('%d/%m/%Y')}')")
click_button 'Update Conference'
expect(flash).
to eq('Conference was successfully updated.')
to eq('Conference was successfully updated.')
conference.reload
expect(conference.title).to eq('New Con')

View file

@ -1,13 +1,11 @@
require 'spec_helper'
feature Contact do
let!(:conference) { create(:conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
shared_examples 'update a contact' do
scenario 'sucessfully', feature: true, js: true do
contact = conference.contact
expected_count = Contact.count
@ -26,7 +24,7 @@ feature Contact do
click_button 'Update Contact'
expect(flash).
to eq('Contact details were successfully updated.')
to eq('Contact details were successfully updated.')
contact.reload
expect(contact.email).to eq('example@example.com')
expect(contact.sponsor_email).to eq('sponsor@example.com')
@ -42,5 +40,4 @@ feature Contact do
describe 'organizer' do
it_behaves_like 'update a contact', :organizer
end
end

View file

@ -7,10 +7,9 @@ feature DifficultyLevel do
shared_examples 'difficulty levels' do
scenario 'adds difficulty level', feature: true, js: true do
sign_in organizer
visit admin_conference_difficulty_levels_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
# Add difficulty level
click_link 'Add Difficulty Level'
@ -31,11 +30,10 @@ feature DifficultyLevel do
end
scenario 'updates difficulty level', feature: true, js: true do
conference.difficulty_levels << create(:difficulty_level)
sign_in organizer
visit admin_conference_difficulty_levels_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
# Remove difficulty level
within('table tr:nth-of-type(4)') do
@ -51,7 +49,6 @@ feature DifficultyLevel do
expect(page.has_content?('Hard Events')).to be true
end
end
end
describe 'organizer' do

View file

@ -8,7 +8,6 @@ feature EmailSettings do
shared_examples 'email settings' do
scenario 'updates email settings',
feature: true, js: true do
expected_count = EmailSettings.count
sign_in organizer
@ -54,7 +53,7 @@ feature EmailSettings do
click_button 'Update Email settings'
expect(flash).
to eq('Settings have been successfully updated.')
to eq('Settings have been successfully updated.')
expect(find('#email_settings_registration_subject').
value).to eq('Registration subject')
@ -88,7 +87,6 @@ feature EmailSettings do
value).to eq('Updated conference venue template')
expect(EmailSettings.count).to eq(expected_count)
end
end

View file

@ -7,10 +7,9 @@ feature EventType do
shared_examples 'event types' do
scenario 'adds and updates event type', feature: true, js: true do
sign_in organizer
visit admin_conference_event_types_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
within('table#event_types') do
expect(page.assert_selector('tr', count: 3)).to be true

View file

@ -10,7 +10,7 @@ feature Lodging do
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
# Add lodging
click_link 'Add Lodging'
@ -33,7 +33,7 @@ feature Lodging do
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
expect(page.has_content?('Example Hotel')).to be true
@ -61,7 +61,7 @@ feature Lodging do
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
expect(page.has_content?('Example Hotel')).to be true

View file

@ -2,7 +2,6 @@ require 'spec_helper'
feature Openid do
shared_examples 'sign in with openid' do
scenario 'has option to log in with Google account' do
visit '/accounts/sign_in'
expect(page.has_content?('or sign in using')).to be true

View file

@ -1,7 +1,6 @@
require 'spec_helper'
feature RegistrationPeriod do
# It is necessary to use bang version of let to build roles before user
let!(:conference) { create(:conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
@ -11,20 +10,20 @@ feature RegistrationPeriod do
scenario 'create and update registration period', js: true do
sign_in organizer
visit admin_conference_registration_period_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
click_link 'New Registration Period'
click_button 'Save Registration Period'
expect(flash).
to eq('An error prohibited the Registration Period from being saved: ' \
to eq('An error prohibited the Registration Period from being saved: ' \
"Start date can't be blank. End date can't be blank.")
page.
execute_script("$('#registration-period-start-datepicker').val('" +
execute_script("$('#registration-period-start-datepicker').val('" +
"#{Date.today.strftime('%d/%m/%Y')}')")
page.
execute_script("$('#registration-period-end-datepicker').val('" +
execute_script("$('#registration-period-end-datepicker').val('" +
"#{(Date.today + 7).strftime('%d/%m/%Y')}')")
click_button 'Save Registration Period'

View file

@ -9,7 +9,7 @@ feature Room do
scenario 'adds a room', feature: true, js: true do
sign_in organizer
visit admin_conference_rooms_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
expect(page.has_no_table?('#rooms')).to be true
@ -33,7 +33,7 @@ feature Room do
room = create(:room, conference_id: conference.id)
sign_in organizer
visit edit_admin_conference_room_path(
conference_id: conference.short_title, id: room.id)
conference_id: conference.short_title, id: room.id)
fill_in 'room_name', with: 'Auditorium'
fill_in 'room_size', with: '100'

View file

@ -1,7 +1,6 @@
require 'spec_helper'
feature Splashpage do
# It is necessary to use bang version of let to build roles before user
let!(:conference) { create(:conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }

View file

@ -13,7 +13,7 @@ feature Sponsor do
sign_in organizer
visit admin_conference_sponsors_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
# Add sponsors
click_link 'Add Sponsor'

View file

@ -9,7 +9,7 @@ feature SponsorshipLevel do
scenario 'adds a sponsorship level', feature: true, js: true do
sign_in organizer
visit admin_conference_sponsorship_levels_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
expect(page.has_no_table?('#sponsorship_levels')).to be true
@ -32,7 +32,7 @@ feature SponsorshipLevel do
level = create(:sponsorship_level, conference_id: conference.id)
sign_in organizer
visit edit_admin_conference_sponsorship_level_path(
conference_id: conference.short_title, id: level.id)
conference_id: conference.short_title, id: level.id)
fill_in 'sponsorship_level_title', with: 'Gold'

View file

@ -15,7 +15,6 @@ feature Registration do
end
context 'who is not registered' do
scenario 'purchases a ticket', feature: true, js: true do
visit root_path
click_link 'Register'
@ -32,7 +31,7 @@ feature Registration do
expect(purchase.quantity).to eq(2)
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
expect(flash).
to eq("Thank you for supporting #{conference.title} by purchasing a ticket.")
to eq("Thank you for supporting #{conference.title} by purchasing a ticket.")
expect(page.has_content?('2 Business Ticket Tickets for 10')).to be true
end

View file

@ -7,7 +7,6 @@ feature Track do
shared_examples 'tracks' do
scenario 'adds a track', feature: true, js: true do
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)

View file

@ -1,9 +1,7 @@
require 'spec_helper'
feature User do
shared_examples 'admin ability' do
end
describe 'admin' do

View file

@ -7,12 +7,11 @@ feature Conference do
shared_examples 'venue' do
scenario 'adds and updates venue' do
sign_in organizer
# create the venue
visit admin_conference_venue_path(
conference_id: conference.short_title)
conference_id: conference.short_title)
click_link 'Create Venue'
fill_in 'venue_name', with: 'Example University'
fill_in 'venue_street', with: 'Example Street 42'
@ -25,7 +24,7 @@ feature Conference do
'sadipscing elitr, sed diam nonumy eirmod tempor'
click_button 'Create Venue'
expect(flash).
to eq('Venue was successfully created.')
to eq('Venue was successfully created.')
venue = Conference.find(conference.id).venue
expect(venue.name).to eq('Example University')
expect(venue.street).to eq('Example Street 42')
@ -42,7 +41,7 @@ feature Conference do
fill_in 'venue_description', with: 'new'
click_button 'Update Venue'
expect(flash).
to eq('Venue was successfully updated.')
to eq('Venue was successfully updated.')
venue.reload
expect(venue.name).to eq('Example University new')
expect(venue.website).to eq('www.example.com new')
@ -53,5 +52,4 @@ feature Conference do
describe 'organizer' do
it_behaves_like 'venue'
end
end

View file

@ -19,16 +19,16 @@ feature Conference do
select("#{Date.today.strftime('%Y')}")
page.
find('div.nested-fields:nth-of-type(1) select:nth-of-type(2)').
select("#{Date.today.strftime('%B')}")
select("#{Date.today.strftime('%B')}")
page.
find('div.nested-fields:nth-of-type(1) select:nth-of-type(3)').
select("#{Date.today.strftime('%-d')}")
select("#{Date.today.strftime('%-d')}")
page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea').
set('Example Person')
set('Example Person')
click_button 'Update Conference'
expect(flash).
to eq('Volunteering options were successfully updated.')
to eq('Volunteering options were successfully updated.')
# Validations
expect(find('div.nested-fields:nth-of-type(1) select:nth-of-type(1)').
@ -62,7 +62,7 @@ feature Conference do
expect(page.all('div.nested-fields').count == 1).to be true
page.
find('div.nested-fields:nth-of-type(1) select:nth-of-type(1)').
select("#{Date.today.strftime('%Y')}")
select("#{Date.today.strftime('%Y')}")
page.
find('div.nested-fields:nth-of-type(1) select:nth-of-type(2)').
select("#{Date.today.strftime('%B')}")
@ -74,7 +74,7 @@ feature Conference do
set('Example Person')
click_button 'Update Conference'
expect(flash).
to eq('Volunteering options were successfully updated.')
to eq('Volunteering options were successfully updated.')
# Add vposition
check('Use vpositions')
@ -82,16 +82,16 @@ feature Conference do
expect(page.all('div.nested-fields').count == 2).to be true
page.find('div.vpositions div.nested-fields:nth-of-type(1)'\
' div:nth-of-type(1) input').
set('Example Position')
set('Example Position')
page.find('div.vpositions div.nested-fields:nth-of-type(1)'\
' div:nth-of-type(2) textarea').
set('Example Description')
set('Example Description')
find(:css, "select[id^='conference_vpositions_attributes_']"\
"[id$='_vday_ids']").
find(:option, "#{Date.today.strftime}").select_option
find(:option, "#{Date.today.strftime}").select_option
click_button 'Update Conference'
expect(flash).
to eq('Volunteering options were successfully updated.')
to eq('Volunteering options were successfully updated.')
# Validations
expect(find('div.vpositions div.nested-fields:nth-of-type(1)'\