rubocop files update and auto correction

This commit is contained in:
raluka 2015-10-21 17:33:53 +02:00
parent 1a62dc930e
commit 1f82fbbdc6
88 changed files with 519 additions and 452 deletions

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Admin::CommentsController, type: :controller do
# It is necessary to use bang version of let to build roles before user
let(:conference) { create(:conference) }
let!(:first_user) { create(:user) }

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Admin::ConferenceController do
# It is necessary to use bang version of let to build roles before user
let(:conference) { create(:conference, end_date: Date.new(2014, 05, 26) + 15) }
let!(:first_user) { create(:user) }
@ -12,11 +11,8 @@ describe Admin::ConferenceController do
let(:participant) { create(:user) }
shared_examples 'access as organizer' do
describe 'PATCH #update' do
context 'valid attributes' do
it 'locates the requested conference' do
patch :update, id: conference.short_title, conference: attributes_for(:conference, title: 'Example Con')
expect(assigns(:conference)).to eq(conference)
@ -37,7 +33,7 @@ describe Admin::ConferenceController do
attributes_for(:conference, title: 'Example Con')
conference.reload
expect(response).to redirect_to edit_admin_conference_path(
conference.short_title)
conference.short_title)
end
it 'sends email notification on conference date update' do
@ -58,7 +54,7 @@ describe Admin::ConferenceController do
conference.reload
expect(flash[:alert]).
to eq("Updating conference failed. Short title can't be blank.")
to eq("Updating conference failed. Short title can't be blank.")
expect(conference.title).to eq('The dog and pony show')
expect(conference.short_title).to eq("#{conference.short_title}")
end
@ -69,9 +65,9 @@ describe Admin::ConferenceController do
short_title: nil)
expect(flash[:alert]).
to eq("Updating conference failed. Short title can't be blank.")
to eq("Updating conference failed. Short title can't be blank.")
expect(response).to redirect_to edit_admin_conference_path(
conference.short_title)
conference.short_title)
end
end
end
@ -91,7 +87,7 @@ describe Admin::ConferenceController do
attributes_for(:conference, short_title: 'dps15')
expect(response).to redirect_to admin_conference_path(
assigns[:conference].short_title)
assigns[:conference].short_title)
end
end
@ -181,9 +177,7 @@ describe Admin::ConferenceController do
context 'no conferences' do
it 'redirect to new conference' do
Conference.all.each do |c|
c.destroy
end
Conference.all.each(&:destroy)
sign_in create(:admin)
get :index
expect(response).to redirect_to new_admin_conference_path
@ -289,7 +283,6 @@ describe Admin::ConferenceController do
describe 'DELETE #remove_user' do
before(:each) do
end
it 'sets selection variable' do
@ -329,13 +322,11 @@ describe Admin::ConferenceController do
end
describe 'organizer access' do
before do
sign_in(organizer)
end
it_behaves_like 'access as organizer'
end
shared_examples 'access as participant or guest' do |path, message|
@ -399,12 +390,9 @@ describe Admin::ConferenceController do
end
it_behaves_like 'access as participant or guest', :root_path, 'You are not authorized to access this area!'
end
describe 'guest access' do
it_behaves_like 'access as participant or guest', :new_user_session_path
end
end

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Admin::RegistrationPeriodsController do
# It is necessary to use bang version of let to build roles before user
let(:conference) { create(:conference) }
let!(:first_user) { create(:user) }
@ -12,15 +11,12 @@ describe Admin::RegistrationPeriodsController do
let(:participant) { create(:user) }
shared_examples 'access as administration or organizer' do
before do
conference.registration_period = create(:registration_period)
end
describe 'PATCH #update' do
context 'valid attributes' do
it 'locates the requested registration period object' do
patch :update, conference_id: conference.short_title, conference: attributes_for(:registration_period)
expect(assigns(:registration_period)).to eq(conference.registration_period)
@ -40,7 +36,7 @@ describe Admin::RegistrationPeriodsController do
attributes_for(:registration_period)
conference.reload
expect(response).to redirect_to admin_conference_registration_period_path(
conference.short_title)
conference.short_title)
end
it 'sends email notification on conference registration date update' do
@ -78,7 +74,7 @@ describe Admin::RegistrationPeriodsController do
registration_period: attributes_for(:registration_period)
expect(response).to redirect_to admin_conference_registration_period_path(
assigns[:conference].short_title)
assigns[:conference].short_title)
end
end
@ -153,12 +149,10 @@ describe Admin::RegistrationPeriodsController do
end
describe 'organizer access' do
before(:each) do
sign_in(organizer)
end
it_behaves_like 'access as administration or organizer'
end
end

View file

