|
7 | 7 | end |
8 | 8 |
|
9 | 9 | it "requests the correct resources" do |
10 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}').to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 10 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}').to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=utf-8"}) |
11 | 11 | @client.premium_search("#freebandnames").each {} |
12 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 12 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
13 | 13 | end |
14 | 14 |
|
15 | 15 | it "supports GET requests" do |
16 | | - stub_get("/1.1/tweets/search/30day/DE.json").with(query: {query: "#freebandnames", maxResults: "100"}).to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 16 | + stub_get("/1.1/tweets/search/30day/DE.json").with(query: {query: "#freebandnames", maxResults: "100"}).to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=utf-8"}) |
17 | 17 | @client.premium_search("#freebandnames", {}, request_method: :get).each {} |
18 | 18 | expect(a_get("/1.1/tweets/search/30day/DE.json").with(query: {query: "#freebandnames", maxResults: "100"})).to have_been_made |
19 | 19 | end |
20 | 20 |
|
21 | 21 | it "supports POST requests" do |
22 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}').to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 22 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}').to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=utf-8"}) |
23 | 23 | @client.premium_search("#freebandnames", {}, request_method: :post).each {} |
24 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 24 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
25 | 25 | end |
26 | 26 |
|
27 | 27 | it "iterates" do |
28 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}').to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 28 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"#freebandnames"}').to_return(body: fixture("premium_search.json"), headers: {content_type: "application/json; charset=utf-8"}) |
29 | 29 | count = 0 |
30 | 30 | @client.premium_search("#freebandnames").each { count += 1 } |
31 | 31 | expect(count).to eq(1) |
32 | 32 | end |
33 | 33 |
|
34 | 34 | it "paginates" do |
35 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"pizza"}').to_return(body: fixture("premium_search_next.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
36 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"next":"eyJhdXRoZW50aWNpdHkiOiI3MzdlZGI5ZjMwNDcwZjlhMWU1OGFhNWVkNzEyOGI4NGIyMWY2YTA3NTE3NTlhNWQxZGYxMjRiOGQ2ZmM5MjQwIiwiZnJvbURhdGUiOiIyMDE3MTAyMDAwMDAiLCJ0b0RhdGUiOiIyMDE3MTExOTIzMTUiLCJuZXh0IjoiMjAxNzExMTkyMzEyMzEtOTMyMzg2MTMxODEwODg5NzI4LTAifQ==","query":"pizza"}').to_return(body: fixture("premium_search_last.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 35 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"pizza"}').to_return(body: fixture("premium_search_next.json"), headers: {content_type: "application/json; charset=utf-8"}) |
| 36 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"next":"eyJhdXRoZW50aWNpdHkiOiI3MzdlZGI5ZjMwNDcwZjlhMWU1OGFhNWVkNzEyOGI4NGIyMWY2YTA3NTE3NTlhNWQxZGYxMjRiOGQ2ZmM5MjQwIiwiZnJvbURhdGUiOiIyMDE3MTAyMDAwMDAiLCJ0b0RhdGUiOiIyMDE3MTExOTIzMTUiLCJuZXh0IjoiMjAxNzExMTkyMzEyMzEtOTMyMzg2MTMxODEwODg5NzI4LTAifQ==","query":"pizza"}').to_return(body: fixture("premium_search_last.json"), headers: {content_type: "application/json; charset=utf-8"}) |
37 | 37 | @client.premium_search("pizza").each {} |
38 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"pizza"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
39 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"next":"eyJhdXRoZW50aWNpdHkiOiI3MzdlZGI5ZjMwNDcwZjlhMWU1OGFhNWVkNzEyOGI4NGIyMWY2YTA3NTE3NTlhNWQxZGYxMjRiOGQ2ZmM5MjQwIiwiZnJvbURhdGUiOiIyMDE3MTAyMDAwMDAiLCJ0b0RhdGUiOiIyMDE3MTExOTIzMTUiLCJuZXh0IjoiMjAxNzExMTkyMzEyMzEtOTMyMzg2MTMxODEwODg5NzI4LTAifQ==","query":"pizza"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 38 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"pizza"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
| 39 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"next":"eyJhdXRoZW50aWNpdHkiOiI3MzdlZGI5ZjMwNDcwZjlhMWU1OGFhNWVkNzEyOGI4NGIyMWY2YTA3NTE3NTlhNWQxZGYxMjRiOGQ2ZmM5MjQwIiwiZnJvbURhdGUiOiIyMDE3MTAyMDAwMDAiLCJ0b0RhdGUiOiIyMDE3MTExOTIzMTUiLCJuZXh0IjoiMjAxNzExMTkyMzEyMzEtOTMyMzg2MTMxODEwODg5NzI4LTAifQ==","query":"pizza"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
40 | 40 | end |
41 | 41 |
|
42 | 42 | it "supports emoji" do |
43 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"🍕"}').to_return(body: fixture("premium_search_emoji.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 43 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"🍕"}').to_return(body: fixture("premium_search_emoji.json"), headers: {content_type: "application/json; charset=utf-8"}) |
44 | 44 | @client.premium_search("🍕").each {} |
45 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"🍕"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 45 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"🍕"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
46 | 46 | end |
47 | 47 |
|
48 | 48 | it "supports from operator" do |
49 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"from:twitterdev"}').to_return(body: fixture("premium_search_from.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 49 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"from:twitterdev"}').to_return(body: fixture("premium_search_from.json"), headers: {content_type: "application/json; charset=utf-8"}) |
50 | 50 | @client.premium_search("from:twitterdev").each {} |
51 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"from:twitterdev"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 51 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"from:twitterdev"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
52 | 52 | end |
53 | 53 |
|
54 | 54 | it "supports to operator" do |
55 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"to:twitterdev"}').to_return(body: fixture("premium_search_to.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 55 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"to:twitterdev"}').to_return(body: fixture("premium_search_to.json"), headers: {content_type: "application/json; charset=utf-8"}) |
56 | 56 | @client.premium_search("to:twitterdev").each {} |
57 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"to:twitterdev"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 57 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"to:twitterdev"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
58 | 58 | end |
59 | 59 |
|
60 | 60 | it "supports point_radius operator" do |
61 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"point_radius:[-105.27346517 40.01924738 10.0mi]"}').to_return(body: fixture("premium_search_point_radius.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 61 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"point_radius:[-105.27346517 40.01924738 10.0mi]"}').to_return(body: fixture("premium_search_point_radius.json"), headers: {content_type: "application/json; charset=utf-8"}) |
62 | 62 | @client.premium_search("point_radius:[-105.27346517 40.01924738 10.0mi]").each {} |
63 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"point_radius:[-105.27346517 40.01924738 10.0mi]"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 63 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"point_radius:[-105.27346517 40.01924738 10.0mi]"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
64 | 64 | end |
65 | 65 |
|
66 | 66 | it "supports url operator" do |
67 | | - stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}').to_return(body: fixture("premium_search_url.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 67 | + stub_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}').to_return(body: fixture("premium_search_url.json"), headers: {content_type: "application/json; charset=utf-8"}) |
68 | 68 | @client.premium_search("url:github.com/sferik/twitter").each {} |
69 | | - expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 69 | + expect(a_post("/1.1/tweets/search/30day/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
70 | 70 | end |
71 | 71 |
|
72 | 72 | it "supports product fullarchive" do |
73 | | - stub_post("/1.1/tweets/search/fullarchive/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}').to_return(body: fixture("premium_search_url.json"), headers: {content_type: "application/json; charset=UTF-8; charset=utf-8"}) |
| 73 | + stub_post("/1.1/tweets/search/fullarchive/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}').to_return(body: fixture("premium_search_url.json"), headers: {content_type: "application/json; charset=utf-8"}) |
74 | 74 | @client.premium_search("url:github.com/sferik/twitter", {}, product: "fullarchive").each {} |
75 | | - expect(a_post("/1.1/tweets/search/fullarchive/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}', headers: {"Content-Type" => "application/json; charset=UTF-8"})).to have_been_made |
| 75 | + expect(a_post("/1.1/tweets/search/fullarchive/DE.json").with(body: '{"maxResults":100,"query":"url:github.com/sferik/twitter"}', headers: {"Content-Type" => "application/json; charset=utf-8"})).to have_been_made |
76 | 76 | end |
77 | 77 | end |
78 | 78 | end |
0 commit comments