canvas-lms/spec/models/planner_note_spec.rb

55 lines
2.3 KiB
Ruby

#
# Copyright (C) 2017 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require_relative '../spec_helper'
describe PlannerNote do
before :once do
course_factory
student_in_course
teacher_in_course
@student_planner_note = PlannerNote.create!(user_id: @student.id,
todo_date: 4.days.from_now,
title: "Student Test Assignment",
course_id: @course.id)
@teacher_planner_note = PlannerNote.create!(user_id: @teacher.id,
todo_date: 4.days.from_now,
title: "Student Test Assignment",
details: "Students Need Grading",
course_id: @course.id)
end
describe "::planner_note_workflow_state" do
it "returns 'deleted' for deleted note" do
@teacher_planner_note.destroy!
expect(@teacher_planner_note.workflow_state).to eq 'deleted'
end
it "returns 'active' for created note" do
expect(@student_planner_note.workflow_state).to eq 'active'
end
end
it "creates a note without a course" do
note = PlannerNote.create!(user_id: @teacher.id,
todo_date: 4.days.from_now,
title: "Student Test Assignment",
details: "Students Need Grading")
expect(note.workflow_state).to eq 'active'
end
end