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

@ -25,8 +25,15 @@ Style/EmptyLinesAroundAccessModifier:
Enabled: true Enabled: true
# Do not insert empty line after class definition and before closing class # Do not insert empty line after class definition and before closing class
Style/EmptyLinesAroundBody:
Enabled: true Style/EmptyLinesAroundBlockBody:
EnforcedStyle: no_empty_lines
Style/EmptyLinesAroundClassBody:
EnforcedStyle: no_empty_lines
Style/EmptyLinesAroundModuleBody:
EnforcedStyle: no_empty_lines
# Use hash literal {} instead of Hash.new # Use hash literal {} instead of Hash.new
Style/EmptyLiteral: Style/EmptyLiteral:
@ -93,12 +100,12 @@ Style/AndOr:
Enabled: true Enabled: true
# avoid deep blocks nesting # avoid deep blocks nesting
Style/BlockNesting: Metrics/BlockNesting:
Max: 4 Max: 4
# use do instead of {...} in multiline blocks # use do instead of {...} in multiline blocks
Style/Blocks: Style/BlockDelimiters:
Enabled: true EnforcedStyle: line_count_based
# avoid redundunt curly braces when it is obvious that hash is used # avoid redundunt curly braces when it is obvious that hash is used
Style/BracesAroundHashParameters: Style/BracesAroundHashParameters:

View file

