File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 1111 let ( :human_model_name ) { 'Reported model' }
1212 let ( :course_url ) { 'https://example.com/course/1' }
1313
14- before do
15- user_content_report = instance_double ( UserContentReport ,
14+ let ( :user_content_report ) do
15+ instance_double ( UserContentReport ,
1616 human_model_name :,
1717 reported_message :,
1818 related_request_for_comment : instance_double ( RequestForComment ) ,
1919 course_url :)
20+ end
21+
22+ before do
2023 allow ( UserContentReport ) . to receive ( :new ) . with ( reported_content :) . and_return ( user_content_report )
2124 end
2225
Original file line number Diff line number Diff line change 2424 end
2525 end
2626
27- it 'does not grant access to users who have no access to the RfC' do
28- learner = build_stubbed ( :learner )
29- rfc_policy = instance_double ( RequestForCommentPolicy , show? : false )
30- allow ( RequestForCommentPolicy ) . to receive ( :new ) . with ( learner , comment . request_for_comment )
31- . and_return ( rfc_policy )
27+ context 'without access to the RfC' do
28+ let ( :learner ) { build_stubbed ( :learner ) }
29+ let ( :rfc_policy ) { instance_double ( RequestForCommentPolicy , show? : false ) }
3230
33- expect ( described_class ) . not_to permit ( learner , comment )
31+ before do
32+ allow ( RequestForCommentPolicy ) . to receive ( :new )
33+ . with ( learner , comment . request_for_comment )
34+ . and_return ( rfc_policy )
35+ end
36+
37+ it 'does not grant access' do
38+ expect ( described_class ) . not_to permit ( learner , comment )
39+ end
3440 end
3541 end
3642
You can’t perform that action at this time.
0 commit comments