@ -28,7 +28,7 @@ describe Admin::UsersController do
patch :update, id: user.id
expect(build(
:user, email: 'new@email.osem', id: user.id).email).
to eq('new@email.osem')
to eq('new@email.osem')
end
it 'redirects to the updated user' do
patch :update, id: user.id

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe ConferenceController do
let(:conference) { create(:conference, splashpage: create(:splashpage, public: true)) }
let(:conference) { create(:conference, splashpage: create(:splashpage, public: true)) }
describe 'GET #index' do
it 'Response code is 200' do
@ -30,5 +30,4 @@ describe ConferenceController do
expect(response.response_code).to eq(200)
end
end
end

View file

@ -5,5 +5,4 @@ FactoryGirl.define do
color '#ffffff'
conference
end
end

View file

@ -8,5 +8,4 @@ FactoryGirl.define do
maximum_abstract_length 500
conference
end
end

View file

@ -50,6 +50,5 @@ FactoryGirl.define do
event.comment_threads << build(:comment, commentable: event)
end
end
end
end

View file

@ -1,6 +1,5 @@
FactoryGirl.define do
factory :role do
factory :organizer_role do
name 'organizer'
end

View file

@ -5,5 +5,4 @@ FactoryGirl.define do
date { Date.today }
conference
end
end

View file

@ -2,6 +2,6 @@
FactoryGirl.define do
factory :splashpage do
public false
public false
end
end

View file

@ -3,5 +3,4 @@ FactoryGirl.define do
user
conference
end
end

View file

@ -5,5 +5,4 @@ FactoryGirl.define do
color '#ffffff'
conference
end
end

View file

@ -4,5 +4,4 @@ FactoryGirl.define do
description 'Lorem Ipsum dolsum'
conference
end
end

View file

@ -8,5 +8,4 @@ FactoryGirl.define do
vposition.vdays << build(:vday, conference: vposition.conference)
end
end
end

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)'\

View file

@ -1,8 +1,6 @@
require 'spec_helper'
describe Commercial do
it { should validate_presence_of(:commercial_id) }
it { should validate_presence_of(:commercial_type) }
end

View file