@ -1,218 +1,359 @@
# This configuration was generated by `rubocop --auto-gen-config` # This configuration was generated by
# on 2014-07-21 12:48:09 +0200 using RuboCop version 0.24.1. # `rubocop --auto-gen-config`
# on 2015-10-22 14:30:43 +0200 using RuboCop version 0.34.2.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 3 # Offense count: 2
Lint/DuplicatedKey:
Exclude:
- 'db/migrate/20140801164901_move_conference_media_to_commercial.rb'
- 'db/migrate/20140801170430_move_event_media_to_commercial.rb'
# Offense count: 83
Metrics/AbcSize:
Max: 73
# Offense count: 6
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 200
# Offense count: 9
Metrics/CyclomaticComplexity:
Max: 12
# Offense count: 863
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 207
# Offense count: 87
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 56
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 243
# Offense count: 5
Metrics/PerceivedComplexity:
Max: 15
# Offense count: 18
Style/AccessorMethodName:
Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/models/campaign.rb'
- 'app/models/conference.rb'
- 'app/models/target.rb'
- 'app/models/user.rb'
# Offense count: 4
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassCheck: Style/ClassCheck:
Enabled: false Exclude:
- 'app/helpers/application_helper.rb'
# Offense count: 8 - 'app/models/email_settings.rb'
# Configuration parameters: CountComments. - 'app/models/revision_observer.rb'
Style/ClassLength:
Max: 524
# Offense count: 1 # Offense count: 1
Style/ClassVars: Style/ClassVars:
Enabled: false Exclude:
- 'spec/support/kneet_connections.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: PreferredMethods.
Style/CollectionMethods:
Enabled: false
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/ColonMethodCall: Style/ColonMethodCall:
Enabled: false Exclude:
- 'app/models/contact.rb'
# Offense count: 4 # Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Keywords. # Configuration parameters: Keywords.
Style/CommentAnnotation: Style/CommentAnnotation:
Enabled: false Exclude:
- 'app/models/event_user.rb'
# Offense count: 4 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/CommentIndentation: Style/CommentIndentation:
Enabled: false Exclude:
- 'app/controllers/admin/comments_controller.rb'
- 'app/models/conference.rb'
- 'app/models/track.rb'
# Offense count: 10 # Offense count: 341
Style/CyclomaticComplexity: # Configuration parameters: Exclude.
Max: 16
# Offense count: 5
# Cop supports --auto-correct.
Style/DeprecatedHashMethods:
Enabled: false
# Offense count: 228
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
# Offense count: 150 # Offense count: 97
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/DotPosition: Style/DotPosition:
Enabled: false Enabled: false
# Offense count: 9 # Offense count: 5
Style/DoubleNegation: Style/DoubleNegation:
Enabled: false Exclude:
- 'app/models/conference.rb'
# Offense count: 1 # Offense count: 1
# Configuration parameters: Exclude. # Configuration parameters: Exclude.
Style/FileName: Style/FileName:
Enabled: false Exclude:
- 'Guardfile'
# Offense count: 8 # Offense count: 15
# Configuration parameters: MinBodyLength. # Configuration parameters: MinBodyLength.
Style/GuardClause: Style/GuardClause:
Enabled: false Exclude:
- 'app/controllers/admin/base_controller.rb'
- 'app/controllers/admin/questions_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/conference_registrations_controller.rb'
- 'app/controllers/tickets_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/models/ability.rb'
- 'app/models/conference.rb'
- 'app/models/event.rb'
- 'app/models/registration.rb'
- 'app/models/ticket.rb'
- 'app/models/user.rb'
- 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb'
# Offense count: 27 # Offense count: 27
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength. # Configuration parameters: MaxLineLength.
Style/IfUnlessModifier: Style/IfUnlessModifier:
Enabled: false Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/admin/schedules_controller.rb'
- 'app/controllers/conference_registrations_controller.rb'
- 'app/controllers/proposal_controller.rb'
- 'app/controllers/users/omniauth_callbacks_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/models/conference.rb'
- 'app/models/datatable.rb'
- 'app/models/event.rb'
- 'app/models/ticket_purchase.rb'
- 'app/models/user.rb'
- 'spec/controllers/admin/conferences_controller_spec.rb'
- 'spec/features/omniauth_spec.rb'
- 'spec/support/flash.rb'
- 'spec/support/save_feature_failures.rb'
# Offense count: 2 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/IndentArray: Style/IndentArray:
Enabled: false Exclude:
- 'app/controllers/admin/registrations_controller.rb'
- 'app/models/conference.rb'
# Offense count: 8 # Offense count: 4
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash: Style/IndentHash:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/IndentationConsistency:
Enabled: false
# Offense count: 5 # Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/IndentationWidth: # Configuration parameters: EnforcedStyle, SupportedStyles.
Enabled: false Style/IndentationConsistency:
Exclude:
- 'app/controllers/conference_controller.rb'
- 'app/controllers/users_controller.rb'
- 'app/models/event.rb'
- 'spec/controllers/subscriptions_controller_spec.rb'
- 'spec/models/cfp_spec.rb'
# Offense count: 7 # Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: Width.
Style/IndentationWidth:
Exclude:
- 'app/helpers/application_helper.rb'
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
- 'db/migrate/20141031225545_add_require_handicapped_access_to_questions.rb'
- 'db/migrate/20141031225606_add_attending_with_partner_to_questions.rb'
- 'db/migrate/20141031225620_add_staying_at_suggested_hotel_to_questions.rb'
- 'db/migrate/20141031225635_add_attending_social_events_to_questions.rb'
- 'db/migrate/20141118162030_change_lodging_association_to_conference.rb'
- 'spec/features/event_types_spec.rb'
- 'spec/models/cfp_spec.rb'
# Offense count: 6
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/LeadingCommentSpace: Style/LeadingCommentSpace:
Enabled: false Exclude:
- 'Guardfile'
- 'app/controllers/admin/commercials_controller.rb'
- 'app/controllers/commercials_controller.rb'
- 'app/models/comment.rb'
# Offense count: 5 # Offense count: 8
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/LineEndConcatenation: Style/LineEndConcatenation:
Enabled: false Exclude:
- 'spec/features/cfp_spec.rb'
- 'spec/features/conference_spec.rb'
- 'spec/features/registration_periods_spec.rb'
# Offense count: 515 # Offense count: 7
# Configuration parameters: AllowURI.
Style/LineLength:
Max: 217
# Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MethodDefParentheses: Style/MethodDefParentheses:
Enabled: false Enabled: false
# Offense count: 68 # Offense count: 16
# Configuration parameters: CountComments.
Style/MethodLength:
Max: 134
# Offense count: 14
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/NegatedIf: Style/NegatedIf:
Enabled: false Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/controllers/conference_registrations_controller.rb'
- 'app/controllers/proposal_controller.rb'
- 'app/models/conference.rb'
- 'app/models/datatable.rb'
- 'app/models/event.rb'
- 'app/models/venue.rb'
- 'db/migrate/20140820093735_migrating_supporter_registrations_to_ticket_users.rb'
# Offense count: 18 # Offense count: 18
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next: Style/Next:
Enabled: false Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/models/conference.rb'
- 'db/migrate/20140610173021_change_person_id_to_user_id_in_registrations.rb'
- 'db/migrate/20140611123926_change_person_id_to_user_id_in_votes.rb'
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
- 'db/migrate/20140731165107_move_conference_contact_details_to_contact.rb'
- 'db/migrate/20140801164901_move_conference_media_to_commercial.rb'
- 'db/migrate/20140801170430_move_event_media_to_commercial.rb'
- 'db/migrate/20140812065531_move_conference_registration_data_to_registration_periods.rb'
- 'db/migrate/20140820093735_migrating_supporter_registrations_to_ticket_users.rb'
- 'db/migrate/20140821103643_split_ticket_price_in_price_and_currency.rb'
- 'db/migrate/20140825093132_move_splashpage_attributes_from_conference_to_splashpage.rb'
- 'db/migrate/20141104131625_generate_username.rb'
- 'db/migrate/20141118162030_change_lodging_association_to_conference.rb'
- 'db/migrate/20141128073306_migrate_data_remove_column_include_cfp_in_splash_add_column_include_cfp.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/NumericLiterals: Style/NumericLiterals:
MinDigits: 15 MinDigits: 15
# Offense count: 1 # Offense count: 3
Style/OptionalArguments:
Exclude:
- 'app/models/event.rb'
# Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment. # Configuration parameters: AllowSafeAssignment.
Style/ParenthesesAroundCondition: Style/ParenthesesAroundCondition:
Enabled: false Exclude:
- 'app/controllers/admin/base_controller.rb'
- 'app/controllers/application_controller.rb'
- 'app/helpers/application_helper.rb'
# Offense count: 11 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters. # Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters: Style/PercentLiteralDelimiters:
Enabled: false Exclude:
- 'app/serializers/event_serializer.rb'
# Offense count: 2 # Offense count: 2
# Configuration parameters: NamePrefixBlacklist. # Configuration parameters: NamePrefix, NamePrefixBlacklist.
Style/PredicateName: Style/PredicateName:
Enabled: false Exclude:
- 'app/models/comment.rb'
- 'app/models/contact.rb'
# Offense count: 3 # Offense count: 6
# Configuration parameters: SupportedStyles. # Configuration parameters: SupportedStyles.
Style/RaiseArgs: Style/RaiseArgs:
EnforcedStyle: compact EnforcedStyle: compact
# Offense count: 3 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/RedundantBegin: Style/RedundantBegin:
Enabled: false Exclude:
- 'app/models/revision_observer.rb'
# Offense count: 3 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues. # Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn: Style/RedundantReturn:
Enabled: false Exclude:
- 'app/helpers/application_helper.rb'
# Offense count: 8 # Offense count: 33
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/RedundantSelf: Style/RedundantSelf:
Enabled: false Exclude:
- 'app/models/call_for_paper.rb'
- 'app/models/comment.rb'
- 'app/models/conference.rb'
- 'app/models/event.rb'
- 'app/models/question.rb'
- 'app/models/ticket.rb'
- 'app/models/user.rb'
- 'app/models/venue.rb'
# Offense count: 10 # Offense count: 2
# Configuration parameters: MaxSlashes. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
Style/RegexpLiteral: Style/RegexpLiteral:
Enabled: false Exclude:
- 'Guardfile'
# Offense count: 1
Style/SelfAssignment:
Enabled: false
# Offense count: 3 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SelfAssignment:
Exclude:
- 'app/models/event.rb'
- 'db/migrate/20141104131625_generate_username.rb'
- 'spec/support/save_feature_failures.rb'
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SignalException: Style/SignalException:
Enabled: false Exclude:
- 'app/controllers/admin/base_controller.rb'
# Offense count: 1 - 'app/controllers/application_controller.rb'
# Configuration parameters: Methods. - 'app/models/user.rb'
Style/SingleLineBlockParams: - 'db/migrate/20140730104658_migrate_roles_for_cancancan.rb'
Enabled: false - 'db/migrate/20140820123503_assign_users_to_events.rb'
- 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb'
- 'db/migrate/20150929142405_change_postalcode_format_in_venues.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty. # Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods: Style/SingleLineMethods:
Enabled: false Exclude:
- 'Guardfile'
# Offense count: 285 # Offense count: 20
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg: Style/SingleSpaceBeforeFirstArg:
Enabled: false Exclude:
- 'app/controllers/conference_registrations_controller.rb'
# Offense count: 4 - 'db/migrate/20121223110942_devise_create_users.rb'
# Cop supports --auto-correct. - 'db/migrate/20130107114930_create_versions.rb'
Style/SpaceAfterComma: - 'db/migrate/20140719160903_create_delayed_jobs.rb'
Enabled: false - 'spec/features/venues_spec.rb'
# Offense count: 4 # Offense count: 4
# Cop supports --auto-correct. # Cop supports --auto-correct.
@ -220,12 +361,17 @@ Style/SpaceAfterComma:
Style/SpaceAroundEqualsInParameterDefault: Style/SpaceAroundEqualsInParameterDefault:
Enabled: false Enabled: false
# Offense count: 5 # Offense count: 11
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: MultiSpaceAllowedForOperators.
Style/SpaceAroundOperators: Style/SpaceAroundOperators:
Enabled: false Exclude:
- 'app/controllers/application_controller.rb'
- 'app/models/call_for_paper.rb'
- 'app/models/datatable.rb'
- 'db/migrate/20141128073306_migrate_data_remove_column_include_cfp_in_splash_add_column_include_cfp.rb'
# Offense count: 2 # Offense count: 220
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces: Style/SpaceBeforeBlockBraces:
@ -234,38 +380,56 @@ Style/SpaceBeforeBlockBraces:
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SpaceBeforeSemicolon: Style/SpaceBeforeSemicolon:
Enabled: false Exclude:
- 'Guardfile'
# Offense count: 6 # Offense count: 28
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces: Style/SpaceInsideBlockBraces:
Enabled: false Enabled: false
# Offense count: 4 # Offense count: 15
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SpaceInsideBrackets: Style/SpaceInsideBrackets:
Enabled: false Exclude:
- 'app/models/conference.rb'
- 'app/models/user.rb'
- 'spec/controllers/admin/conferences_controller_spec.rb'
- 'spec/views/admin/events/index.html.haml_spec.rb'
# Offense count: 6 # Offense count: 8
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces: Style/SpaceInsideHashLiteralBraces:
Enabled: false Enabled: false
# Offense count: 1 # Offense count: 28
# Cop supports --auto-correct.
Style/Tab: Style/Tab:
Enabled: false Exclude:
- 'db/migrate/20141031225545_add_require_handicapped_access_to_questions.rb'
- 'db/migrate/20141031225606_add_attending_with_partner_to_questions.rb'
- 'db/migrate/20141031225620_add_staying_at_suggested_hotel_to_questions.rb'
- 'db/migrate/20141031225635_add_attending_social_events_to_questions.rb'
- 'db/migrate/20141118162030_change_lodging_association_to_conference.rb'
- 'spec/features/campaign_spec.rb'
- 'spec/features/event_types_spec.rb'
- 'spec/models/cfp_spec.rb'
# Offense count: 24 # Offense count: 26
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma: Style/TrailingComma:
Enabled: false Exclude:
- 'Guardfile'
- 'app/models/target.rb'
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
- 'spec/controllers/admin/conferences_controller_spec.rb'
- 'spec/models/conference_spec.rb'
# Offense count: 8 # Offense count: 3
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: WordRegex.
Style/WordArray: Style/WordArray:
MinSize: 5 MinSize: 2
Style/AccessorMethodName:
Enabled: false

