Skip to content

Commit

Permalink
Remove unnecessary with_teacher_by_id trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Aug 22, 2024
1 parent dd0d68b commit 9db861e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions spec/cypress/e2e/annotations_overview_spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function createAnnotationScenario(context, userRole = "student") {
cy.then(() => {
// a user is considered a teacher only iff they have given any lecture
const teacherUser = userRole === "teacher" ? context.user : context.teacherUser;
FactoryBot.create("lecture_with_sparse_toc", "with_title", "with_teacher_by_id",
FactoryBot.create("lecture_with_sparse_toc", "with_title",
{ title: LECTURE_TITLE_1, teacher_id: teacherUser.id }).as("lectureSage");
FactoryBot.create("lecture_with_sparse_toc", "with_title", "with_teacher_by_id",
FactoryBot.create("lecture_with_sparse_toc", "with_title",
{ title: LECTURE_TITLE_2, teacher_id: teacherUser.id }).as("lectureLean");
});

Expand Down Expand Up @@ -80,7 +80,7 @@ describe("Annotation section", () => {
cy.createUserAndLogin("teacher").as("teacher");
cy.then(() => {
// a user is considered a teacher only iff they have given any lecture
FactoryBot.create("lecture", "with_teacher_by_id", { teacher_id: this.teacher.id });
FactoryBot.create("lecture", { teacher_id: this.teacher.id });
});

cy.i18n("admin.annotation.your_annotations").as("yourAnnotations");
Expand Down
2 changes: 1 addition & 1 deletion spec/cypress/e2e/lectures_spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FactoryBot from "../support/factorybot";
describe("Lecture edit page", () => {
it("shows content tab button", function () {
cy.createUserAndLogin("teacher").then((teacher) => {
FactoryBot.create("lecture", "with_teacher_by_id",
FactoryBot.create("lecture",
{ teacher_id: teacher.id }).as("lecture");
});

Expand Down
7 changes: 0 additions & 7 deletions spec/factories/lectures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@
course { association :course, title: title }
end

trait :with_teacher_by_id do
transient do
teacher_id { nil }
end
teacher { User.find(teacher_id) }
end

# NOTE: that you can give the chapter_count here as parameter as well
factory :lecture_with_toc, traits: [:with_toc]

Expand Down

0 comments on commit 9db861e

Please sign in to comment.