@@ -55,67 +55,13 @@ class FakeController < ActionController::Base
55
55
controller . fb_cookie? . should be_false
56
56
end
57
57
58
- it "gets the hash from the cookie" do
59
- controller . stub! ( :cookies ) . and_return ( "fbs_12345" => "param1=val1¶m2=val2" )
60
- controller . fb_cookie_hash . should == { "param1" => "val1" , "param2" => "val2" }
61
- end
62
-
63
- it "creates a user from the cookie" do
64
- controller . current_facebook_user . should_not be_nil
65
- controller . current_facebook_user . should be_an_instance_of ( Mogli ::User )
66
- controller . current_facebook_user . id . should == "12451752"
67
- end
68
-
69
- it "sets the client for the user" do
70
- controller . current_facebook_user . client . access_token . should == "114355055262088|57f0206b01ad48bf84ac86f1-12451752|63WyZjRQbzowpN8ibdIfrsg80OA."
71
- end
72
58
73
59
it "doesn't create a user if there is no app cookie" do
74
60
Facebooker2 . app_id = "other_app"
75
61
controller . current_facebook_user . should be_nil
76
62
end
77
63
78
- it "creates a client from the cookie" do
79
- controller . current_facebook_client . should_not be_nil
80
- controller . current_facebook_client . should be_an_instance_of ( Mogli ::Client )
81
- controller . current_facebook_client . access_token . should == "114355055262088|57f0206b01ad48bf84ac86f1-12451752|63WyZjRQbzowpN8ibdIfrsg80OA."
82
- end
83
64
84
- it "creates a client from params" do
85
- controller . stub! ( :fb_cookie_hash ) . and_return ( { } )
86
- controller . stub! ( :cookies ) . and_return ( { } )
87
- controller . stub! ( :facebook_params ) . and_return (
88
- :oauth_token => "103188716396725|2.N0kBq5D0cbwjTGm9J4xRgA__.3600.1279814400-585612657|Txwy8S7sWBIJnyAXebEgSx6ntgY." ,
89
- :expires => "1279814400" ,
90
- :user_id => "585612657" )
91
- controller . current_facebook_client . access_token . should == "103188716396725|2.N0kBq5D0cbwjTGm9J4xRgA__.3600.1279814400-585612657|Txwy8S7sWBIJnyAXebEgSx6ntgY."
92
- controller . current_facebook_user . id . should == "585612657"
93
- end
94
-
95
- it "verifies that the signature is correct" do
96
- controller . fb_cookie_signature_correct? ( {
97
- "access_token" => "114355055262088|57f0206b01ad48bf84ac86f1-12451752|63WyZjRQbzowpN8ibdIfrsg80OA." ,
98
- "expires" => "0" ,
99
- "secret" => "1e3375dcc4527e7ead0f82c095421690" ,
100
- "session_key" => "57f0206b01ad48bf84ac86f1-12451752" ,
101
- "uid" => "12451752" ,
102
- "sig" => "4337fcdee4cc68bb70ec495c0eebf89c" } ,
103
- "42ca6de519d53f6e0420247a4d108d90"
104
- ) . should be_true
105
- end
106
-
107
- it "returns false if the signature is not correct" do
108
- controller . fb_cookie_signature_correct? ( {
109
- "access_token" => "114355055262088|57f0206b01ad48bf84ac86f1-12451752|63WyZjRQbzowpN8ibdIfrsg80OA." ,
110
- "expires" => "0" ,
111
- "secret" => "1e3375dcc4527e7ead0f82c095421690" ,
112
- "session_key" => "57f0206b01ad48bf84ac86f1-12451752" ,
113
- "uid" => "5436785463785" ,
114
- "sig" => "4337fcdee4cc68bb70ec495c0eebf89c" } ,
115
- "42ca6de519d53f6e0420247a4d108d90"
116
- ) . should be_false
117
-
118
- end
119
65
120
66
it "does not set a cookie if it is not required" do
121
67
controller . stub! ( :cookies ) . and_return ( "" )
0 commit comments