View file

@ -8,7 +8,7 @@ guard_opts = {
cmd: 'spring rspec' cmd: 'spring rspec'
} }
def model_specs ; 'spec/models' end def model_specs ; 'spec/models' end
def model_spec(model) def model_spec(model)
"spec/models/#{model}_spec.rb" "spec/models/#{model}_spec.rb"
@ -44,7 +44,7 @@ end
def rspec_guards def rspec_guards
watch(%r{^spec/factories/.+\.rb$}) { all_specs } watch(%r{^spec/factories/.+\.rb$}) { all_specs }
watch(%r{^spec/.+_spec\.rb$}) watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
end end
group :rspec do group :rspec do

View file

@ -22,7 +22,7 @@ module Admin
# Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}} # Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}}
def grouped_comments(remarks) def grouped_comments(remarks)
remarks.group_by{ |comment| comment.commentable.conference }.map {|conference, comments| [conference, comments.group_by{|comment| comment.commentable}]}.to_h remarks.group_by{ |comment| comment.commentable.conference }.map {|conference, comments| [conference, comments.group_by(&:commentable)]}.to_h
end end
end end
end end

View file

@ -21,7 +21,7 @@ module Admin
@active_conferences = Conference.get_active_conferences_for_dashboard # pending or the last two @active_conferences = Conference.get_active_conferences_for_dashboard # pending or the last two
@deactive_conferences = Conference. @deactive_conferences = Conference.
get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
@conferences = @active_conferences + @deactive_conferences @conferences = @active_conferences + @deactive_conferences
@recent_users = User.limit(5).order(created_at: :desc) @recent_users = User.limit(5).order(created_at: :desc)
@ -102,7 +102,7 @@ module Admin
@total_submissions = @conference.events.count @total_submissions = @conference.events.count
@new_submissions = @conference.events. @new_submissions = @conference.events.
where('created_at > ?', current_user.last_sign_in_at).count where('created_at > ?', current_user.last_sign_in_at).count
@program_length = @conference.current_program_hours @program_length = @conference.current_program_hours
@new_program_length = @conference.new_program_hours(current_user.last_sign_in_at) @new_program_length = @conference.new_program_hours(current_user.last_sign_in_at)
@ -135,7 +135,7 @@ module Admin
@difficulty_levels_distribution = @conference.difficulty_levels_distribution @difficulty_levels_distribution = @conference.difficulty_levels_distribution
@difficulty_levels_distribution_confirmed = @conference. @difficulty_levels_distribution_confirmed = @conference.
difficulty_levels_distribution(:confirmed) difficulty_levels_distribution(:confirmed)
@tracks_distribution = @conference.tracks_distribution @tracks_distribution = @conference.tracks_distribution
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed) @tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)

