facebook-stub 0.0.1.12 → 0.0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/facebook-stub.js +1 -1
- data/lib/facebook_stub/core.js +1 -1
- data/lib/facebook_stub/version.rb +1 -1
- data/spec/acceptance/facebook-stub_spec.rb +25 -11
- metadata +3 -3
data/bin/facebook-stub.js
CHANGED
@@ -221,7 +221,7 @@
|
|
221
221
|
}
|
222
222
|
|
223
223
|
function getUserID() {
|
224
|
-
if (calledBeforeInit('getUserID')) return
|
224
|
+
if (calledBeforeInit('getUserID') || !FBWorld.state('connected')) return 0; // should not return anything unless connected
|
225
225
|
var id = uid();
|
226
226
|
return id && id.toString() || undefined; // FB.getUserID returns a string, so make sure we do the same
|
227
227
|
}
|
data/lib/facebook_stub/core.js
CHANGED
@@ -221,7 +221,7 @@
|
|
221
221
|
}
|
222
222
|
|
223
223
|
function getUserID() {
|
224
|
-
if (calledBeforeInit('getUserID')) return
|
224
|
+
if (calledBeforeInit('getUserID') || !FBWorld.state('connected')) return 0; // should not return anything unless connected
|
225
225
|
var id = uid();
|
226
226
|
return id && id.toString() || undefined; // FB.getUserID returns a string, so make sure we do the same
|
227
227
|
}
|
@@ -331,26 +331,40 @@ describe "facebook-stub.js" do
|
|
331
331
|
visit '/' # to initialize FBWorld
|
332
332
|
end
|
333
333
|
|
334
|
-
context "
|
335
|
-
|
334
|
+
context "User has not connected" do
|
335
|
+
it "should always return nil" do
|
336
336
|
set_user_id_using_string("12345")
|
337
|
+
get_user_id.should eql 0
|
338
|
+
set_user_id_using_number(12345)
|
339
|
+
get_user_id.should eql 0
|
337
340
|
end
|
341
|
+
end
|
338
342
|
|
339
|
-
|
340
|
-
|
343
|
+
context "User has connected" do
|
344
|
+
before do
|
345
|
+
connected!
|
341
346
|
end
|
342
347
|
|
343
|
-
|
348
|
+
context "user ID is set as string" do
|
349
|
+
before do
|
350
|
+
set_user_id_using_string("12345")
|
351
|
+
end
|
352
|
+
|
353
|
+
it "should return a string" do
|
354
|
+
get_user_id.should eql "12345"
|
355
|
+
end
|
344
356
|
|
345
|
-
context "user ID is set as number" do
|
346
|
-
before do
|
347
|
-
set_user_id_using_number(12345)
|
348
357
|
end
|
349
358
|
|
350
|
-
|
351
|
-
|
359
|
+
context "user ID is set as number" do
|
360
|
+
before do
|
361
|
+
set_user_id_using_number(12345)
|
362
|
+
end
|
363
|
+
|
364
|
+
it "should return a string" do
|
365
|
+
get_user_id.should eql "12345"
|
366
|
+
end
|
352
367
|
end
|
353
368
|
end
|
354
|
-
|
355
369
|
end
|
356
370
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebook-stub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -204,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
segments:
|
206
206
|
- 0
|
207
|
-
hash:
|
207
|
+
hash: -3282262625462427927
|
208
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
209
|
none: false
|
210
210
|
requirements:
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
version: '0'
|
214
214
|
segments:
|
215
215
|
- 0
|
216
|
-
hash:
|
216
|
+
hash: -3282262625462427927
|
217
217
|
requirements: []
|
218
218
|
rubyforge_project: facebook-stub
|
219
219
|
rubygems_version: 1.8.21
|