@ -3,11 +3,9 @@
require 'spec_helper'
describe Conference do
let(:subject) { create(:conference, end_date: '2014-06-30') }
describe '#write_event_distribution_to_db' do
it 'updates pending conferences' do
create(:conference,
start_date: Date.today - 2.weeks,
@ -298,7 +296,6 @@ describe Conference do
expect(subject.get_top_submitter.values).to eq([3, 1])
expect(subject.get_top_submitter.keys).to eq([e2.submitter, e1.submitter])
end
end
describe '#get_targets' do
@ -391,7 +388,6 @@ describe Conference do
describe '#new_program_minutes' do
it 'calculates correct values with events' do
create(:event, conference: subject, event_type: @long, created_at: Time.now - 3.days)
create(:event, conference: subject, event_type: @long)
create(:event, conference: subject, event_type: @short, created_at: Time.now - 3.days)
@ -418,7 +414,6 @@ describe Conference do
end
describe '#difficulty_levels_distribution' do
it 'calculates correct for different difficulty levels' do
create(:event, conference: subject, difficulty_level: @easy)
create(:event, conference: subject, difficulty_level: @easy)
@ -700,7 +695,6 @@ describe Conference do
end
describe '#get_active_conferences' do
it 'returns pending conferences' do
a = create(:conference,
short_title: 'a', start_date: Time.now + 14.days,
@ -744,7 +738,7 @@ describe Conference do
result = [a, b, c]
expect(Conference.get_conferences_without_active_for_dashboard([subject])).
to match_array(result)
to match_array(result)
end
it 'returns all conferences if there are no active conferences' do
@ -762,7 +756,7 @@ describe Conference do
end
it 'return no conferences if there are only two conferences and no pending' do
a = create(:conference, start_date: Time.now - 2.year, end_date: Time.now - 720.days)
a = create(:conference, start_date: Time.now - 2.year, end_date: Time.now - 720.days)
b = create(:conference, start_date: Time.now - 1.year, end_date: Time.now - 360.days)
expect(Conference.get_conferences_without_active_for_dashboard([a, b])).to match_array([])
end
@ -779,11 +773,10 @@ describe Conference do
end
describe '#event_distribution' do
before(:each) do
@conference = create(
:conference,
email_settings: create(:email_settings))
:conference,
email_settings: create(:email_settings))
@conference.email_settings = create(:email_settings)
@options = {}
@ -947,7 +940,6 @@ describe Conference do
end
describe '#get_status' do
before(:each) do
# Setup positive result hash
@result = {}
@ -961,7 +953,7 @@ describe Conference do
@result['splashpage'] = true
# Setup negative result hash
@result_false = Hash.new
@result_false = {}
@result.each { |key, value| @result_false[key] = !value }
@result['short_title'] = @result_false['short_title'] = subject.short_title
@ -1123,7 +1115,6 @@ describe Conference do
end
describe '#registration_weeks' do
it 'calculates new year' do
subject.registration_period = create(:registration_period,
start_date: Date.new(2013, 12, 31),
@ -1154,7 +1145,6 @@ describe Conference do
end
describe '#cfp_weeks' do
it 'calculates new year' do
cfp = create(:call_for_paper)
cfp.start_date = Date.new(2013, 12, 30)
@ -1189,7 +1179,6 @@ describe Conference do
end
describe '#get_submissions_per_week' do
it 'does calculate correct if cfp start date is altered' do
cfp = create(:call_for_paper)
cfp.start_date = Date.new(2014, 05, 26)
@ -1278,7 +1267,6 @@ describe Conference do
end
describe '#get_registrations_per_week' do
it 'pads with zeros if there are no registrations' do
subject.registration_period = create(:registration_period,
start_date: Date.new(2014, 05, 26),
@ -1384,9 +1372,7 @@ describe Conference do
end
describe '#pending?' do
context 'is pending' do
it '#pending? is true' do
subject.start_date = Date.today + 10
expect(subject.pending?).to be true
@ -1394,7 +1380,6 @@ describe Conference do
end
context 'is not pending' do
it '#pending? is false' do
subject.start_date = Date.today - 10
expect(subject.pending?).to be false
@ -1403,16 +1388,13 @@ describe Conference do
end
describe '#registration_open?' do
context 'closed registration' do
it '#registration_open? is false' do
expect(subject.registration_open?).to be false
end
end
context 'open registration' do
before do
enrollment = create(:registration_period,
start_date: Date.today - 1,
@ -1427,17 +1409,13 @@ describe Conference do
end
describe '#cfp_open?' do
context 'closed cfp' do
it '#cfp_open? is false' do
expect(subject.cfp_open?).to be false
end
end
context 'open cfp' do
before do
subject.call_for_paper = create(:call_for_paper)
end
@ -1449,7 +1427,6 @@ describe Conference do
end
describe '#user_registered?' 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) }
@ -1483,7 +1460,6 @@ describe Conference do
end
describe 'validations' do
it 'has a valid factory' do
expect(build(:conference)).to be_valid
end
@ -1517,7 +1493,6 @@ describe Conference do
end
describe 'before create callbacks' do
it 'has an email setting after creation' do
expect(subject.email_settings).not_to be_nil
end

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Event do
describe 'abstract_word_count' do
it 'counts words in abstract' do
event = build(:event)

View file

@ -2,7 +2,6 @@ require 'spec_helper'
describe SponsorshipLevel do
describe 'validations' do
it 'has a valid factory' do
expect(build(:sponsorship_level)).to be_valid
end

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Target do
describe 'validations' do
it 'has a valid factory' do
expect(build(:target)).to be_valid

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe TicketPurchase do
describe 'validations' do
it 'has a valid factory' do
expect(build(:ticket_purchase)).to be_valid
@ -34,7 +33,6 @@ describe TicketPurchase do
it 'is valid with a quantity greater than zero' do
should allow_value(1).for(:quantity)
end
end
describe 'self#purchase' do

View file

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

View file

@ -92,7 +92,6 @@ RSpec.configure do |config|
# Types of tests (controller, feature, model) will
# be inferred from subfolder name
config.infer_spec_type_from_file_location!
end
OmniAuth.config.test_mode = true

View file

@ -1,7 +1,5 @@
RSpec.configure do |config|
config.before(:suite) do
FactoryGirl.lint
end
end

View file

@ -5,7 +5,7 @@ module Flash
return 'none'
end
if results.count > 1
texts = results.map { |r| r.text }
texts = results.map(&:text)
fail "One flash expected, but we had #{texts.inspect}"
end
results.first.text

View file

@ -10,33 +10,33 @@ module OmniauthMacros
def mock_auth_new_user
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'new user name',
email: 'test-1@gmail.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-1',
info: {
name: 'new user name',
email: 'test-1@gmail.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_new_user_fb
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
email: 'test-1@gmail.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
email: 'test-1@gmail.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_existing_user_participant
@ -44,17 +44,17 @@ module OmniauthMacros
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-participant-1',
info: {
name: 'existing user participant name',
email: 'test-participant-1@google.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-participant-1',
info: {
name: 'existing user participant name',
email: 'test-participant-1@google.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
def mock_auth_existing_user_admin
@ -62,16 +62,16 @@ module OmniauthMacros
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:google] =
OmniAuth::AuthHash.new(
provider: 'google',
uid: 'google-test-uid-admin-1',
info: {
name: 'existing user admin name',
email: 'test-admin-1@google.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
provider: 'google',
uid: 'google-test-uid-admin-1',
info: {
name: 'existing user admin name',
email: 'test-admin-1@google.com'
},
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
end
end

View file

@ -3,7 +3,7 @@
RSpec.configure do |config|
config.after(:each, type: :feature) do
ename = RSpec.current_example.full_description
ename = ename.gsub ' ', '_'
ename = ename.tr ' ', '_'
ename.downcase!
ename = ename + '.html'
if RSpec.current_example.exception.present?

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'admin/call_for_papers/show' do
it 'renders call for papers details' do
assign :conference, create(:conference)
assign :call_for_paper, create(:call_for_paper)
@ -11,5 +10,4 @@ describe 'admin/call_for_papers/show' do
expect(rendered).to include(1.day.ago.strftime('%A, %B %-d. %Y'))
expect(rendered).to include(6.days.from_now.strftime('%A, %B %-d. %Y'))
end
end

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'admin/conference/edit' do
it 'renders conference details which are editable' do
@conference = create(:conference, title: 'openSUSE')
assign :conference, @conference

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'admin/conference/show' do
it 'renders conference dashboard' do
conference = create(:conference, title: 'openSUSE')
assign :conference, conference

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'admin/difficulty_levels/index' do
it 'renders difficulty levels' do
@difficulty_level = create(:difficulty_level)
assign :conference, @difficulty_level.conference

View file

@ -1,6 +1,5 @@
require 'spec_helper'
describe 'admin/emails/index' do
it 'renders email templates' do
@conference = create(:conference)
assign :conference, @conference
@ -8,25 +7,25 @@ describe 'admin/emails/index' do
assign :settings, @settings
render
expect(rendered).
to have_selector("input[type='checkbox'][value='1']", count: 9)
to have_selector("input[type='checkbox'][value='1']", count: 9)
expect(rendered).
to have_selector("input[checked='checked'][type='checkbox'][value='1']", count: 6)
to have_selector("input[checked='checked'][type='checkbox'][value='1']", count: 6)
expect(rendered).to include('Lorem Ipsum Dolsum')
expect(rendered).
to include('Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
to include('Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
expect(rendered).
to include('Conference dates have been updated')
to include('Conference dates have been updated')
expect(rendered).
to include('Conference registration dates have been updated')
to include('Conference registration dates have been updated')
expect(rendered).to include('Venue has been updated')
expect(rendered).to include('Venue has been Updated to Sample Location')
expect(rendered).
to include('Call for Papers dates have been updated')
to include('Call for Papers dates have been updated')
expect(rendered).
to include('Please checkout the new updates to submit your proposal for Sample Conference')
to include('Please checkout the new updates to submit your proposal for Sample Conference')
expect(rendered).
to include('Sample Conference Cfp schedule is Public')
to include('Sample Conference Cfp schedule is Public')
expect(rendered).
to include('Call for Papers schedule is Public.Checkout the link')
to include('Call for Papers schedule is Public.Checkout the link')
end
end

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'admin/event_types/index' do
it 'renders event types' do
@event_type = create(:event_type)
assign :conference, @event_type.conference

View file

@ -1,6 +1,5 @@
require 'spec_helper'
describe 'admin/rooms/index' do
it 'renders rooms list' do
@room = create(:room)
assign :conference, @room.conference
@ -8,5 +7,4 @@ describe 'admin/rooms/index' do
expect(rendered).to include('Example Room')
expect(rendered).to include('4')
end
end

View file

@ -6,7 +6,7 @@ describe 'admin/sponsors/index' do
@conference.sponsorship_levels << create(:sponsorship_level, conference: @conference)
@conference.sponsors << create(:sponsor, conference: @conference,
sponsorship_level: @conference.sponsorship_levels.first
)
)
assign :conference, @conference
render
expect(rendered).to include('Example sponsor')

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'admin/tracks/index' do
it 'renders tracks' do
@track = create(:track)
assign :conference, @track.conference

View file

@ -1,14 +1,13 @@
require 'spec_helper'
describe 'admin/volunteers/index' do
it 'renders volunteers days as vdays' do
@vday = create(:vday)
@vday.conference.update_attributes(use_volunteers: true, use_vdays: true)
assign :conference, @vday.conference
render
expect(rendered).to have_selector(
"input[checked='checked'][type='checkbox'][value='1']", count: 2)
"input[checked='checked'][type='checkbox'][value='1']", count: 2)
expect(rendered).to include("#{Date.today.strftime('%Y')}")
expect(rendered).to include("#{Date.today.strftime('%B')}")
expect(rendered).to include("#{Date.today.strftime('%d')}")
@ -18,7 +17,7 @@ describe 'admin/volunteers/index' do
it 'renders volunteers positions as vpositions' do
@vposition = create(:vposition)
@vposition.conference.update_attributes(
use_vpositions: true, use_volunteers: true, use_vdays: true)
use_vpositions: true, use_volunteers: true, use_vdays: true)
assign :conference, @vposition.conference
render
expect(rendered).to include("#{Date.today}")