Skip to content

Commit

Permalink
Rename spec and check presence
Browse files Browse the repository at this point in the history
  • Loading branch information
Kizr committed Jun 21, 2024
1 parent e900934 commit 2a07923
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
it { is_expected.to validate_presence_of(:school) }
it { is_expected.to validate_presence_of(:parent_subject_id) }

describe "#additional_subjects_valid" do
describe "additional subjects validation" do
let(:school) { create(:placements_school) }
let(:parent_subject) { create(:subject) }

it "is invalid if the parent subject is present and additional subjects are blank" do
step = described_class.new(school:, parent_subject_id: parent_subject.id)

expect(step).to be_invalid
end

it "is invalid if the additional subject does not exist" do
child_subject = create(:subject, parent_subject:)
step = described_class.new(school:, parent_subject_id: parent_subject.id, additional_subject_ids: ["not_a_subject", child_subject.id])
Expand Down

0 comments on commit 2a07923

Please sign in to comment.