Skip to content

Commit 9123fb7

Browse files
committed
Adding request test for programme activity grouping dashboard
1 parent 22321be commit 9123fb7

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
require "rails_helper"
2+
3+
RSpec.describe "Admin::ProgrammeActivityGroupingsController" do
4+
let(:programme_activity_grouping) do
5+
create(:programme_activity_grouping,
6+
web_copy: {
7+
course_requirements: "Complete this section",
8+
aside_slug: "test-slug",
9+
subtitle: "Complete the activities in this section",
10+
step_number: "three"
11+
}
12+
)
13+
end
14+
15+
before do
16+
allow_any_instance_of(Admin::ApplicationController).to receive(:authenticate_admin).and_return("user@example.com")
17+
end
18+
19+
describe "GET #index" do
20+
before do
21+
get admin_programme_activity_groupings_path
22+
end
23+
24+
it "should render correct template" do
25+
expect(response).to render_template("index")
26+
end
27+
end
28+
29+
describe "GET #show" do
30+
before do
31+
get admin_programme_activity_grouping_path(programme_activity_grouping)
32+
end
33+
34+
it "should render correct template" do
35+
expect(response).to render_template("show")
36+
end
37+
end
38+
39+
describe "PUT #update" do
40+
before do
41+
put admin_programme_activity_grouping_path(programme_activity_grouping, params: {
42+
programme_activity_grouping: {title: "test"}
43+
})
44+
end
45+
46+
it "should redirect to the show page" do
47+
expect(response).to redirect_to(admin_programme_activity_grouping_path(programme_activity_grouping))
48+
end
49+
end
50+
end

0 commit comments

Comments
 (0)