File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ def for_app
1515 end
1616
1717 def for_type ( type :, count : nil )
18- find ( type : type , count : count )
18+ params = { type : type }
19+ params [ :count ] = count if count
20+ find ( params )
1921 end
2022 end
2123 end
Original file line number Diff line number Diff line change @@ -520,6 +520,18 @@ def test_segment_count
520520 }
521521end
522522
523+ def test_conversation_count
524+ {
525+ "type" => "count" ,
526+ "conversation" => {
527+ "assigned" => 1 ,
528+ "closed" => 15 ,
529+ "open" => 1 ,
530+ "unassigned" => 0
531+ }
532+ }
533+ end
534+
523535def error_on_modify_frozen
524536 RUBY_VERSION =~ /1.8/ ? TypeError : RuntimeError
525537end
Original file line number Diff line number Diff line change 1414 counts = client . counts . for_type ( type : 'user' , count : 'segment' )
1515 counts . user [ 'segment' ] [ 4 ] [ "segment 1" ] . must_equal ( 1 )
1616 end
17+
18+ it 'should not include count param when nil' do
19+ client . expects ( :get ) . with ( "/counts" , { type : 'conversation' } ) . returns ( test_conversation_count )
20+ counts = client . counts . for_type ( type : 'conversation' )
21+ counts . conversation . must_equal ( {
22+ "assigned" => 1 ,
23+ "closed" => 15 ,
24+ "open" => 1 ,
25+ "unassigned" => 0
26+ } )
27+ end
1728end
You can’t perform that action at this time.
0 commit comments