Module: Facebooker::Rails::TestHelpers

Included in:
IntegrationSession
Defined in:
lib/facebooker/rails/test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#assert_facebook_redirect_to(url) ⇒ Object



4
5
6
7
8
# File 'lib/facebooker/rails/test_helpers.rb', line 4

def assert_facebook_redirect_to(url)
  assert_response :success
  assert_not_nil facebook_redirect_url
  assert_equal url, facebook_redirect_url
end

#facebook_delete(path, params = {}, session = nil, flash = nil) ⇒ Object



26
27
28
# File 'lib/facebooker/rails/test_helpers.rb', line 26

def facebook_delete(path,params={}, session=nil, flash=nil)
  facebook_verb(:delete, path, params, session, flash)
end

#facebook_get(path, params = {}, session = nil, flash = nil) ⇒ Object



14
15
16
# File 'lib/facebooker/rails/test_helpers.rb', line 14

def facebook_get(path, params={}, session=nil, flash=nil)
  facebook_verb(:get, path, params, session, flash)
end

#facebook_params(params = {}) ⇒ Object



34
35
36
37
38
# File 'lib/facebooker/rails/test_helpers.rb', line 34

def facebook_params(params = {})
  params = default_facebook_parameters.with_indifferent_access.merge(params || {})
  sig = generate_signature params
  params.merge(:fb_sig => sig)
end

#facebook_post(path, params = {}, session = nil, flash = nil) ⇒ Object



18
19
20
# File 'lib/facebooker/rails/test_helpers.rb', line 18

def facebook_post(path,params={}, session=nil, flash=nil)
  facebook_verb(:post, path, params, session, flash)
end

#facebook_put(path, params = {}, session = nil, flash = nil) ⇒ Object



22
23
24
# File 'lib/facebooker/rails/test_helpers.rb', line 22

def facebook_put(path,params={}, session=nil, flash=nil)
  facebook_verb(:put, path, params, session, flash)
end

#facebook_verb(verb, path, params = {}, session = nil, flash = nil) ⇒ Object



30
31
32
# File 'lib/facebooker/rails/test_helpers.rb', line 30

def facebook_verb(verb, path, params={}, session=nil, flash=nil)
  send verb, path, facebook_params(params).reverse_merge(:canvas => true), session, flash
end

#follow_facebook_redirect!Object



10
11
12
# File 'lib/facebooker/rails/test_helpers.rb', line 10

def follow_facebook_redirect!
  facebook_post facebook_redirect_url
end