Skip to content

Commit

Permalink
Fix date passed to rspec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie authored and JamieCleare2525 committed Jul 12, 2024
1 parent 71ce3ff commit 29aee2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/support/shared_examples/mentor_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let(:date_of_birth) { "1991-01-22" }

it "returns mentor object with error on trn" do
mentor = described_class.call(trn:, date_of_birth:)
mentor = described_class.call(trn:, date_of_birth: Date.parse(date_of_birth))
expect(mentor.class).to eq(mentor_class)
expect(mentor.errors[:trn]).to include "Enter a 7 digit teacher reference number (TRN)"
end
Expand All @@ -19,7 +19,7 @@
let(:date_of_birth) { "1991-01-22" }

it "returns mentor object with error on trn" do
mentor = described_class.call(trn:, date_of_birth:)
mentor = described_class.call(trn:, date_of_birth: Date.parse(date_of_birth))
expect(mentor.class).to eq(mentor_class)
expect(mentor.errors[:trn]).to include "Enter a teacher reference number (TRN)"
end
Expand All @@ -29,7 +29,7 @@
let(:date_of_birth) { "1991-01-22" }

it "returns an error with missing keyword: trn" do
expect { described_class.call(date_of_birth:) }.to raise_error(ArgumentError, "missing keyword: :trn")
expect { described_class.call(date_of_birth: Date.parse(date_of_birth)) }.to raise_error(ArgumentError, "missing keyword: :trn")
end
end

Expand All @@ -43,7 +43,7 @@
end

it "returns existing mentor" do
mentor = described_class.call(trn:, date_of_birth:)
mentor = described_class.call(trn:, date_of_birth: Date.parse(date_of_birth))
expect(mentor).to eq existing_mentor
end
end
Expand All @@ -57,7 +57,7 @@
end

it "returns initialized placements mentor record without errors" do
mentor = described_class.call(trn:, date_of_birth:)
mentor = described_class.call(trn:, date_of_birth: Date.parse(date_of_birth))
expect(mentor.class).to eq(mentor_class)
expect(mentor.trn).to eq trn
expect(mentor.first_name).to eq teacher_object["firstName"]
Expand All @@ -78,7 +78,7 @@
end

it "returns initialized placements mentor record with first and last name" do
mentor = described_class.call(trn:, first_name:, last_name:, date_of_birth:)
mentor = described_class.call(trn:, first_name:, last_name:, date_of_birth: Date.parse(date_of_birth))
expect(mentor.class).to eq(mentor_class)
expect(mentor.trn).to eq trn
expect(mentor.first_name).to eq first_name
Expand Down

0 comments on commit 29aee2e

Please sign in to comment.