diff --git a/.rubocop.yml b/.rubocop.yml index 5ee02f6e..ad3e7c36 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,3 +15,8 @@ AllCops: Rails: Enabled: true + +##################### RSpec ################################## + +FactoryBot/AttributeDefinedStatically: + Enabled: true diff --git a/spec/factories/answer.rb b/spec/factories/answer.rb index 8b50ba7f..17aeff1e 100644 --- a/spec/factories/answer.rb +++ b/spec/factories/answer.rb @@ -4,6 +4,6 @@ FactoryBot.define do factory :answer do - title 'Do you?' + title { 'Do you?' } end end diff --git a/spec/factories/booth_request.rb b/spec/factories/booth_request.rb index d8dca42f..702d3c87 100644 --- a/spec/factories/booth_request.rb +++ b/spec/factories/booth_request.rb @@ -4,7 +4,7 @@ FactoryBot.define do factory :booth_request do booth user - role 'responsible' + role { 'responsible' } end end diff --git a/spec/factories/campaigns.rb b/spec/factories/campaigns.rb index e71d9c83..e8c95b46 100644 --- a/spec/factories/campaigns.rb +++ b/spec/factories/campaigns.rb @@ -4,8 +4,8 @@ FactoryBot.define do factory :campaign do - name 'Test Campaign' - utm_campaign 'testcampaign' + name { 'Test Campaign' } + utm_campaign { 'testcampaign' } conference end end diff --git a/spec/factories/cfps.rb b/spec/factories/cfps.rb index aa97ce43..97371814 100644 --- a/spec/factories/cfps.rb +++ b/spec/factories/cfps.rb @@ -6,8 +6,8 @@ FactoryBot.define do factory :cfp do start_date { 1.day.ago } end_date { 2.days.from_now } - cfp_type 'events' - description 'This is a test description' + cfp_type { 'events' } + description { 'This is a test description' } program end end diff --git a/spec/factories/comments.rb b/spec/factories/comments.rb index 432cdb61..d30dca9b 100644 --- a/spec/factories/comments.rb +++ b/spec/factories/comments.rb @@ -4,7 +4,7 @@ FactoryBot.define do factory :comment do - body 'Most interresting comment ever, created by a girl.' + body { 'Most interresting comment ever, created by a girl.' } user association :commentable, factory: :event end diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index eab4f7bd..037a58ef 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -9,10 +9,10 @@ FactoryBot.define do timezone { Faker::Address.time_zone } start_date { Time.zone.today } end_date { 6.days.from_now } - start_hour 9 - end_hour 20 - registration_limit 0 - ticket_layout 'portrait' + start_hour { 9 } + end_hour { 20 } + registration_limit { 0 } + ticket_layout { 'portrait' } description { Faker::Hipster.paragraph } organization after(:create) do |conference| diff --git a/spec/factories/difficulty_levels.rb b/spec/factories/difficulty_levels.rb index 528f9f20..b5a8271b 100644 --- a/spec/factories/difficulty_levels.rb +++ b/spec/factories/difficulty_levels.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :difficulty_level do - title 'Example Difficulty Level' - description 'Lorem Ipsum dolsum' - color '#ffffff' + title { 'Example Difficulty Level' } + description { 'Lorem Ipsum dolsum' } + color { '#ffffff' } program end end diff --git a/spec/factories/email_settings.rb b/spec/factories/email_settings.rb index d1a612fd..1bbd7c13 100644 --- a/spec/factories/email_settings.rb +++ b/spec/factories/email_settings.rb @@ -4,26 +4,26 @@ FactoryBot.define do factory :email_settings do - send_on_registration true - send_on_accepted false - send_on_rejected false - send_on_confirmed_without_registration false - send_on_conference_dates_updated true - send_on_conference_registration_dates_updated true - send_on_program_schedule_public true - send_on_cfp_dates_updated true - conference_dates_updated_body 'Sample Conference\n New Dates: January 17 - 21 2014' - conference_dates_updated_subject 'Conference dates have been updated' - conference_registration_dates_updated_subject 'Conference registration dates have been updated' - conference_registration_dates_updated_body 'Sample Conference\n New Dates: January 17 - 21 2014' - send_on_venue_updated true - venue_updated_subject 'Venue has been updated' - venue_updated_body 'Venue has been Updated to Sample Location' - registration_subject 'Lorem Ipsum Dolsum' - registration_body 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' - cfp_dates_updated_subject 'Call for Papers dates have been updated' - cfp_dates_updated_body 'Please checkout the new updates to submit your proposal for Sample Conference' - program_schedule_public_subject 'Sample Conference Cfp schedule is Public' - program_schedule_public_body 'Call for Papers schedule is Public.Checkout the link' + send_on_registration { true } + send_on_accepted { false } + send_on_rejected { false } + send_on_confirmed_without_registration { false } + send_on_conference_dates_updated { true } + send_on_conference_registration_dates_updated { true } + send_on_program_schedule_public { true } + send_on_cfp_dates_updated { true } + conference_dates_updated_body { 'Sample Conference\n New Dates: January 17 - 21 2014' } + conference_dates_updated_subject { 'Conference dates have been updated' } + conference_registration_dates_updated_subject { 'Conference registration dates have been updated' } + conference_registration_dates_updated_body { 'Sample Conference\n New Dates: January 17 - 21 2014' } + send_on_venue_updated { true } + venue_updated_subject { 'Venue has been updated' } + venue_updated_body { 'Venue has been Updated to Sample Location' } + registration_subject { 'Lorem Ipsum Dolsum' } + registration_body { 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' } + cfp_dates_updated_subject { 'Call for Papers dates have been updated' } + cfp_dates_updated_body { 'Please checkout the new updates to submit your proposal for Sample Conference' } + program_schedule_public_subject { 'Sample Conference Cfp schedule is Public' } + program_schedule_public_body { 'Call for Papers schedule is Public.Checkout the link' } end end diff --git a/spec/factories/event_types.rb b/spec/factories/event_types.rb index 0cd6b884..a9710ea3 100644 --- a/spec/factories/event_types.rb +++ b/spec/factories/event_types.rb @@ -4,11 +4,11 @@ FactoryBot.define do factory :event_type do - title 'Example Event Type' - length 30 - minimum_abstract_length 0 - maximum_abstract_length 500 - color '#ffffff' + title { 'Example Event Type' } + length { 30 } + minimum_abstract_length { 0 } + maximum_abstract_length { 500 } + color { '#ffffff' } program end diff --git a/spec/factories/event_users.rb b/spec/factories/event_users.rb index dec632e7..ce872a66 100644 --- a/spec/factories/event_users.rb +++ b/spec/factories/event_users.rb @@ -8,7 +8,7 @@ FactoryBot.define do Hash[EventUser::ROLES].each_value do |role| factory role do - event_role role + event_role { role } end end end diff --git a/spec/factories/events.rb b/spec/factories/events.rb index 8061f61c..f7861705 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -32,7 +32,7 @@ FactoryBot.define do factory :event_scheduled do transient do - hour nil + hour { nil } end after(:build) do |event, evaluator| diff --git a/spec/factories/payments.rb b/spec/factories/payments.rb index f2e143eb..1ad2502d 100644 --- a/spec/factories/payments.rb +++ b/spec/factories/payments.rb @@ -4,6 +4,6 @@ FactoryBot.define do factory :payment do user conference - status 'unpaid' + status { 'unpaid' } end end diff --git a/spec/factories/programs.rb b/spec/factories/programs.rb index 6ebabb4a..364c9f0c 100644 --- a/spec/factories/programs.rb +++ b/spec/factories/programs.rb @@ -4,8 +4,8 @@ FactoryBot.define do factory :program do - schedule_public false - schedule_fluid false + schedule_public { false } + schedule_fluid { false } conference trait :with_cfp do diff --git a/spec/factories/question_type.rb b/spec/factories/question_type.rb index 70ddff81..522036bf 100644 --- a/spec/factories/question_type.rb +++ b/spec/factories/question_type.rb @@ -4,6 +4,6 @@ FactoryBot.define do factory :question_type do - title 'Multiple Choice' + title { 'Multiple Choice' } end end diff --git a/spec/factories/roles.rb b/spec/factories/roles.rb index a79acb33..990627eb 100644 --- a/spec/factories/roles.rb +++ b/spec/factories/roles.rb @@ -2,22 +2,22 @@ FactoryBot.define do factory :role do - name 'my role' + name { 'my role' } factory :organizer_role do - name 'organizer' + name { 'organizer' } end factory :cfp_role do - name 'cfp' + name { 'cfp' } end factory :info_desk_role do - name 'info_desk' + name { 'info_desk' } end factory :volunteers_coordinator_role do - name 'volunteers_coordinator' + name { 'volunteers_coordinator' } end end end diff --git a/spec/factories/rooms.rb b/spec/factories/rooms.rb index 978c3a5b..6d0ae1ef 100644 --- a/spec/factories/rooms.rb +++ b/spec/factories/rooms.rb @@ -4,13 +4,13 @@ FactoryBot.define do factory :room do name { "Room #{Faker::Address.country}" } - size 4 + size { 4 } venue factory :room_for_100 do - name 'Room for 100' - size 100 + name { 'Room for 100' } + size { 100 } end end end diff --git a/spec/factories/splashpages.rb b/spec/factories/splashpages.rb index aff30334..e06ad383 100644 --- a/spec/factories/splashpages.rb +++ b/spec/factories/splashpages.rb @@ -4,19 +4,20 @@ FactoryBot.define do factory :splashpage do - public false + public { false } factory :full_splashpage do - public true - include_tracks true - include_program true - include_social_media true - include_venue true - include_tickets true - include_registrations true - include_sponsors true - include_lodgings true - include_cfp true + public { true } + + include_tracks { true } + include_program { true } + include_social_media { true } + include_venue { true } + include_tickets { true } + include_registrations { true } + include_sponsors { true } + include_lodgings { true } + include_cfp { true } end end end diff --git a/spec/factories/survey_questions.rb b/spec/factories/survey_questions.rb index 9875f1ca..236b4f0a 100644 --- a/spec/factories/survey_questions.rb +++ b/spec/factories/survey_questions.rb @@ -3,102 +3,102 @@ FactoryBot.define do factory :survey_question do survey - title 'What about this question?' - kind :boolean - min_choices nil - max_choices nil - possible_answers nil + title { 'What about this question?' } + kind { :boolean } + min_choices { nil } + max_choices { nil } + possible_answers { nil } factory :boolean_non_mandatory do - title 'Have you attended the conference before? (Non mandatory)' - kind :boolean + title { 'Have you attended the conference before? (Non mandatory)' } + kind { :boolean } end factory :boolean_mandatory do - title 'Did you attend the info talk about the conference? (Mandatory)' - kind :boolean - mandatory true + title { 'Did you attend the info talk about the conference? (Mandatory)' } + kind { :boolean } + mandatory { true } end # radio buttons factory :choice_mandatory_1_reply do - title 'Choice question with only 1 answer (Mandatory)?' - kind :choice - min_choices 1 - max_choices 1 - possible_answers 'A, B, C' - mandatory true + title { 'Choice question with only 1 answer (Mandatory)?' } + kind { :choice } + min_choices { 1 } + max_choices { 1 } + possible_answers { 'A, B, C' } + mandatory { true } end factory :choice_non_mandatory_1_reply do - title 'Choice question with only 1 answer (Non mandatory)' - kind :choice - min_choices 1 - max_choices 1 - possible_answers 'A, B, C' + title { 'Choice question with only 1 answer (Non mandatory)' } + kind { :choice } + min_choices { 1 } + max_choices { 1 } + possible_answers { 'A, B, C' } end # checkboxes factory :choice_mandatory_2_replies do - title 'Choice question with 2 replies (Mandatory)?' - kind :choice - min_choices 2 - max_choices 2 - possible_answers 'A, B, C' - mandatory true + title { 'Choice question with 2 replies (Mandatory)?' } + kind { :choice } + min_choices { 2 } + max_choices { 2 } + possible_answers { 'A, B, C' } + mandatory { true } end # checkboxes factory :choice_non_mandatory_2_replies do - title 'Choice question with 2 replies (Non mandatory)?' - kind :choice - min_choices 2 - max_choices 2 - possible_answers 'A, B, C' + title { 'Choice question with 2 replies (Non mandatory)?' } + kind { :choice } + min_choices { 2 } + max_choices { 2 } + possible_answers { 'A, B, C' } end factory :string_mandatory do - title 'String question (Mandatory)?' - kind :string - mandatory true + title { 'String question (Mandatory)?' } + kind { :string } + mandatory { true } end factory :string_non_mandatory do - title 'String question (Non mandatory)?' - kind :string + title { 'String question (Non mandatory)?' } + kind { :string } end factory :text_mandatory do - title 'Text question (Mandatory)?' - kind :text - mandatory true + title { 'Text question (Mandatory)?' } + kind { :text } + mandatory { true } end factory :text_non_mandatory do - title 'Text question (Non mandatory)?' - kind :text + title { 'Text question (Non mandatory)?' } + kind { :text } end factory :datetime_mandatory do - title 'Datetime question (Mandatory)?' - kind :datetime - mandatory true + title { 'Datetime question (Mandatory)?' } + kind { :datetime } + mandatory { true } end factory :datetime_non_mandatory do - title 'Datetime question (Non mandatory)?' - kind :datetime + title { 'Datetime question (Non mandatory)?' } + kind { :datetime } end factory :numeric_mandatory do - title 'Numeric question (Mandatory)?' - kind :numeric - mandatory true + title { 'Numeric question (Mandatory)?' } + kind { :numeric } + mandatory { true } end factory :numeric_non_mandatory do - title 'Numeric question (Non mandatory)?' - kind :numeric + title { 'Numeric question (Non mandatory)?' } + kind { :numeric } end end end diff --git a/spec/factories/surveys.rb b/spec/factories/surveys.rb index a179f199..cf44f7ed 100644 --- a/spec/factories/surveys.rb +++ b/spec/factories/surveys.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :survey do - title 'This is my survey' - start_date Date.current - 1.day - end_date Date.current + 1.day + title { 'This is my survey' } + start_date { Date.current - 1.day } + end_date { Date.current + 1.day } factory :conference_survey do association :surveyable, factory: :conference diff --git a/spec/factories/targets.rb b/spec/factories/targets.rb index 8d4aa0ca..929ce4ac 100644 --- a/spec/factories/targets.rb +++ b/spec/factories/targets.rb @@ -5,8 +5,8 @@ FactoryBot.define do factory :target do due_date { 14.days.from_now } - target_count 100 - unit Target.units[:submissions] + target_count { 100 } + unit { Target.units[:submissions] } conference end end diff --git a/spec/factories/ticket_purchases.rb b/spec/factories/ticket_purchases.rb index f3ad7185..f54939e3 100644 --- a/spec/factories/ticket_purchases.rb +++ b/spec/factories/ticket_purchases.rb @@ -5,7 +5,7 @@ FactoryBot.define do user conference ticket - quantity 10 + quantity { 10 } factory :paid_ticket_purchase do after(:build) do |ticket_purchase| payment = create(:payment) diff --git a/spec/factories/tickets.rb b/spec/factories/tickets.rb index b6aed3bb..e71b898f 100644 --- a/spec/factories/tickets.rb +++ b/spec/factories/tickets.rb @@ -3,10 +3,10 @@ FactoryBot.define do factory :ticket do title { "#{Faker::Hipster.word} Ticket" } - price_cents 1000 - price_currency 'USD' + price_cents { 1000 } + price_currency { 'USD' } factory :registration_ticket do - registration_ticket true + registration_ticket { true } end end end diff --git a/spec/factories/tracks.rb b/spec/factories/tracks.rb index b105186f..34bf1b9f 100644 --- a/spec/factories/tracks.rb +++ b/spec/factories/tracks.rb @@ -6,14 +6,14 @@ FactoryBot.define do description { Faker::Lorem.sentence } color { Faker::Color.hex_color } short_name { SecureRandom.urlsafe_base64(5) } - state 'confirmed' - cfp_active true + state { 'confirmed' } + cfp_active { true } program trait :self_organized do association :submitter, factory: :user - state 'new' - cfp_active false + state { 'new' } + cfp_active { false } start_date { Time.zone.today } end_date { Time.zone.today } room diff --git a/spec/factories/users.rb b/spec/factories/users.rb index ea75fc6a..f868a738 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -20,10 +20,10 @@ FactoryBot.define do sequence(:email) { |n| "example#{n}@example.com" } sequence(:name) { |n| "name#{n}" } sequence(:username) { |n| "username#{n}" } - password 'changeme' - password_confirmation 'changeme' + password { 'changeme' } + password_confirmation { 'changeme' } confirmed_at { Time.now } - biography <<-EOS + biography { <<-EOS } Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim nunc, venenatis non sapien convallis, dictum suscipit purus. Vestibulum sed tincidunt tortor. Fusce viverra nisi nisi, quis congue dui faucibus @@ -31,7 +31,7 @@ FactoryBot.define do Quisque cursus facilisis consequat. Etiam volutpat ligula turpis, at gravida. EOS - is_disabled false + is_disabled { false } after(:create) do |user| user.is_admin = false @@ -49,12 +49,12 @@ FactoryBot.define do end trait :disabled do - is_disabled true + is_disabled { true } end end factory :user_xss, parent: :user do - biography '
' + biography { '' } end end diff --git a/spec/factories/vdays.rb b/spec/factories/vdays.rb index c875e8c1..7ed2479c 100644 --- a/spec/factories/vdays.rb +++ b/spec/factories/vdays.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :vday do day { Time.zone.today } - description 'Lorem Ipsum dolsum' + description { 'Lorem Ipsum dolsum' } conference end diff --git a/spec/factories/votes.rb b/spec/factories/votes.rb index ec8b5dfd..038b6afe 100644 --- a/spec/factories/votes.rb +++ b/spec/factories/votes.rb @@ -4,6 +4,6 @@ FactoryBot.define do factory :vote do event user - rating 1 + rating { 1 } end end diff --git a/spec/factories/vpositions.rb b/spec/factories/vpositions.rb index 4f7a0545..69ae8776 100644 --- a/spec/factories/vpositions.rb +++ b/spec/factories/vpositions.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :vposition do - title 'Example Volunteer Position' - description 'Lorem Ipsum dolsum' + title { 'Example Volunteer Position' } + description { 'Lorem Ipsum dolsum' } conference after(:build) do |vposition|