Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary with_teacher_by_id trait #687

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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