|
3 | 3 | describe Intercom::CollectionProxy do |
4 | 4 |
|
5 | 5 | it "stops iterating if no next link" do |
6 | | - Intercom.expects(:get).with("/users", {}).returns(page_of_users(include_next_link:false)) |
| 6 | + Intercom.expects(:get).with("/users", {}).returns(page_of_users(false)) |
7 | 7 | emails = [] |
8 | 8 | Intercom::User.all.each { |user| emails << user.email } |
9 | 9 | |
10 | 10 | end |
11 | 11 |
|
12 | 12 | it "keeps iterating if next link" do |
13 | | - Intercom.expects(:get).with("/users", {}).returns(page_of_users(include_next_link:true)) |
14 | | - Intercom.expects(:get).with('https://api.intercom.io/users?per_page=50&page=2', {}).returns(page_of_users(include_next_link:false)) |
| 13 | + Intercom.expects(:get).with("/users", {}).returns(page_of_users(true)) |
| 14 | + Intercom.expects(:get).with('https://api.intercom.io/users?per_page=50&page=2', {}).returns(page_of_users(false)) |
15 | 15 | emails = [] |
16 | 16 | Intercom::User.all.each { |user| emails << user.email } |
17 | 17 | end |
18 | 18 |
|
19 | 19 | it "supports indexed array access" do |
20 | | - Intercom.expects(:get).with("/users", {}).returns(page_of_users(include_next_link:false)) |
| 20 | + Intercom.expects(:get).with("/users", {}).returns(page_of_users(false)) |
21 | 21 | Intercom:: User.all[0].email.must_equal '[email protected]' |
22 | 22 | end |
23 | 23 |
|
24 | 24 | it "supports map" do |
25 | | - Intercom.expects(:get).with("/users", {}).returns(page_of_users(include_next_link:false)) |
| 25 | + Intercom.expects(:get).with("/users", {}).returns(page_of_users(false)) |
26 | 26 | emails = Intercom::User.all.map { |user| user.email } |
27 | 27 | |
28 | 28 | end |
29 | 29 |
|
30 | 30 | it "supports querying" do |
31 | | - Intercom.expects(:get).with("/users", {:tag_name => 'Taggart J'}).returns(page_of_users(include_next_link:false)) |
| 31 | + Intercom.expects(:get).with("/users", {:tag_name => 'Taggart J'}).returns(page_of_users(false)) |
32 | 32 | Intercom:: User.find_all(:tag_name => 'Taggart J').map(& :email).must_equal %W([email protected] [email protected] [email protected]) |
33 | 33 | end |
34 | 34 | end |
0 commit comments