Skip to content

Commit f09c972

Browse files
committed
Remove validation and old tests
1 parent 4ae58dd commit f09c972

4 files changed

Lines changed: 2 additions & 28 deletions

File tree

app/models/teacher_invitation.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ class TeacherInvitation < ApplicationRecord
66
belongs_to :school
77
validates :email_address,
88
format: { with: EmailValidator.regexp, message: I18n.t('validations.invitation.email_address') }
9-
validate :school_is_verified
109
after_create_commit :send_invitation_email
1110
encrypts :email_address
1211

@@ -16,12 +15,6 @@ class TeacherInvitation < ApplicationRecord
1615

1716
private
1817

19-
def school_is_verified
20-
return if school.verified?
21-
22-
errors.add(:school, 'is not verified')
23-
end
24-
2518
def send_invitation_email
2619
InvitationMailer.with(invitation: self).invite_teacher.deliver_later
2720
end

lib/concepts/school_student/create.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ def create_student(school, school_student_params, token)
2222
password = DecryptionHelpers.decrypt_password(encrypted_password)
2323
name = school_student_params.fetch(:name)
2424

25-
validate(school:, username:, password:, name:)
25+
validate(username:, password:, name:)
2626

2727
response = ProfileApiClient.create_school_student(token:, username:, password:, name:, school_id:)
2828
user_id = response[:created].first
2929
Role.student.create!(school:, user_id:)
3030
user_id
3131
end
3232

33-
def validate(school:, username:, password:, name:)
34-
raise ArgumentError, 'school is not verified' unless school.verified?
33+
def validate(username:, password:, name:)
3534
raise ArgumentError, "username '#{username}' is invalid" if username.blank?
3635
raise ArgumentError, "password '#{password}' is invalid" if password.size < 8
3736
raise ArgumentError, "name '#{name}' is invalid" if name.blank?

spec/concepts/school_student/create_spec.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,6 @@
7676
end
7777
end
7878

79-
context 'when the school is not verified' do
80-
let(:school) { create(:school) }
81-
82-
it 'returns the error message in the operation response' do
83-
response = described_class.call(school:, school_student_params:, token:)
84-
expect(response[:error]).to match(/school is not verified/)
85-
end
86-
end
87-
8879
context 'when the student cannot be created in profile api because of a 422 response' do
8980
let(:error) { { 'message' => "something's up with the username" } }
9081
let(:exception) { ProfileApiClient::Student422Error.new(error) }

spec/concepts/school_teacher/invite_spec.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,4 @@
4949
expect(Sentry).to have_received(:capture_exception).with(kind_of(StandardError))
5050
end
5151
end
52-
53-
context 'when the school is not verified' do
54-
let(:school) { create(:school) }
55-
56-
it 'returns the error message in the operation response' do
57-
response = described_class.call(school:, school_teacher_params:, token:)
58-
expect(response[:error]).to match(/School is not verified/)
59-
end
60-
end
6152
end

0 commit comments

Comments
 (0)