forked from hackclub/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename applicant profiles to leader profiles
- Loading branch information
Showing
18 changed files
with
121 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
api/db/migrate/20180127084614_rename_applicant_profiles_to_leader_profiles.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class RenameApplicantProfilesToLeaderProfiles < ActiveRecord::Migration[5.1] | ||
def change | ||
rename_table :applicant_profiles, :leader_profiles | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
api/spec/factories/applicant_profiles.rb → api/spec/factories/leader_profiles.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
require 'rails_helper' | ||
|
||
RSpec.describe ApplicantProfile, type: :model do | ||
RSpec.describe LeaderProfile, type: :model do | ||
## db columns ## | ||
|
||
# metadata | ||
|
@@ -69,16 +69,16 @@ | |
|
||
it 'should prefill email with applicant info' do | ||
# when email is not set, prefill | ||
profile = create(:applicant_profile) | ||
profile = create(:leader_profile) | ||
expect(profile.leader_email).to eq(profile.user.email) | ||
|
||
# when email is set, do not overwrite it | ||
profile = create(:applicant_profile, leader_email: '[email protected]') | ||
profile = create(:leader_profile, leader_email: '[email protected]') | ||
expect(profile.leader_email).to eq('[email protected]') | ||
end | ||
|
||
describe 'completed_at autosetting / unsetting' do | ||
let(:unsaved_profile) { build(:completed_applicant_profile) } | ||
let(:unsaved_profile) { build(:completed_leader_profile) } | ||
let(:profile) { unsaved_profile.save && unsaved_profile } | ||
|
||
it 'should set completed_at when required fields are completed' do | ||
|
@@ -115,20 +115,20 @@ | |
end | ||
|
||
it 'should become immutable after application is submitted' do | ||
profile = create(:completed_applicant_profile) | ||
profile = create(:completed_leader_profile) | ||
profile.new_club_application.submit! | ||
|
||
profile.update_attributes(leader_name: 'Jane Doe') | ||
expect(profile.errors[:base]).to include( | ||
'cannot edit applicant profile after submit' | ||
'cannot edit leader profile after submit' | ||
) | ||
end | ||
|
||
it 'should preserve information on deletion' do | ||
profile = create(:completed_applicant_profile) | ||
profile = create(:completed_leader_profile) | ||
profile.destroy | ||
|
||
deleted = ApplicantProfile.with_deleted.find_by(id: profile.id) | ||
deleted = LeaderProfile.with_deleted.find_by(id: profile.id) | ||
expect(deleted).to_not be_nil | ||
expect(deleted.deleted_at).to be_within(1.minute).of(Time.current) | ||
expect(deleted.leader_name).to eq(profile.leader_name) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.