View file

@ -6,7 +6,7 @@ module Admin
def update def update
@conference.email_settings.update_attributes(params[:email_settings]) @conference.email_settings.update_attributes(params[:email_settings])
redirect_to(admin_conference_emails_path( redirect_to(admin_conference_emails_path(
@conference.short_title), @conference.short_title),
notice: 'Settings have been successfully updated.') notice: 'Settings have been successfully updated.')
end end

View file

@ -106,7 +106,7 @@ module Admin
def update def update
if @event.submitter.update_attributes(params[:user]) && if @event.submitter.update_attributes(params[:user]) &&
@event.update_attributes(params[:event]) @event.update_attributes(params[:event])
if request.xhr? if request.xhr?
render js: 'index' render js: 'index'

View file

@ -73,12 +73,9 @@ module Admin
# Delete question and its answers # Delete question and its answers
begin begin
Question.transaction do Question.transaction do
@question.destroy @question.destroy
@question.answers.each do |a| @question.answers.each(&:destroy)
a.destroy flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map(&:title).join ','}"
end
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
end end
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
flash[:error] = 'Could not delete question.' flash[:error] = 'Could not delete question.'

View file

@ -53,14 +53,14 @@ module Admin
def registration_params def registration_params
params.require(:registration). params.require(:registration).
permit( permit(
:conference_id, :arrival, :departure, :conference_id, :arrival, :departure,
:volunteer, :volunteer,
vchoice_ids: [], qanswer_ids: [], event_ids: [], vchoice_ids: [], qanswer_ids: [], event_ids: [],
qanswers_attributes: [], qanswers_attributes: [],
user_attributes: [ user_attributes: [
:id, :name, :tshirt, :mobile, :volunteer_experience, :languages, :id, :name, :tshirt, :mobile, :volunteer_experience, :languages,
:nickname, :affiliation]) :nickname, :affiliation])
end end
end end
end end

View file

@ -27,7 +27,7 @@ module Admin
def update def update
if @sponsor.update_attributes(sponsor_params) if @sponsor.update_attributes(sponsor_params)
redirect_to(admin_conference_sponsors_path( redirect_to(admin_conference_sponsors_path(
conference_id: @conference.short_title), conference_id: @conference.short_title),
notice: 'Sponsor successfully updated.') notice: 'Sponsor successfully updated.')
else else
flash[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}." flash[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}."

View file

@ -27,7 +27,7 @@ module Admin
def update def update
if @sponsorship_level.update_attributes(sponsorship_level_params) if @sponsorship_level.update_attributes(sponsorship_level_params)
redirect_to(admin_conference_sponsorship_levels_path( redirect_to(admin_conference_sponsorship_levels_path(
conference_id: @conference.short_title), conference_id: @conference.short_title),
notice: 'Sponsorship level successfully updated.') notice: 'Sponsorship level successfully updated.')
else else
flash[:error] = "Update Sponsorship level failed: #{@sponsorship_level.errors.full_messages.join('. ')}." flash[:error] = "Update Sponsorship level failed: #{@sponsorship_level.errors.full_messages.join('. ')}."

View file

@ -25,9 +25,9 @@ class ApplicationController < ActionController::Base
def after_sign_in_path_for(_resource) def after_sign_in_path_for(_resource)
if (can? :view, Conference) && if (can? :view, Conference) &&
(!session[:return_to] || (!session[:return_to] ||
session[:return_to] && session[:return_to] &&
session[:return_to] == root_path) session[:return_to] == root_path)
admin_conference_index_path admin_conference_index_path
else else
session[:return_to] || root_path session[:return_to] || root_path

View file

