fb_rails 0.3.0 → 0.4.0

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/README.rdoc CHANGED
@@ -24,7 +24,7 @@ FBML and the Facebook Javascript API are for. Here's an example:
24
24
  <div id="fb-root"></div>
25
25
  <script src="http://connect.facebook.net/en_US/all.js"></script>
26
26
  <script>
27
- FB.init({appId: '<%= fb.app_id ?>', status: true, cookie: true, xfbml: true});
27
+ FB.init({appId: '<%= fb.app_id %>', status: true, cookie: true, xfbml: true});
28
28
  </script>
29
29
  <%= fbml 'login-button' %>
30
30
 
@@ -83,4 +83,4 @@ connections. This is done with FbRails::Mock:
83
83
  mock.add 'me', 'first_name' => 'Matt', 'last_name' => 'Higgins'
84
84
  end
85
85
 
86
- Now, a call to 'fb.graph.get 'me' returns the above response.
86
+ Now, a call to 'fb.graph.get 'me' returns the above response.
@@ -39,7 +39,7 @@ module FbRails
39
39
 
40
40
  def build_path(url, params)
41
41
  params = params.merge(:access_token => connect.access_token)
42
- param_string = params.map { |key, value| "#{key}=#{CGI.escape(value)}" }.join('&')
42
+ param_string = params.map { |key, value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
43
43
  url = "#{url}?#{param_string}"
44
44
  end
45
45
 
@@ -0,0 +1,8 @@
1
+ module FbRails
2
+ module TestHelper
3
+ def fb_cookie(uid = 42, access_token = 'abc')
4
+ value = FbRails::Cookie.encode({:uid => uid, :access_token => access_token}, FbRails::Config.secret)
5
+ {FbRails::Connect.cookie_name => value}
6
+ end
7
+ end
8
+ end
data/lib/fb_rails.rb CHANGED
@@ -8,6 +8,7 @@ module FbRails
8
8
  autoload :Fb
9
9
  autoload :Mock
10
10
  autoload :Integration
11
+ autoload :TestHelper
11
12
  end
12
13
 
13
14
  require 'fb_rails/railtie'
data/test/connect_test.rb CHANGED
@@ -19,7 +19,7 @@ class FbRails::ConnectTest < ActiveSupport::TestCase
19
19
  end
20
20
 
21
21
  test 'valid cookie' do
22
- fb_connect = FbRails::Connect.new(FbRails.cookie)
22
+ fb_connect = FbRails::Connect.new(fb_cookie)
23
23
 
24
24
  assert fb_connect.connected?
25
25
  assert_equal 42, fb_connect.uid
data/test/fb_test.rb CHANGED
@@ -9,7 +9,7 @@ class FbRails::FbTest < ActiveSupport::TestCase
9
9
  end
10
10
 
11
11
  test 'connect delegation' do
12
- fb = FbRails::Fb.new(FbRails.cookie)
12
+ fb = FbRails::Fb.new(fb_cookie)
13
13
 
14
14
  assert fb.respond_to?(:connected?)
15
15
  assert fb.respond_to?(:uid)
@@ -17,7 +17,7 @@ class FbRails::LogSubscriberTest < ActiveSupport::TestCase
17
17
  end
18
18
 
19
19
  test 'request notification' do
20
- graph = FbRails::Graph.new(FbRails::Connect.new(FbRails.cookie))
20
+ graph = FbRails::Graph.new(FbRails::Connect.new(fb_cookie))
21
21
  graph.get 'test'
22
22
 
23
23
  wait
data/test/mock_test.rb CHANGED
@@ -8,7 +8,7 @@ class FbRails::MockTest < ActiveSupport::TestCase
8
8
  end
9
9
 
10
10
  test 'mock' do
11
- graph = FbRails::Graph.new(FbRails::Connect.new(FbRails.cookie))
11
+ graph = FbRails::Graph.new(FbRails::Connect.new(fb_cookie))
12
12
 
13
13
  result = graph.get 'test'
14
14
 
data/test/test_helper.rb CHANGED
@@ -10,9 +10,6 @@ require 'sample/test_controller'
10
10
  FbRails::Config.app_id = 'foo'
11
11
  FbRails::Config.secret = 'bar'
12
12
 
13
- FbRails.class_eval do
14
- def self.cookie(uid = 42, access_token = 'abc')
15
- value = FbRails::Cookie.encode({:uid => uid, :access_token => access_token}, FbRails::Config.secret)
16
- {FbRails::Connect.cookie_name => value}
17
- end
13
+ ActiveSupport::TestCase.class_eval do
14
+ include FbRails::TestHelper
18
15
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
7
+ - 4
8
8
  - 0
9
- version: 0.3.0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matthew Higgins
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-04 00:00:00 -07:00
17
+ date: 2011-01-11 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -55,6 +55,7 @@ files:
55
55
  - lib/fb_rails/log_subscriber.rb
56
56
  - lib/fb_rails/mock.rb
57
57
  - lib/fb_rails/railtie.rb
58
+ - lib/fb_rails/test_helper.rb
58
59
  - lib/fb_rails.rb
59
60
  - test/config_test.rb
60
61
  - test/connect_test.rb