diff --git a/spec/controllers/admin/invitations_controller_spec.rb b/spec/controllers/admin/invitations_controller_spec.rb index f7d6b9d66..efd1c88d5 100644 --- a/spec/controllers/admin/invitations_controller_spec.rb +++ b/spec/controllers/admin/invitations_controller_spec.rb @@ -1,5 +1,3 @@ -require "spec_helper" - RSpec.describe Admin::InvitationsController, type: :controller do let(:invitation) { Fabricate(:student_workshop_invitation) } let(:workshop) { invitation.workshop } diff --git a/spec/controllers/auth_services_controller_spec.rb b/spec/controllers/auth_services_controller_spec.rb index 61fdcfc41..6e76484f6 100644 --- a/spec/controllers/auth_services_controller_spec.rb +++ b/spec/controllers/auth_services_controller_spec.rb @@ -1,6 +1,4 @@ -require "spec_helper" - -RSpec.describe AuthServicesController, type: :controller do +RSpec.describe AuthServicesController do describe "GET #new" do it "redirects when referer is missing" do expected_referer_path = nil diff --git a/spec/controllers/members_controller_spec.rb b/spec/controllers/members_controller_spec.rb index c6158bd86..e4e7d5b69 100644 --- a/spec/controllers/members_controller_spec.rb +++ b/spec/controllers/members_controller_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe MembersController, type: :controller do +RSpec.describe MembersController do describe "GET unsubscribe/#token" do it "redirects to the subscription path when token is valid" do member = Fabricate(:member) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 603e7c80d..8a55a9252 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe ApplicationHelper, type: :helper do +RSpec.describe ApplicationHelper do describe '#contact_email' do it "returns the workshop chapter's email" do workshop = Fabricate(:workshop) diff --git a/spec/mailers/event_invitation_mailer_spec.rb b/spec/mailers/event_invitation_mailer_spec.rb index 687f05c22..99b53c57e 100644 --- a/spec/mailers/event_invitation_mailer_spec.rb +++ b/spec/mailers/event_invitation_mailer_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe EventInvitationMailer, type: :mailer do +RSpec.describe EventInvitationMailer do let(:email) { ActionMailer::Base.deliveries.last } let(:event) { Fabricate(:event, date_and_time: Time.zone.local(2017, 11, 12, 10, 0), name: 'Test event') } let(:coach_event) { Fabricate(:event, date_and_time: Time.zone.local(2017, 11, 12, 10, 0), name: 'Test event', audience: 'Coaches') } diff --git a/spec/mailers/feedback_request_mailer_spec.rb b/spec/mailers/feedback_request_mailer_spec.rb index 5cc94438d..fd00bf0fc 100644 --- a/spec/mailers/feedback_request_mailer_spec.rb +++ b/spec/mailers/feedback_request_mailer_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe FeedbackRequestMailer, type: :mailer do +RSpec.describe FeedbackRequestMailer do let(:email) { ActionMailer::Base.deliveries.last } let(:member) { Fabricate(:member) } let(:feedback_request) { Fabricate(:feedback_request, workshop: workshop, member: member) } diff --git a/spec/mailers/meeting_invitation_mailer_spec.rb b/spec/mailers/meeting_invitation_mailer_spec.rb index 3b7727e13..c07587fe6 100644 --- a/spec/mailers/meeting_invitation_mailer_spec.rb +++ b/spec/mailers/meeting_invitation_mailer_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe MeetingInvitationMailer, type: :mailer do +RSpec.describe MeetingInvitationMailer do let(:meeting) { Fabricate(:meeting) } let(:member) { Fabricate(:member) } let(:invitation) { Fabricate(:meeting_invitation, meeting: meeting, member: member) } diff --git a/spec/mailers/member_mailer_spec.rb b/spec/mailers/member_mailer_spec.rb index f8f4d8f61..b09ed32f6 100644 --- a/spec/mailers/member_mailer_spec.rb +++ b/spec/mailers/member_mailer_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe MemberMailer, type: :mailer do +RSpec.describe MemberMailer do let(:member) { Fabricate(:member) } describe 'welcome_student' do diff --git a/spec/mailers/virtual_workshop_invitation_mailer_spec.rb b/spec/mailers/virtual_workshop_invitation_mailer_spec.rb index df38c4ee6..6b78faf98 100644 --- a/spec/mailers/virtual_workshop_invitation_mailer_spec.rb +++ b/spec/mailers/virtual_workshop_invitation_mailer_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe VirtualWorkshopInvitationMailer, type: :mailer do +RSpec.describe VirtualWorkshopInvitationMailer do let(:email) { ActionMailer::Base.deliveries.last } let(:workshop) { Fabricate(:workshop) } let(:member) { Fabricate(:member) } diff --git a/spec/mailers/workshop_invitation_mailer_spec.rb b/spec/mailers/workshop_invitation_mailer_spec.rb index beb9d4216..2e3d7018c 100644 --- a/spec/mailers/workshop_invitation_mailer_spec.rb +++ b/spec/mailers/workshop_invitation_mailer_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe WorkshopInvitationMailer, type: :mailer do +RSpec.describe WorkshopInvitationMailer do let(:email) { ActionMailer::Base.deliveries.last } let(:workshop) { Fabricate(:workshop, title: 'HTML & CSS') } let(:member) { Fabricate(:member) } diff --git a/spec/models/address_spec.rb b/spec/models/address_spec.rb index 1cafd31f6..e2fba0dc4 100644 --- a/spec/models/address_spec.rb +++ b/spec/models/address_spec.rb @@ -1,3 +1,3 @@ -RSpec.describe Address, type: :model do +RSpec.describe Address do subject(:address) { Fabricate.build(:address) } end diff --git a/spec/models/attendance_warning_spec.rb b/spec/models/attendance_warning_spec.rb index 93c642b55..8f9785546 100644 --- a/spec/models/attendance_warning_spec.rb +++ b/spec/models/attendance_warning_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe AttendanceWarning, type: :model do +RSpec.describe AttendanceWarning do describe '#create' do let(:member) { Fabricate(:member) } let(:admin) { Fabricate(:member) } diff --git a/spec/models/ban_spec.rb b/spec/models/ban_spec.rb index a8c606609..1828f3551 100644 --- a/spec/models/ban_spec.rb +++ b/spec/models/ban_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Ban, type: :model do +RSpec.describe Ban do context 'validates' do it { is_expected.to validate_presence_of(:expires_at) } it { is_expected.to validate_presence_of(:reason) } diff --git a/spec/models/chapter_spec.rb b/spec/models/chapter_spec.rb index 4f12fe979..0dbfc3842 100644 --- a/spec/models/chapter_spec.rb +++ b/spec/models/chapter_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Chapter, type: :model do +RSpec.describe Chapter do it { should validate_presence_of(:city) } it { should validate_length_of(:description).is_at_most(280) } diff --git a/spec/models/concerns/listable_spec.rb b/spec/models/concerns/listable_spec.rb index 3d6f8537d..8ad7574c7 100644 --- a/spec/models/concerns/listable_spec.rb +++ b/spec/models/concerns/listable_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Listable, type: :model do +RSpec.describe Listable do subject(:workshop) { Fabricate(:workshop) } context 'scopes' do diff --git a/spec/models/concerns/permissions_spec.rb b/spec/models/concerns/permissions_spec.rb index 3087d2be5..21ed68e0e 100644 --- a/spec/models/concerns/permissions_spec.rb +++ b/spec/models/concerns/permissions_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Permissions, type: :model do +RSpec.describe Permissions do subject(:member) { Fabricate(:member) } let(:chapter) { Fabricate(:chapter) } diff --git a/spec/models/eligibility_inquiry_spec.rb b/spec/models/eligibility_inquiry_spec.rb index 9df56cb71..60f9cb656 100644 --- a/spec/models/eligibility_inquiry_spec.rb +++ b/spec/models/eligibility_inquiry_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe EligibilityInquiry, type: :model do +RSpec.describe EligibilityInquiry do describe '#create' do let(:member) { Fabricate(:member) } let(:admin) { Fabricate(:member) } diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index d922034c9..462901ba3 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Event, type: :model do +RSpec.describe Event do subject(:event) { Fabricate(:event) } include_examples "Invitable", :invitation, :event include_examples DateTimeConcerns, :event diff --git a/spec/models/feedback_request_spec.rb b/spec/models/feedback_request_spec.rb index c0935cf5b..c14805e7e 100644 --- a/spec/models/feedback_request_spec.rb +++ b/spec/models/feedback_request_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe FeedbackRequest, type: :model do +RSpec.describe FeedbackRequest do subject { Fabricate(:feedback_request) } it { should respond_to(:member) } diff --git a/spec/models/feedback_spec.rb b/spec/models/feedback_spec.rb index 3821e6ad0..88de57990 100644 --- a/spec/models/feedback_spec.rb +++ b/spec/models/feedback_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Feedback, type: :model do +RSpec.describe Feedback do subject(:feedback) { Fabricate.build(:feedback) } context 'validations' do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 82e2db75a..810ae6595 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Group, type: :model do +RSpec.describe Group do subject(:group) { Fabricate.build(:group) } context 'validations' do diff --git a/spec/models/invitation_manager_spec.rb b/spec/models/invitation_manager_spec.rb index 343fd34bb..376dc16c9 100644 --- a/spec/models/invitation_manager_spec.rb +++ b/spec/models/invitation_manager_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe InvitationManager, type: :model do +RSpec.describe InvitationManager do subject(:manager) { InvitationManager.new } let(:chapter) { Fabricate(:chapter) } diff --git a/spec/models/invitation_spec.rb b/spec/models/invitation_spec.rb index f8caf8b31..600603840 100644 --- a/spec/models/invitation_spec.rb +++ b/spec/models/invitation_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Invitation, type: :model do +RSpec.describe Invitation do it_behaves_like InvitationConcerns, :invitation, :event context 'defaults' do diff --git a/spec/models/meeting_invitation_spec.rb b/spec/models/meeting_invitation_spec.rb index b12374522..7e4561765 100644 --- a/spec/models/meeting_invitation_spec.rb +++ b/spec/models/meeting_invitation_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe MeetingInvitation, type: :model do +RSpec.describe MeetingInvitation do it_behaves_like InvitationConcerns, :meeting_invitation, :meeting context 'defaults' do diff --git a/spec/models/meeting_spec.rb b/spec/models/meeting_spec.rb index 30a23d9b6..00490e1af 100644 --- a/spec/models/meeting_spec.rb +++ b/spec/models/meeting_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Meeting, type: :model do +RSpec.describe Meeting do include_examples "Invitable", :meeting_invitation, :meeting include_examples DateTimeConcerns, :meeting diff --git a/spec/models/meeting_talk_spec.rb b/spec/models/meeting_talk_spec.rb index 83275f228..cc919377d 100644 --- a/spec/models/meeting_talk_spec.rb +++ b/spec/models/meeting_talk_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe MeetingTalk, type: :model do +RSpec.describe MeetingTalk do context 'validations' do subject { MeetingTalk.new } diff --git a/spec/models/member_note_spec.rb b/spec/models/member_note_spec.rb index 439bfa42e..d8001fadc 100644 --- a/spec/models/member_note_spec.rb +++ b/spec/models/member_note_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe MemberNote, type: :model do +RSpec.describe MemberNote do context 'Mandatory attributes' do it 'Requires a note' do note = Fabricate.build(:member_note, note: nil) diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index d96fb73ae..7517e0b17 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Member, type: :model do +RSpec.describe Member do let(:member) { Fabricate(:member) } describe 'mandatory attributes' do diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb index 9f5026533..09e10cee2 100644 --- a/spec/models/role_spec.rb +++ b/spec/models/role_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Role, type: :model do +RSpec.describe Role do context 'scopes' do let(:student_role) { Fabricate(:student_role) } let(:coach_role) { Fabricate(:coach_role) } diff --git a/spec/models/sponsor_spec.rb b/spec/models/sponsor_spec.rb index ca9da702c..55c91a2ed 100644 --- a/spec/models/sponsor_spec.rb +++ b/spec/models/sponsor_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Sponsor, type: :model do +RSpec.describe Sponsor do subject(:sponsor) { Fabricate.build(:sponsor) } context 'validations' do diff --git a/spec/models/sponsors_search_spec.rb b/spec/models/sponsors_search_spec.rb index e6fa2ff94..5c79259f2 100644 --- a/spec/models/sponsors_search_spec.rb +++ b/spec/models/sponsors_search_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe SponsorsSearch, type: :model do +RSpec.describe SponsorsSearch do let(:search_params) { { name: Faker::Name.name, chapter: Faker::Name.name } } describe 'initialization params' do diff --git a/spec/models/tutorial_spec.rb b/spec/models/tutorial_spec.rb index 0ee381ac1..a1308efbd 100644 --- a/spec/models/tutorial_spec.rb +++ b/spec/models/tutorial_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Tutorial, type: :model do +RSpec.describe Tutorial do subject(:tutorial) { Fabricate.build(:tutorial) } it { should respond_to(:title) } diff --git a/spec/models/waiting_list_spec.rb b/spec/models/waiting_list_spec.rb index a9a0f1905..5cb78a0df 100644 --- a/spec/models/waiting_list_spec.rb +++ b/spec/models/waiting_list_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe WaitingList, type: :model do +RSpec.describe WaitingList do let(:workshop) { Fabricate(:workshop) } context 'scopes' do diff --git a/spec/models/workshop_invitation_spec.rb b/spec/models/workshop_invitation_spec.rb index 997c457e2..2697d31cd 100644 --- a/spec/models/workshop_invitation_spec.rb +++ b/spec/models/workshop_invitation_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe WorkshopInvitation, type: :model do +RSpec.describe WorkshopInvitation do subject(:workshop_invitation) { Fabricate(:workshop_invitation) } it_behaves_like InvitationConcerns, :workshop_invitation, :workshop diff --git a/spec/models/workshop_spec.rb b/spec/models/workshop_spec.rb index e45bc61cd..f155b8d86 100644 --- a/spec/models/workshop_spec.rb +++ b/spec/models/workshop_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe Workshop, type: :model do +RSpec.describe Workshop do subject(:workshop) { Fabricate(:workshop) } include_examples "Invitable", :workshop_invitation, :workshop include_examples DateTimeConcerns, :workshop diff --git a/spec/models/workshop_sponsor_spec.rb b/spec/models/workshop_sponsor_spec.rb index e2c1f49fa..458881cbc 100644 --- a/spec/models/workshop_sponsor_spec.rb +++ b/spec/models/workshop_sponsor_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe WorkshopSponsor, type: :model do +RSpec.describe WorkshopSponsor do context 'validates' do it 'sponsor_id for uniqueness' do is_expected.to validate_uniqueness_of(:sponsor_id) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b33d3f229..e05afeaf4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -42,6 +42,7 @@ def self.branch_coverage? config.include LoginHelpers config.include ActiveSupport::Testing::TimeHelpers config.include SelectFromChosen, type: :feature + config.infer_spec_type_from_file_location! config.use_transactional_fixtures = false config.infer_base_class_for_anonymous_controllers = false config.order = 'random' @@ -90,7 +91,6 @@ def self.branch_coverage? DatabaseCleaner.clean end - config.after do |example| # Take a screenshot if the example failed and JavaScript is enabled if example.exception && defined?(page) && Capybara.current_driver == :chrome