File tree 2 files changed +15
-4
lines changed
spec/models/my_activities 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ class RegBlocks
4
4
def self . append! ( uid , activities )
5
5
blocks_feed = Bearfacts ::Regblocks . new ( { user_id : uid } ) . get
6
6
if blocks_feed [ :errored ] || blocks_feed [ :noStudentId ]
7
- return activities
7
+ return
8
8
end
9
9
10
10
%w( activeBlocks inactiveBlocks ) . each do |block_category |
11
- blocks_feed [ block_category . to_sym ] . each do |block |
12
- notification = process_block! ( block )
13
- activities << notification if notification . present?
11
+ if ( blocks = blocks_feed [ block_category . to_sym ] )
12
+ blocks . each do |block |
13
+ notification = process_block! ( block )
14
+ activities << notification if notification . present?
15
+ end
14
16
end
15
17
end
16
18
end
Original file line number Diff line number Diff line change 66
66
activities . should eq ( 'foo' )
67
67
end
68
68
end
69
+
70
+ context 'nil body from proxy' do
71
+ before { allow_any_instance_of ( Bearfacts ::Regblocks ) . to receive ( :get ) . and_return ( { } ) }
72
+ it 'should not do anything' do
73
+ activities = [ ]
74
+ MyActivities ::RegBlocks . append! ( oski_uid , activities )
75
+ expect ( activities ) . to eq [ ]
76
+ end
77
+ end
69
78
end
You can’t perform that action at this time.
0 commit comments