Skip to content

Commit

Permalink
fix tests after main merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonXu33 committed Apr 22, 2024
1 parent 2b3154b commit 32d9c0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/controllers/teachers_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,15 @@
end

describe "GET #show" do
let(:teacher) { double("Teacher") }
let(:teacher) { double("Teacher", id: 1) }
let(:other_teacher) { double("Teacher") }
let(:school) { double("School") }

before do
ApplicationController.any_instance.stub(:require_login).and_return(true)
ApplicationController.any_instance.stub(:require_admin).and_return(true)
allow(Teacher).to receive(:find).and_return(teacher)
allow(Teacher).to receive_message_chain(:where, :not).and_return(other_teacher)
allow(teacher).to receive(:school).and_return(school)
end

Expand All @@ -240,6 +242,7 @@
get :show, params: { id: 1 }
expect(assigns(:school)).to eq(school)
expect(assigns(:status)).to eq("Teacher")
expect(assigns(:all_teachers_except_current)).to eq(other_teacher)
expect(response).to render_template("show")
end

Expand All @@ -248,6 +251,7 @@
get :show, params: { id: 1 }
expect(assigns(:school)).to eq(school)
expect(assigns(:status)).to eq("Admin")
expect(assigns(:all_teachers_except_current)).to eq(other_teacher)
expect(response).to render_template("show")
end
end
Expand Down

0 comments on commit 32d9c0c

Please sign in to comment.