Skip to content

Commit 444f736

Browse files
committed
Standardize Content-Type header in premium search results specs
1 parent 68afab3 commit 444f736

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

spec/twitter/premium_search_results_spec.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,72 @@
77
end
88

99
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"})
1111
@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
1313
end
1414

1515
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"})
1717
@client.premium_search("#freebandnames", {}, request_method: :get).each {}
1818
expect(a_get("/1.1/tweets/search/30day/DE.json").with(query: {query: "#freebandnames", maxResults: "100"})).to have_been_made
1919
end
2020

2121
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"})
2323
@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
2525
end
2626

2727
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"})
2929
count = 0
3030
@client.premium_search("#freebandnames").each { count += 1 }
3131
expect(count).to eq(1)
3232
end
3333

3434
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"})
3737
@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
4040
end
4141

4242
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"})
4444
@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
4646
end
4747

4848
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"})
5050
@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
5252
end
5353

5454
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"})
5656
@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
5858
end
5959

6060
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"})
6262
@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
6464
end
6565

6666
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"})
6868
@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
7070
end
7171

7272
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"})
7474
@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
7676
end
7777
end
7878
end

0 commit comments

Comments
 (0)