Skip to content

Commit 4096154

Browse files
committed
Move system spec in one separate flow
1 parent 403bca3 commit 4096154

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe 'Report RfCs for unapprporiat content' do
6+
let(:user) { create(:teacher) }
7+
8+
before do
9+
stub_const('RequestForCommentPolicy::REPORT_RECEIVER_CONFIGURED', reports_enabled)
10+
visit(sign_in_path)
11+
fill_in('email', with: user.email)
12+
fill_in('password', with: attributes_for(:teacher)[:password])
13+
click_button(I18n.t('sessions.new.link'))
14+
visit(request_for_comment_path(create(:rfc)))
15+
end
16+
17+
context 'when reporting is enabled' do
18+
let(:reports_enabled) { true }
19+
20+
it 'allows reporting of RfCs', :js do
21+
accept_confirm do
22+
click_on I18n.t('request_for_comments.report.report')
23+
end
24+
25+
expect(page).to have_text(I18n.t('request_for_comments.report.reported'))
26+
end
27+
end
28+
29+
context 'when reporting is disabled' do
30+
let(:reports_enabled) { false }
31+
32+
it 'does not display the report button' do
33+
expect(page).to have_no_button(I18n.t('request_for_comments.report.report'))
34+
end
35+
end
36+
end

spec/system/request_for_comments_filter_system_spec.rb

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
RSpec.describe 'Request_for_Comments' do
66
let(:user) { create(:teacher) }
7-
let(:reports_enabled) { false }
87

98
before do
10-
stub_const('RequestForCommentPolicy::REPORT_RECEIVER_CONFIGURED', reports_enabled)
119
visit(sign_in_path)
1210
fill_in('email', with: user.email)
1311
fill_in('password', with: attributes_for(:teacher)[:password])
@@ -39,28 +37,4 @@
3937
visit(request_for_comments_path)
4038
expect(page).to have_css('ul.pagination')
4139
end
42-
43-
describe 'reporting of user content' do
44-
before do
45-
visit(request_for_comment_path(create(:rfc)))
46-
end
47-
48-
context 'when reporting is enabled' do
49-
let(:reports_enabled) { true }
50-
51-
it 'allows reporting of RfCs', :js do
52-
accept_confirm do
53-
click_on I18n.t('request_for_comments.report.report')
54-
end
55-
56-
expect(page).to have_text(I18n.t('request_for_comments.report.reported'))
57-
end
58-
end
59-
60-
context 'when reporting is disabled' do
61-
it 'does not display the report button' do
62-
expect(page).to have_no_button(I18n.t('request_for_comments.report.report'))
63-
end
64-
end
65-
end
6640
end

0 commit comments

Comments
 (0)