@ -59,7 +59,7 @@ class ConferenceRegistrationsController < ApplicationController
if @conference.tickets.any? && !current_user.supports?(@conference) if @conference.tickets.any? && !current_user.supports?(@conference)
redirect_to conference_tickets_path(@conference.short_title) redirect_to conference_tickets_path(@conference.short_title)
else else
redirect_to conference_conference_registrations_path(@conference.short_title) redirect_to conference_conference_registrations_path(@conference.short_title)
end end
else else
flash[:error] = "Could not create your registration for #{@conference.title}: "\ flash[:error] = "Could not create your registration for #{@conference.title}: "\
@ -106,14 +106,14 @@ class ConferenceRegistrationsController < ApplicationController
def registration_params def registration_params
params.require(:registration). params.require(:registration).
permit( permit(
:conference_id, :arrival, :departure, :conference_id, :arrival, :departure,
:volunteer, :volunteer,
vchoice_ids: [], qanswer_ids: [], vchoice_ids: [], qanswer_ids: [],
qanswers_attributes: [], qanswers_attributes: [],
event_ids: [], event_ids: [],
user_attributes: [ user_attributes: [
:username, :email, :name, :password, :password_confirmation] :username, :email, :name, :password, :password_confirmation]
) )
end end
end end

View file

@ -24,11 +24,11 @@ class RegistrationsController < Devise::RegistrationsController
def configure_permitted_parameters def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update) do |u| devise_parameter_sanitizer.for(:account_update) do |u|
u. u.
permit(:email, :password, :password_confirmation, :current_password, :username) permit(:email, :password, :password_confirmation, :current_password, :username)
end end
devise_parameter_sanitizer.for(:sign_up) do |u| devise_parameter_sanitizer.for(:sign_up) do |u|
u. u.
permit(:email, :password, :password_confirmation, :name, :username) permit(:email, :password, :password_confirmation, :name, :username)
end end
end end
end end

View file

@ -184,7 +184,7 @@ module ApplicationHelper
end end
def event_types(conference) def event_types(conference)
all = conference.event_types.map { |et | et.title.pluralize } all = conference.event_types.map { |et| et.title.pluralize }
first = all[0...-1] first = all[0...-1]
last = all[-1] last = all[-1]
ets = '' ets = ''
@ -198,7 +198,7 @@ module ApplicationHelper
end end
def tracks(conference) def tracks(conference)
all = conference.tracks.map {|t| t.name} all = conference.tracks.map(&:name)
first = all[0...-1] first = all[0...-1]
last = all[-1] last = all[-1]
ts = '' ts = ''
@ -215,7 +215,7 @@ module ApplicationHelper
def word_pluralize(count, singular, plural = nil) def word_pluralize(count, singular, plural = nil)
word = if (count == 1 || count =~ /^1(\.0+)?$/) word = if (count == 1 || count =~ /^1(\.0+)?$/)
singular singular
else else
plural || singular.pluralize plural || singular.pluralize
end end

View file

@ -50,12 +50,8 @@ class Ability
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id) can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
can :show, User can :show, User
unless CONFIG['authentication']['ichain']['enabled'] unless CONFIG['authentication']['ichain']['enabled']
can [:show, :create], Registration do |registration| can [:show, :create], Registration, &:new_record?
registration.new_record? can [:show, :create], Event, &:new_record?
end
can [:show, :create], Event do |event|
event.new_record?
end
end end
end end

View file

@ -49,6 +49,7 @@ class CallForPaper < ActiveRecord::Base
&& !self.conference.email_settings.call_for_papers_dates_updates_subject.blank?\ && !self.conference.email_settings.call_for_papers_dates_updates_subject.blank?\
&& !self.conference.email_settings.call_for_papers_dates_updates_template.blank? && !self.conference.email_settings.call_for_papers_dates_updates_template.blank?
end end
## ##
# Checks whether cfp dates is updated # Checks whether cfp dates is updated
# #
@ -72,14 +73,14 @@ class CallForPaper < ActiveRecord::Base
def before_end_of_conference def before_end_of_conference
errors. errors.
add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date) add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
errors. errors.
add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date) add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
end end
def start_after_end_date def start_after_end_date
errors. errors.
add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
end end
end end

View file

