koala 2.4.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +32 -0
- data/Gemfile +5 -3
- data/ISSUE_TEMPLATE +25 -0
- data/PULL_REQUEST_TEMPLATE +11 -0
- data/changelog.md +161 -4
- data/code_of_conduct.md +64 -12
- data/koala.gemspec +5 -1
- data/lib/koala/api/batch_operation.rb +3 -6
- data/lib/koala/api/{graph_api.rb → graph_api_methods.rb} +29 -104
- data/lib/koala/api/graph_batch_api.rb +112 -65
- data/lib/koala/api/graph_collection.rb +19 -12
- data/lib/koala/api/graph_error_checker.rb +4 -3
- data/lib/koala/api.rb +65 -26
- data/lib/koala/configuration.rb +56 -0
- data/lib/koala/errors.rb +22 -2
- data/lib/koala/http_service/request.rb +133 -0
- data/lib/koala/http_service/response.rb +6 -4
- data/lib/koala/http_service/uploadable_io.rb +0 -5
- data/lib/koala/http_service.rb +29 -76
- data/lib/koala/oauth.rb +8 -8
- data/lib/koala/realtime_updates.rb +26 -21
- data/lib/koala/test_users.rb +9 -8
- data/lib/koala/version.rb +1 -1
- data/lib/koala.rb +7 -9
- data/readme.md +83 -109
- data/spec/cases/api_spec.rb +176 -69
- data/spec/cases/configuration_spec.rb +11 -0
- data/spec/cases/error_spec.rb +16 -3
- data/spec/cases/graph_api_batch_spec.rb +75 -44
- data/spec/cases/graph_api_spec.rb +15 -29
- data/spec/cases/graph_collection_spec.rb +47 -34
- data/spec/cases/graph_error_checker_spec.rb +31 -2
- data/spec/cases/http_service/request_spec.rb +250 -0
- data/spec/cases/http_service/response_spec.rb +24 -0
- data/spec/cases/http_service_spec.rb +126 -286
- data/spec/cases/koala_spec.rb +7 -5
- data/spec/cases/oauth_spec.rb +41 -2
- data/spec/cases/realtime_updates_spec.rb +51 -13
- data/spec/cases/test_users_spec.rb +56 -2
- data/spec/cases/uploadable_io_spec.rb +31 -31
- data/spec/fixtures/cat.m4v +0 -0
- data/spec/fixtures/facebook_data.yml +4 -6
- data/spec/fixtures/mock_facebook_responses.yml +41 -78
- data/spec/fixtures/vcr_cassettes/app_test_accounts.yml +97 -0
- data/spec/integration/graph_collection_spec.rb +8 -5
- data/spec/spec_helper.rb +2 -2
- data/spec/support/graph_api_shared_examples.rb +152 -337
- data/spec/support/koala_test.rb +11 -13
- data/spec/support/mock_http_service.rb +11 -14
- data/spec/support/uploadable_io_shared_examples.rb +4 -4
- metadata +47 -48
- data/.autotest +0 -12
- data/.travis.yml +0 -17
- data/Guardfile +0 -6
- data/autotest/discover.rb +0 -1
- data/lib/koala/api/rest_api.rb +0 -135
- data/lib/koala/http_service/multipart_request.rb +0 -41
- data/spec/cases/multipart_request_spec.rb +0 -65
- data/spec/support/rest_api_shared_examples.rb +0 -168
@@ -36,6 +36,45 @@ describe "Koala::Facebook::RealtimeUpdates" do
|
|
36
36
|
expect(updates).to be_a(Koala::Facebook::RealtimeUpdates)
|
37
37
|
end
|
38
38
|
|
39
|
+
context "with global defaults" do
|
40
|
+
let(:app_id) { :app_id }
|
41
|
+
let(:app_secret) { :app_secret }
|
42
|
+
let(:app_access_token) { :app_access_token }
|
43
|
+
|
44
|
+
before :each do
|
45
|
+
Koala.configure do |config|
|
46
|
+
config.app_id = app_id
|
47
|
+
config.app_secret = app_secret
|
48
|
+
config.app_access_token = app_access_token
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "defaults to the configured data if not otherwise provided" do
|
53
|
+
rtu = Koala::Facebook::RealtimeUpdates.new
|
54
|
+
expect(rtu.app_id).to eq(app_id)
|
55
|
+
expect(rtu.secret).to eq(app_secret)
|
56
|
+
expect(rtu.app_access_token).to eq(app_access_token)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "lets you override app_id" do
|
60
|
+
other_value = :another_id
|
61
|
+
rtu = Koala::Facebook::RealtimeUpdates.new(app_id: other_value)
|
62
|
+
expect(rtu.app_id).to eq(other_value)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "lets you override secret" do
|
66
|
+
other_value = :another_secret
|
67
|
+
rtu = Koala::Facebook::RealtimeUpdates.new(secret: other_value)
|
68
|
+
expect(rtu.secret).to eq(other_value)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "lets you override app_id" do
|
72
|
+
other_value = :another_token
|
73
|
+
rtu = Koala::Facebook::RealtimeUpdates.new(app_access_token: other_value)
|
74
|
+
expect(rtu.app_access_token).to eq(other_value)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
39
78
|
# attributes
|
40
79
|
it "allows read access to app_id" do
|
41
80
|
# in Ruby 1.9, .method returns symbols
|
@@ -67,25 +106,24 @@ describe "Koala::Facebook::RealtimeUpdates" do
|
|
67
106
|
expect(updates).to be_a(Koala::Facebook::RealtimeUpdates)
|
68
107
|
end
|
69
108
|
|
70
|
-
it "
|
71
|
-
updates = Koala::Facebook::RealtimeUpdates.new(:app_id => @app_id, :
|
72
|
-
expect(updates.
|
109
|
+
it "sets up the API with the app access token" do
|
110
|
+
updates = Koala::Facebook::RealtimeUpdates.new(:app_id => @app_id, :app_access_token => @app_access_token)
|
111
|
+
expect(updates.api).to be_a(Koala::Facebook::API)
|
112
|
+
expect(updates.api.access_token).to eq(@app_access_token)
|
73
113
|
end
|
114
|
+
end
|
74
115
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
expect(oauth).to receive(:get_app_access_token).and_return(token)
|
79
|
-
expect(Koala::Facebook::OAuth).to receive(:new).with(@app_id, @secret).and_return(oauth)
|
116
|
+
describe "#app_access_token" do
|
117
|
+
it "fetches an app_token from Facebook when provided an app_id and a secret" do
|
118
|
+
# integration test
|
80
119
|
updates = Koala::Facebook::RealtimeUpdates.new(:app_id => @app_id, :secret => @secret)
|
120
|
+
expect(updates.app_access_token).not_to be_nil
|
81
121
|
end
|
82
122
|
|
83
|
-
it "
|
84
|
-
updates = Koala::Facebook::RealtimeUpdates.new(:
|
85
|
-
expect(updates.
|
86
|
-
expect(updates.api.access_token).to eq(@app_access_token)
|
123
|
+
it "returns the provided token if provided" do
|
124
|
+
updates = Koala::Facebook::RealtimeUpdates.new(app_id: @app_id, app_access_token: @app_access_token)
|
125
|
+
expect(updates.app_access_token).to eq(@app_access_token)
|
87
126
|
end
|
88
|
-
|
89
127
|
end
|
90
128
|
|
91
129
|
describe "#subscribe" do
|
@@ -40,12 +40,52 @@ describe "Koala::Facebook::TestUsers" do
|
|
40
40
|
expect(test_users).to be_a(Koala::Facebook::TestUsers)
|
41
41
|
end
|
42
42
|
|
43
|
+
context "with global defaults" do
|
44
|
+
let(:app_id) { :app_id }
|
45
|
+
let(:app_secret) { :app_secret }
|
46
|
+
let(:app_access_token) { :app_access_token }
|
47
|
+
|
48
|
+
before :each do
|
49
|
+
Koala.configure do |config|
|
50
|
+
config.app_id = app_id
|
51
|
+
config.app_secret = app_secret
|
52
|
+
config.app_access_token = app_access_token
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "defaults to the configured data if not otherwise provided" do
|
57
|
+
test_users = Koala::Facebook::TestUsers.new
|
58
|
+
expect(test_users.app_id).to eq(app_id)
|
59
|
+
expect(test_users.secret).to eq(app_secret)
|
60
|
+
expect(test_users.app_access_token).to eq(app_access_token)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "lets you override app_id" do
|
64
|
+
other_value = :another_id
|
65
|
+
test_users = Koala::Facebook::TestUsers.new(app_id: other_value)
|
66
|
+
expect(test_users.app_id).to eq(other_value)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "lets you override secret" do
|
70
|
+
other_value = :another_secret
|
71
|
+
test_users = Koala::Facebook::TestUsers.new(secret: other_value)
|
72
|
+
expect(test_users.secret).to eq(other_value)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "lets you override app_id" do
|
76
|
+
other_value = :another_token
|
77
|
+
test_users = Koala::Facebook::TestUsers.new(app_access_token: other_value)
|
78
|
+
expect(test_users.app_access_token).to eq(other_value)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
43
83
|
it "uses the OAuth class to fetch a token when provided an app_id and a secret" do
|
44
84
|
oauth = Koala::Facebook::OAuth.new(@app_id, @secret)
|
45
85
|
token = oauth.get_app_access_token
|
46
86
|
expect(oauth).to receive(:get_app_access_token).and_return(token)
|
47
87
|
expect(Koala::Facebook::OAuth).to receive(:new).with(@app_id, @secret).and_return(oauth)
|
48
|
-
|
88
|
+
Koala::Facebook::TestUsers.new(:app_id => @app_id, :secret => @secret)
|
49
89
|
end
|
50
90
|
|
51
91
|
# attributes
|
@@ -265,9 +305,23 @@ describe "Koala::Facebook::TestUsers" do
|
|
265
305
|
options = {:some_http_option => true}
|
266
306
|
# should come twice, once for each user
|
267
307
|
@stubbed = true
|
268
|
-
expect(Koala.http_service).to receive(:make_request).
|
308
|
+
expect(Koala.http_service).to receive(:make_request).twice do |request|
|
309
|
+
expect(request.raw_options).to eq(options)
|
310
|
+
Koala::HTTPService::Response.new(200, "{}", {})
|
311
|
+
end
|
269
312
|
@test_users.befriend(@user1, @user2, options)
|
270
313
|
end
|
314
|
+
|
315
|
+
it "includes the secret, generating the appsecret_proof in both calls if provided" do
|
316
|
+
# should come twice, once for each user
|
317
|
+
@stubbed = true
|
318
|
+
test_users = Koala::Facebook::TestUsers.new({:secret => @secret, :app_id => @app_id})
|
319
|
+
expect(Koala.http_service).to receive(:make_request).twice do |request|
|
320
|
+
expect(request.post_args).to include("appsecret_proof")
|
321
|
+
Koala::HTTPService::Response.new(200, "{}", {})
|
322
|
+
end
|
323
|
+
test_users.befriend(@user1, @user2)
|
324
|
+
end
|
271
325
|
end
|
272
326
|
end # when used without network
|
273
327
|
|
@@ -8,7 +8,7 @@ module Koala::MIME
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe "Koala::UploadableIO" do
|
11
|
+
describe "Koala::HTTPService::UploadableIO" do
|
12
12
|
def rails_3_mocks
|
13
13
|
tempfile = double('Tempfile', :path => "foo")
|
14
14
|
uploaded_file = double('ActionDispatch::Http::UploadedFile',
|
@@ -39,15 +39,15 @@ describe "Koala::UploadableIO" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "returns an UploadIO with the same file path" do
|
42
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).io_or_path).to eq(@path)
|
42
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).io_or_path).to eq(@path)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "returns an UploadIO with the same content type" do
|
46
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).content_type).to eq(@stub_type)
|
46
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).content_type).to eq(@stub_type)
|
47
47
|
end
|
48
48
|
|
49
49
|
it "returns an UploadIO with the file's name" do
|
50
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).filename).to eq(File.basename(@path))
|
50
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).filename).to eq(File.basename(@path))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -68,16 +68,16 @@ describe "Koala::UploadableIO" do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "returns an UploadIO with the same io" do
|
71
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).io_or_path).to eq(@koala_io_params[0])
|
71
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).io_or_path).to eq(@koala_io_params[0])
|
72
72
|
end
|
73
73
|
|
74
74
|
it "returns an UploadableIO with the same content_type" do
|
75
75
|
content_stub = @koala_io_params[1] = double('Content Type')
|
76
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).content_type).to eq(content_stub)
|
76
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).content_type).to eq(content_stub)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "returns an UploadableIO with the right filename" do
|
80
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).filename).to eq(File.basename(@file.path))
|
80
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).filename).to eq(File.basename(@file.path))
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -100,16 +100,16 @@ describe "Koala::UploadableIO" do
|
|
100
100
|
|
101
101
|
it "returns an UploadIO with the same io" do
|
102
102
|
#Problem comparing Tempfile in Ruby 1.8, REE and Rubinius mode 1.8
|
103
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).io_or_path.path).to eq(@koala_io_params[0].path)
|
103
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).io_or_path.path).to eq(@koala_io_params[0].path)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "returns an UploadableIO with the same content_type" do
|
107
107
|
content_stub = @koala_io_params[1] = double('Content Type')
|
108
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).content_type).to eq(content_stub)
|
108
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).content_type).to eq(content_stub)
|
109
109
|
end
|
110
110
|
|
111
111
|
it "returns an UploadableIO with the right filename" do
|
112
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).filename).to eq(File.basename(@file.path))
|
112
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).filename).to eq(File.basename(@file.path))
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -130,18 +130,18 @@ describe "Koala::UploadableIO" do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
it "returns an UploadableIO with the same io" do
|
133
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).io_or_path).to eq(@koala_io_params[0])
|
133
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).io_or_path).to eq(@koala_io_params[0])
|
134
134
|
end
|
135
135
|
|
136
136
|
it "returns an UploadableIO with the same content_type" do
|
137
137
|
content_stub = @koala_io_params[1] = double('Content Type')
|
138
|
-
expect(Koala::UploadableIO.new(*@koala_io_params).content_type).to eq(content_stub)
|
138
|
+
expect(Koala::HTTPService::UploadableIO.new(*@koala_io_params).content_type).to eq(content_stub)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
142
|
describe "and no content type" do
|
143
143
|
it "raises an exception" do
|
144
|
-
expect { Koala::UploadableIO.new(*@koala_io_params) }.to raise_exception(Koala::KoalaError)
|
144
|
+
expect { Koala::HTTPService::UploadableIO.new(*@koala_io_params) }.to raise_exception(Koala::KoalaError)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
@@ -154,17 +154,17 @@ describe "Koala::UploadableIO" do
|
|
154
154
|
it "gets the path from the tempfile associated with the UploadedFile" do
|
155
155
|
expected_path = double('Tempfile')
|
156
156
|
expect(@tempfile).to receive(:path).and_return(expected_path)
|
157
|
-
expect(Koala::UploadableIO.new(@uploaded_file).io_or_path).to eq(expected_path)
|
157
|
+
expect(Koala::HTTPService::UploadableIO.new(@uploaded_file).io_or_path).to eq(expected_path)
|
158
158
|
end
|
159
159
|
|
160
160
|
it "gets the content type via the content_type method" do
|
161
161
|
expected_content_type = double('Content Type')
|
162
162
|
expect(@uploaded_file).to receive(:content_type).and_return(expected_content_type)
|
163
|
-
expect(Koala::UploadableIO.new(@uploaded_file).content_type).to eq(expected_content_type)
|
163
|
+
expect(Koala::HTTPService::UploadableIO.new(@uploaded_file).content_type).to eq(expected_content_type)
|
164
164
|
end
|
165
165
|
|
166
166
|
it "gets the filename from the UploadedFile" do
|
167
|
-
expect(Koala::UploadableIO.new(@uploaded_file).filename).to eq(@uploaded_file.original_filename)
|
167
|
+
expect(Koala::HTTPService::UploadableIO.new(@uploaded_file).filename).to eq(@uploaded_file.original_filename)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
@@ -177,7 +177,7 @@ describe "Koala::UploadableIO" do
|
|
177
177
|
expected_file = double('File')
|
178
178
|
@file_hash[:tempfile] = expected_file
|
179
179
|
|
180
|
-
uploadable = Koala::UploadableIO.new(@file_hash)
|
180
|
+
uploadable = Koala::HTTPService::UploadableIO.new(@file_hash)
|
181
181
|
expect(uploadable.io_or_path).to eq(expected_file)
|
182
182
|
end
|
183
183
|
|
@@ -185,12 +185,12 @@ describe "Koala::UploadableIO" do
|
|
185
185
|
expected_content_type = double('Content Type')
|
186
186
|
@file_hash[:type] = expected_content_type
|
187
187
|
|
188
|
-
uploadable = Koala::UploadableIO.new(@file_hash)
|
188
|
+
uploadable = Koala::HTTPService::UploadableIO.new(@file_hash)
|
189
189
|
expect(uploadable.content_type).to eq(expected_content_type)
|
190
190
|
end
|
191
191
|
|
192
192
|
it "gets the content type from the :type key" do
|
193
|
-
uploadable = Koala::UploadableIO.new(@file_hash)
|
193
|
+
uploadable = Koala::HTTPService::UploadableIO.new(@file_hash)
|
194
194
|
expect(uploadable.filename).to eq(@file_hash[:filename])
|
195
195
|
end
|
196
196
|
end
|
@@ -199,12 +199,12 @@ describe "Koala::UploadableIO" do
|
|
199
199
|
# what that means is tested below
|
200
200
|
it "should accept a file object alone" do
|
201
201
|
params = [BEACH_BALL_PATH]
|
202
|
-
expect { Koala::UploadableIO.new(*params) }.not_to raise_exception
|
202
|
+
expect { Koala::HTTPService::UploadableIO.new(*params) }.not_to raise_exception
|
203
203
|
end
|
204
204
|
|
205
205
|
it "should accept a file path alone" do
|
206
206
|
params = [BEACH_BALL_PATH]
|
207
|
-
expect { Koala::UploadableIO.new(*params) }.not_to raise_exception
|
207
|
+
expect { Koala::HTTPService::UploadableIO.new(*params) }.not_to raise_exception
|
208
208
|
end
|
209
209
|
end
|
210
210
|
end
|
@@ -218,7 +218,7 @@ describe "Koala::UploadableIO" do
|
|
218
218
|
context "if no filename was provided" do
|
219
219
|
it "should call the constructor with the content type, file name, and a dummy file name" do
|
220
220
|
expect(UploadIO).to receive(:new).with(BEACH_BALL_PATH, "content/type", anything).and_return(@upload_io)
|
221
|
-
expect(Koala::UploadableIO.new(BEACH_BALL_PATH, "content/type").to_upload_io).to eq(@upload_io)
|
221
|
+
expect(Koala::HTTPService::UploadableIO.new(BEACH_BALL_PATH, "content/type").to_upload_io).to eq(@upload_io)
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -226,7 +226,7 @@ describe "Koala::UploadableIO" do
|
|
226
226
|
it "should call the constructor with the content type, file name, and the filename" do
|
227
227
|
filename = "file"
|
228
228
|
expect(UploadIO).to receive(:new).with(BEACH_BALL_PATH, "content/type", filename).and_return(@upload_io)
|
229
|
-
Koala::UploadableIO.new(BEACH_BALL_PATH, "content/type", filename).to_upload_io
|
229
|
+
Koala::HTTPService::UploadableIO.new(BEACH_BALL_PATH, "content/type", filename).to_upload_io
|
230
230
|
end
|
231
231
|
end
|
232
232
|
end
|
@@ -234,33 +234,33 @@ describe "Koala::UploadableIO" do
|
|
234
234
|
describe "getting a file" do
|
235
235
|
it "returns the File if initialized with a file" do
|
236
236
|
f = File.new(BEACH_BALL_PATH)
|
237
|
-
expect(Koala::UploadableIO.new(f).to_file).to eq(f)
|
237
|
+
expect(Koala::HTTPService::UploadableIO.new(f).to_file).to eq(f)
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should open up and return a file corresponding to the path if io_or_path is a path" do
|
241
241
|
result = double("File")
|
242
242
|
expect(File).to receive(:open).with(BEACH_BALL_PATH).and_return(result)
|
243
|
-
expect(Koala::UploadableIO.new(BEACH_BALL_PATH).to_file).to eq(result)
|
243
|
+
expect(Koala::HTTPService::UploadableIO.new(BEACH_BALL_PATH).to_file).to eq(result)
|
244
244
|
end
|
245
245
|
end
|
246
246
|
|
247
247
|
describe ".binary_content?" do
|
248
248
|
it "returns true for Rails 3 file uploads" do
|
249
|
-
expect(Koala::UploadableIO.binary_content?(rails_3_mocks.last)).to be_truthy
|
249
|
+
expect(Koala::HTTPService::UploadableIO.binary_content?(rails_3_mocks.last)).to be_truthy
|
250
250
|
end
|
251
251
|
|
252
252
|
it "returns true for Sinatra file uploads" do
|
253
|
-
expect(Koala::UploadableIO.binary_content?(rails_3_mocks.last)).to be_truthy
|
253
|
+
expect(Koala::HTTPService::UploadableIO.binary_content?(rails_3_mocks.last)).to be_truthy
|
254
254
|
end
|
255
255
|
|
256
256
|
it "returns true for File objects" do
|
257
|
-
expect(Koala::UploadableIO.binary_content?(File.open(BEACH_BALL_PATH))).to be_truthy
|
257
|
+
expect(Koala::HTTPService::UploadableIO.binary_content?(File.open(BEACH_BALL_PATH))).to be_truthy
|
258
258
|
end
|
259
259
|
|
260
260
|
it "returns false for everything else" do
|
261
|
-
expect(Koala::UploadableIO.binary_content?(StringIO.new)).to be_falsey
|
262
|
-
expect(Koala::UploadableIO.binary_content?(BEACH_BALL_PATH)).to be_falsey
|
263
|
-
expect(Koala::UploadableIO.binary_content?(nil)).to be_falsey
|
261
|
+
expect(Koala::HTTPService::UploadableIO.binary_content?(StringIO.new)).to be_falsey
|
262
|
+
expect(Koala::HTTPService::UploadableIO.binary_content?(BEACH_BALL_PATH)).to be_falsey
|
263
|
+
expect(Koala::HTTPService::UploadableIO.binary_content?(nil)).to be_falsey
|
264
264
|
end
|
265
265
|
end
|
266
266
|
end # describe UploadableIO
|
data/spec/fixtures/cat.m4v
CHANGED
Binary file
|
@@ -5,9 +5,7 @@
|
|
5
5
|
# by enter an OAuth token, code, and session_key (for real users) or changing the app_id and secret (for test users)
|
6
6
|
# (note for real users: this will leave some photos and videos posted to your wall, since they can't be deleted through the API)
|
7
7
|
|
8
|
-
# These values are configured to work with
|
9
|
-
# Of course, you can change this to work with your own app.
|
10
|
-
# Check out http://oauth.twoalex.com/ to easily generate tokens, cookies, etc.
|
8
|
+
# These values are configured to work with a test app. If you want, you can change this to work with your own app.
|
11
9
|
|
12
10
|
# Your OAuth token should have the read_stream, publish_stream, user_photos, user_videos, and read_insights permissions.
|
13
11
|
oauth_token:
|
@@ -22,7 +20,7 @@ oauth_test_data:
|
|
22
20
|
# These values will work out of the box
|
23
21
|
app_id: 119908831367602
|
24
22
|
secret: e45e55a333eec232d4206d2703de1307
|
25
|
-
callback_url: http://
|
23
|
+
callback_url: http://testdomain.koalatest.test/
|
26
24
|
app_access_token: 119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.
|
27
25
|
raw_token_string: "access_token=119908831367602|2.6GneoQbnEqtSiPppZzDU4Q__.3600.1273366800-2905623|3OLa3w0x1K4C1S5cOgbs07TytAk.&expires=6621"
|
28
26
|
raw_offline_access_token_string: access_token=119908831367602|2.6GneoQbnEqtSiPppZzDU4Q__.3600.1273366800-2905623|3OLa3w0x1K4C1S5cOgbs07TytAk.
|
@@ -54,7 +52,7 @@ oauth_test_data:
|
|
54
52
|
issued_at: 1301917299
|
55
53
|
|
56
54
|
subscription_test_data:
|
57
|
-
subscription_path:
|
55
|
+
subscription_path: https://testdomain.koalatest.test/subscriptions
|
58
56
|
verify_token: "myverificationtoken|1f54545d5f722733e17faae15377928f"
|
59
57
|
challenge_data:
|
60
58
|
"hub.challenge": "1290024882"
|
@@ -62,4 +60,4 @@ subscription_test_data:
|
|
62
60
|
"hub.mode": "subscribe"
|
63
61
|
|
64
62
|
vcr_data:
|
65
|
-
oauth_token: CAACEdEose0cBAKuiUM40KZBEsq2l0iggaMGZBPI74svGQRMmZCPXb7eZCYPhNUbVXnnYZCjXKFKIc7HgYllr4RDIKrANHm6kKncOx0Y3UpDqLliRGZAnSEUypyFworUnBMOQJBlAuB1wlwYJZB7LIZCobCcnT2q9QwrZBpK3qAZB3u7ZAJaZAdsMZBsyALkAXatoj75leWXhgXfT1QiJHZBGoRlz07Q85z1dZBReK4ZD
|
63
|
+
oauth_token: CAACEdEose0cBAKuiUM40KZBEsq2l0iggaMGZBPI74svGQRMmZCPXb7eZCYPhNUbVXnnYZCjXKFKIc7HgYllr4RDIKrANHm6kKncOx0Y3UpDqLliRGZAnSEUypyFworUnBMOQJBlAuB1wlwYJZB7LIZCobCcnT2q9QwrZBpK3qAZB3u7ZAJaZAdsMZBsyALkAXatoj75leWXhgXfT1QiJHZBGoRlz07Q85z1dZBReK4ZD
|