|
4 | 4 |
|
5 | 5 | RSpec.describe 'Request_for_Comments' do |
6 | 6 | let(:user) { create(:teacher) } |
| 7 | + let(:report_emails) { [] } |
7 | 8 |
|
8 | 9 | before do |
| 10 | + codeocean_config = instance_double(CodeOcean::Config) |
| 11 | + allow(CodeOcean::Config).to receive(:new).with(:code_ocean).and_return(codeocean_config) |
| 12 | + allow(codeocean_config).to receive(:read).and_return({ |
| 13 | + content_moderation: {report_emails:}, |
| 14 | + }) |
| 15 | + |
9 | 16 | visit(sign_in_path) |
10 | 17 | fill_in('email', with: user.email) |
11 | 18 | fill_in('password', with: attributes_for(:teacher)[:password]) |
|
38 | 45 | expect(page).to have_css('ul.pagination') |
39 | 46 | end |
40 | 47 |
|
41 | | - it 'allows reporting of RfCs', :js do |
42 | | - codeocean_config = instance_double(CodeOcean::Config) |
43 | | - allow(CodeOcean::Config).to receive(:new).with(:code_ocean).and_return(codeocean_config) |
44 | | - allow(codeocean_config).to receive(:read).and_return({ |
45 | | - content_moderation: {report_emails: ['[email protected]']}, |
46 | | - }) |
| 48 | + context 'when reporting is enabled' do |
| 49 | + let(:report_emails) { ['[email protected]'] } |
47 | 50 |
|
48 | | - request_for_comment = create(:rfc) |
49 | | - visit(request_for_comment_path(request_for_comment)) |
| 51 | + it 'allows reporting of RfCs', :js do |
| 52 | + request_for_comment = create(:rfc) |
| 53 | + visit(request_for_comment_path(request_for_comment)) |
50 | 54 |
|
51 | | - accept_confirm do |
52 | | - click_on I18n.t('request_for_comments.report.report') |
53 | | - end |
| 55 | + accept_confirm do |
| 56 | + click_on I18n.t('request_for_comments.report.report') |
| 57 | + end |
54 | 58 |
|
55 | | - expect(page).to have_text(I18n.t('request_for_comments.report.reported')) |
| 59 | + expect(page).to have_text(I18n.t('request_for_comments.report.reported')) |
| 60 | + end |
56 | 61 | end |
57 | 62 | end |
0 commit comments