@ -1,6 +1,6 @@
## ##
# This class represents a conference # This class represents a conference
# rubocop:disable Style/ClassLength # rubocop:disable Metrics/ClassLength
class Conference < ActiveRecord::Base class Conference < ActiveRecord::Base
require 'uri' require 'uri'
serialize :events_per_week, Hash serialize :events_per_week, Hash
@ -218,7 +218,7 @@ class Conference < ActiveRecord::Base
result[state] = pad_array_left_not_kumulative(start_week, values) result[state] = pad_array_left_not_kumulative(start_week, values)
end end
end end
result['Weeks'] = weeks > 0 ? (1..weeks).to_a : 0 result['Weeks'] = weeks > 0 ? (1..weeks).to_a : 0
end end
result result
end end
@ -232,9 +232,9 @@ class Conference < ActiveRecord::Base
result = [] result = []
if registrations && if registrations &&
registration_period && registration_period &&
registration_period.start_date && registration_period.start_date &&
registration_period.end_date registration_period.end_date
reg = registrations.group(:week).count reg = registrations.group(:week).count
start_week = get_registration_start_week start_week = get_registration_start_week
@ -253,10 +253,10 @@ class Conference < ActiveRecord::Base
result = 0 result = 0
weeks = 0 weeks = 0
if registration_period && if registration_period &&
registration_period.start_date && registration_period.start_date &&
registration_period.end_date registration_period.end_date
weeks = Date.new(registration_period.start_date.year, 12, 31). weeks = Date.new(registration_period.start_date.year, 12, 31).
strftime('%W').to_i strftime('%W').to_i
result = get_registration_end_week - get_registration_start_week + 1 result = get_registration_end_week - get_registration_start_week + 1
end end
@ -353,8 +353,8 @@ class Conference < ActiveRecord::Base
# * +hash+ -> user: submissions # * +hash+ -> user: submissions
def get_top_submitter(limit = 5) def get_top_submitter(limit = 5)
submitter = EventUser.joins(:event). submitter = EventUser.joins(:event).
where('event_role = ? and conference_id = ?', 'submitter', id). where('event_role = ? and conference_id = ?', 'submitter', id).
limit(limit).group(:user_id) limit(limit).group(:user_id)
counter = submitter.order('count_all desc').count counter = submitter.order('count_all desc').count
Conference.calculate_user_submission_hash(submitter, counter) Conference.calculate_user_submission_hash(submitter, counter)
end end
@ -476,12 +476,12 @@ class Conference < ActiveRecord::Base
# * +ActiveRecord+ # * +ActiveRecord+
def self.get_active_conferences_for_dashboard def self.get_active_conferences_for_dashboard
result = Conference.where('start_date > ?', Time.now). result = Conference.where('start_date > ?', Time.now).
select('id, short_title, color, start_date') select('id, short_title, color, start_date')
if result.length == 0 if result.length == 0
result = Conference. result = Conference.
select('id, short_title, color, start_date').limit(2). select('id, short_title, color, start_date').limit(2).
order(start_date: :desc) order(start_date: :desc)
end end
result result
end end
@ -570,9 +570,9 @@ class Conference < ActiveRecord::Base
# * +False+ -> Either conference is not updated or one or more parameter is not set # * +False+ -> Either conference is not updated or one or more parameter is not set
def notify_on_dates_changed? def notify_on_dates_changed?
(self.start_date_changed? || self.end_date_changed?) && (self.start_date_changed? || self.end_date_changed?) &&
self.email_settings.send_on_updated_conference_dates && self.email_settings.send_on_updated_conference_dates &&
!self.email_settings.updated_conference_dates_subject.blank? && !self.email_settings.updated_conference_dates_subject.blank? &&
self.email_settings.updated_conference_dates_template self.email_settings.updated_conference_dates_template
end end
## ##
@ -583,10 +583,10 @@ class Conference < ActiveRecord::Base
# * +False+ -> Either registration date is not updated or one or more parameter is not set # * +False+ -> Either registration date is not updated or one or more parameter is not set
def notify_on_registration_dates_changed? def notify_on_registration_dates_changed?
registration_period && registration_period &&
(registration_period.start_date_changed? || registration_period.end_date_changed?) && (registration_period.start_date_changed? || registration_period.end_date_changed?) &&
email_settings.send_on_updated_conference_registration_dates && email_settings.send_on_updated_conference_registration_dates &&
!email_settings.updated_conference_registration_dates_subject.blank? && !email_settings.updated_conference_registration_dates_subject.blank? &&
email_settings.updated_conference_registration_dates_template email_settings.updated_conference_registration_dates_template
end end
private private

View file

@ -74,7 +74,7 @@ class Datatable
def sort_order def sort_order
colnum = 0 colnum = 0
sort_by = [] sort_by = []
while true loop do
break if !sorted?(colnum) break if !sorted?(colnum)
sort_by << "#{sort_column(colnum)} #{sort_direction(colnum)}" sort_by << "#{sort_column(colnum)} #{sort_direction(colnum)}"
colnum += 1 colnum += 1

View file

@ -20,12 +20,12 @@ class EmailSettings < ActiveRecord::Base
'conference_start_date' => conference.start_date, 'conference_start_date' => conference.start_date,
'conference_end_date' => conference.end_date, 'conference_end_date' => conference.end_date,
'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registrations_url( 'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registrations_url(
conference.short_title, host: CONFIG['url_for_emails']), conference.short_title, host: CONFIG['url_for_emails']),
'conference_splash_link' => Rails.application.routes.url_helpers.conference_url( 'conference_splash_link' => Rails.application.routes.url_helpers.conference_url(
conference.short_title, host: CONFIG['url_for_emails']), conference.short_title, host: CONFIG['url_for_emails']),
'schedule_link' => Rails.application.routes.url_helpers.schedule_conference_url( 'schedule_link' => Rails.application.routes.url_helpers.schedule_conference_url(
conference.short_title, host: CONFIG['url_for_emails']) conference.short_title, host: CONFIG['url_for_emails'])
} }
if conference.call_for_paper if conference.call_for_paper
@ -52,7 +52,7 @@ class EmailSettings < ActiveRecord::Base
if event if event
h['eventtitle'] = event.title h['eventtitle'] = event.title
h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_index_url( h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_index_url(
conference.short_title, host: CONFIG['url_for_emails']) conference.short_title, host: CONFIG['url_for_emails'])
end end
h h
end end

View file

