Module: Facebooker::Rails::TestHelpers

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 = {}) ⇒ Object



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

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

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



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

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

#facebook_parameters(overrides = nil) ⇒ Object



42
43
44
45
46
# File 'lib/facebooker/rails/test_helpers.rb', line 42

def facebook_parameters(overrides=nil)
  overrides ||= {}
  params = default_facebook_parameters.merge(overrides)
  params.merge(:fb_sig => generate_signature(params.stringify_keys))
end

#facebook_post(path, params = {}, fb_params = facebook_parameters) ⇒ Object



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

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

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



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

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

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



29
30
31
32
33
34
35
# File 'lib/facebooker/rails/test_helpers.rb', line 29

def facebook_verb(verb,path, params={})
  params = default_facebook_parameters.update(params)
  params.merge!(:fb_sig => generate_signature(facebook_params(params).stringify_keys))

  params = params.update(:canvas => true).update(params)
  send verb, path, params
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