@ -112,8 +112,8 @@ class Event < ActiveRecord::Base
def process_confirmation def process_confirmation
if conference.email_settings.send_on_confirmed_without_registration? && if conference.email_settings.send_on_confirmed_without_registration? &&
conference.email_settings.confirmed_email_template && conference.email_settings.confirmed_email_template &&
conference.email_settings.confirmed_without_registration_subject conference.email_settings.confirmed_without_registration_subject
if conference.registrations.where(user_id: submitter.id).first.nil? if conference.registrations.where(user_id: submitter.id).first.nil?
Mailbot.delay.confirm_reminder_mail(self) Mailbot.delay.confirm_reminder_mail(self)
end end
@ -122,9 +122,9 @@ class Event < ActiveRecord::Base
def process_acceptance(options) def process_acceptance(options)
if conference.email_settings.send_on_accepted && if conference.email_settings.send_on_accepted &&
conference.email_settings.accepted_email_template && conference.email_settings.accepted_email_template &&
conference.email_settings.accepted_subject && conference.email_settings.accepted_subject &&
!options[:send_mail].blank? !options[:send_mail].blank?
Rails.logger.debug 'Sending event acceptance mail' Rails.logger.debug 'Sending event acceptance mail'
Mailbot.delay.acceptance_mail(self) Mailbot.delay.acceptance_mail(self)
end end
@ -132,9 +132,9 @@ class Event < ActiveRecord::Base
def process_rejection(options) def process_rejection(options)
if conference.email_settings.send_on_rejected && if conference.email_settings.send_on_rejected &&
conference.email_settings.rejected_email_template && conference.email_settings.rejected_email_template &&
conference.email_settings.rejected_subject && conference.email_settings.rejected_subject &&
!options[:send_mail].blank? !options[:send_mail].blank?
Rails.logger.debug 'Sending rejected mail' Rails.logger.debug 'Sending rejected mail'
Mailbot.delay.rejection_mail(self) Mailbot.delay.rejection_mail(self)
end end
@ -244,7 +244,7 @@ class Event < ActiveRecord::Base
def before_end_of_conference def before_end_of_conference
errors. errors.
add(:created_at, "can't be after the conference end date!") if conference.end_date && add(:created_at, "can't be after the conference end date!") if conference.end_date &&
(Date.today > conference.end_date) (Date.today > conference.end_date)
end end
end end

View file

@ -58,7 +58,7 @@ class Target < ActiveRecord::Base
numerator = conference.current_program_minutes numerator = conference.current_program_minutes
end end
progress = (numerator / target_count.to_f * 100).round(0).to_s progress = (numerator / target_count.to_f * 100).round(0).to_s
result = { result = {
'target_name' => to_s, 'target_name' => to_s,
'campaign_name' => campaign.name, 'campaign_name' => campaign.name,

View file

@ -38,7 +38,7 @@ class Ticket < ActiveRecord::Base
tickets.each do |ticket| tickets.each do |ticket|
price = ticket.total_price(user) price = ticket.total_price(user)
if result if result
result += price unless price.zero? result += price unless price.zero?
else else
result = price result = price
end end

View file

@ -134,7 +134,7 @@ class User < ActiveRecord::Base
result = {} result = {}
Role::ACTIONABLES.each do |role| Role::ACTIONABLES.each do |role|
resources = self.roles.where(name: role.parameterize.underscore).map{ |myrole| Conference.find(myrole.resource_id).short_title }.join ', ' resources = self.roles.where(name: role.parameterize.underscore).map{ |myrole| Conference.find(myrole.resource_id).short_title }.join ', '
result[role.parameterize.underscore] = "(#{ resources })" unless resources.blank? result[role.parameterize.underscore] = "(#{resources})" unless resources.blank?
end end
result result
end end

View file

@ -33,10 +33,10 @@ class Venue < ActiveRecord::Base
def venue_notify?(conference) def venue_notify?(conference)
(self.name_changed? || self.street_changed?) && (self.name_changed? || self.street_changed?) &&
(!self.name.blank? && !self.street.blank?) && (!self.name.blank? && !self.street.blank?) &&
(conference.email_settings.send_on_venue_update && (conference.email_settings.send_on_venue_update &&
!conference.email_settings.venue_update_subject.blank? && !conference.email_settings.venue_update_subject.blank? &&
conference.email_settings.venue_update_template) conference.email_settings.venue_update_template)
end end
# TODO: create a module to be mixed into model to perform same operation # TODO: create a module to be mixed into model to perform same operation

View file

@ -2,15 +2,15 @@
require 'pathname' require 'pathname'
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
Dir.chdir APP_ROOT do Dir.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a starting point to setup your application.
# Add necessary setup steps to this file: # Add necessary setup steps to this file:
puts "== Installing dependencies ==" puts '== Installing dependencies =='
system "gem install bundler --conservative" system 'gem install bundler --conservative'
system "bundle check || bundle install" system 'bundle check || bundle install'
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml") # unless File.exist?("config/database.yml")
@ -18,12 +18,12 @@ Dir.chdir APP_ROOT do
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system "bin/rake db:setup" system 'bin/rake db:setup'
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*" system 'rm -f log/*'
system "rm -rf tmp/cache" system 'rm -rf tmp/cache'
puts "\n== Restarting application server ==" puts "\n== Restarting application server =="
system "touch tmp/restart.txt" system 'touch tmp/restart.txt'
end end

View file

@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__) require ::File.expand_path('../config/environment', __FILE__)
run Osem::Application run Osem::Application

View file

@ -1,6 +1,6 @@
class CreateAhoyEvents < ActiveRecord::Migration class CreateAhoyEvents < ActiveRecord::Migration
def change def change
create_table :ahoy_events do |t| create_table :ahoy_events do |t|
t.uuid :visit_id t.uuid :visit_id
# user # user
t.integer :user_id t.integer :user_id

View file

@ -42,12 +42,12 @@ class AddEventsPerWeekToConference < ActiveRecord::Migration
end end
if event_version.object_changes && if event_version.object_changes &&
event_version.event == 'create' event_version.event == 'create'
# Increment the new state # Increment the new state
conference.events_per_week[week][:new] += 1 conference.events_per_week[week][:new] += 1
elsif event_version.object_changes && elsif event_version.object_changes &&
event_version.object_changes[:state] event_version.object_changes[:state]
prev_state = event_version.object_changes[:state][0].to_sym prev_state = event_version.object_changes[:state][0].to_sym
next_state = event_version.object_changes[:state][1].to_sym next_state = event_version.object_changes[:state][1].to_sym
@ -55,7 +55,7 @@ class AddEventsPerWeekToConference < ActiveRecord::Migration
# Backward compatibility: deprecated state :review now :new # Backward compatibility: deprecated state :review now :new
if prev_state == :review if prev_state == :review
prev_state = :new prev_state = :new
elsif next_state == :review elsif next_state == :review
next_state = :new next_state = :new
end end

View file

@ -3,7 +3,7 @@ class CreateDelayedJobs < ActiveRecord::Migration
create_table :delayed_jobs, force: true do |table| create_table :delayed_jobs, force: true do |table|
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually. table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
table.text :handler, null: false # YAML-encoded string of the object that will do work table.text :handler, null: false # YAML-encoded string of the object that will do work
table.text :last_error # reason for last failure (See Note below) table.text :last_error # reason for last failure (See Note below)
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
table.datetime :locked_at # Set when a client is working on this object table.datetime :locked_at # Set when a client is working on this object

View file

@ -17,9 +17,7 @@ class MigrateRolesForCancancan < ActiveRecord::Migration
end end
# Delete old roles # Delete old roles
Role.first(old_roles).each do |role| Role.first(old_roles).each(&:destroy)
role.destroy
end
end end
def down def down

View file

@ -42,9 +42,9 @@ class MigratingSupporterRegistrationsToTicketUsers < ActiveRecord::Migration
# Sum up if a user has bought more than one ticket # Sum up if a user has bought more than one ticket
TempSupporterRegistrations.all.each do |s| TempSupporterRegistrations.all.each do |s|
sup_reg = TempSupporterRegistrations.where( sup_reg = TempSupporterRegistrations.where(
ticket_id: s.ticket_id, ticket_id: s.ticket_id,
user_id: s.user_id, user_id: s.user_id,
conference_id: s.conference_id) conference_id: s.conference_id)
quantity = sup_reg.count quantity = sup_reg.count
if quantity > 1 if quantity > 1

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe ConferenceController do 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 describe 'GET #index' do
it 'Response code is 200' do it 'Response code is 200' do
@ -30,5 +30,4 @@ describe ConferenceController do
expect(response.response_code).to eq(200) expect(response.response_code).to eq(200)
end end
end end
end end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@ feature SponsorshipLevel do
scenario 'adds a sponsorship level', feature: true, js: true do scenario 'adds a sponsorship level', feature: true, js: true do
sign_in organizer sign_in organizer
visit admin_conference_sponsorship_levels_path( 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 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) level = create(:sponsorship_level, conference_id: conference.id)
sign_in organizer sign_in organizer
visit edit_admin_conference_sponsorship_level_path( 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' fill_in 'sponsorship_level_title', with: 'Gold'

View file

@ -15,7 +15,6 @@ feature Registration do
end end
context 'who is not registered' do context 'who is not registered' do
scenario 'purchases a ticket', feature: true, js: true do scenario 'purchases a ticket', feature: true, js: true do
visit root_path visit root_path
click_link 'Register' click_link 'Register'
@ -32,7 +31,7 @@ feature Registration do
expect(purchase.quantity).to eq(2) expect(purchase.quantity).to eq(2)
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title)) expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
expect(flash). 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 expect(page.has_content?('2 Business Ticket Tickets for 10')).to be true
end end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/emails/index' do describe 'admin/emails/index' do
it 'renders email templates' do it 'renders email templates' do
@conference = create(:conference) @conference = create(:conference)
assign :conference, @conference assign :conference, @conference
@ -8,25 +7,25 @@ describe 'admin/emails/index' do
assign :settings, @settings assign :settings, @settings
render render
expect(rendered). expect(rendered).
to have_selector("input[type='checkbox'][value='1']", count: 9) to have_selector("input[type='checkbox'][value='1']", count: 9)
expect(rendered). 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 Dolsum')
expect(rendered). expect(rendered).
to include('Lorem ipsum dolor sit amet, consectetuer adipiscing elit') to include('Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
expect(rendered). expect(rendered).
to include('Conference dates have been updated') to include('Conference dates have been updated')
expect(rendered). 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')
expect(rendered).to include('Venue has been Updated to Sample Location') expect(rendered).to include('Venue has been Updated to Sample Location')
expect(rendered). expect(rendered).
to include('Call for Papers dates have been updated') to include('Call for Papers dates have been updated')
expect(rendered). 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). expect(rendered).
to include('Sample Conference Cfp schedule is Public') to include('Sample Conference Cfp schedule is Public')
expect(rendered). 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
end end

View file

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

View file

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

View file

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

View file

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

View file

@ -1,14 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/volunteers/index' do describe 'admin/volunteers/index' do
it 'renders volunteers days as vdays' do it 'renders volunteers days as vdays' do
@vday = create(:vday) @vday = create(:vday)
@vday.conference.update_attributes(use_volunteers: true, use_vdays: true) @vday.conference.update_attributes(use_volunteers: true, use_vdays: true)
assign :conference, @vday.conference assign :conference, @vday.conference
render render
expect(rendered).to have_selector( 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('%Y')}")
expect(rendered).to include("#{Date.today.strftime('%B')}") expect(rendered).to include("#{Date.today.strftime('%B')}")
expect(rendered).to include("#{Date.today.strftime('%d')}") expect(rendered).to include("#{Date.today.strftime('%d')}")
@ -18,7 +17,7 @@ describe 'admin/volunteers/index' do
it 'renders volunteers positions as vpositions' do it 'renders volunteers positions as vpositions' do
@vposition = create(:vposition) @vposition = create(:vposition)
@vposition.conference.update_attributes( @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 assign :conference, @vposition.conference
render render
expect(rendered).to include("#{Date.today}") expect(rendered).to include("#{Date.today}")