Displaying 20 results from an estimated 300 matches similar to: "New test helpers"
2007 Nov 18
0
Pseudo resource routes
I added a route mapper called facebook_resources. This allows you to
create pseudo-resource routes. Since everything is a POST in
Facebook, you can''t identify routes using HTTP verbs. Each route is
prefixed with its action, except for index.
Example:
map.facebook_resources :profiles
Will give you the following named routes:
new_profile POST /profiles/new
profiles POST
2007 Nov 21
0
Upgrade to latest trunk if you''re getting "undefined method `degree=''"
Facebook added the ''degree'' field to education info. This breaks
user.populate because the ''degree'' field doesn''t exist in the
education history model.
On a side note, if a method calls a dangerous method (ending with !),
shouldn''t it be classified as dangerous too?
Shane
--
http://myfitbuddy.com | http://shanesbrain.net |
2007 Nov 30
0
Rails test helpers
Hey guys-
I started a module for Rails test helpers. The first one is
assert_fb_redirect. This is like Rails'' assert_redirect, but works
for the fb:redirect FBML tag.
Any ideas for more? I was thinking about a version of assert_select
that works with Facebook. assert_select is based on CSS selectors,
which won''t work with Facebook since the use of colons (:) in search
2008 Jan 26
0
New feature: get profile pictures
The profile picture album is treated as a special album by Facebok and
is not returned in the normal get photo albums API call. A bunch of
special operations have to be performed to get the aid for the profile
picture album. I added a method to User to get the profile pics. Use
as follows:
facebook_session.user.profile_photos # returns Photo objects
Enjoy,
Shane
--
http://myfitbuddy.com |
2008 Jan 30
0
Publish templatized action with JSON gotcha in Rails 1.2
Hey guys-
to_json in Rails 1.2 produces json with unquoted keys, which is
invalid. Therefore, publish_templatized_action produces invalid json
for feed publishing, and you''ll get an error from Facebook. To fix
this, put this line in environment.rb:
ActiveSupport::JSON.unquote_hash_key_identifiers = false
You don''t need to do this if you''re running Rails 2.0. Just a
2008 Feb 14
0
New features: Application properties and cookies
Hey guys-
Two new features:
Set/get app properties like this:
properties = { :application_name => "Video Jukebox", :default_fbml
=> "blah" }
facebook_session.admin.set_app_properties(properties)
properties =
facebook_session.admin.get_app_properties(:application_name,
:default_fbml)
Set/get cookies:
facebook_session.data.set_cookie(uid,
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial
that is sent to a web service. Here''s the code:
class MyController < ApplicationController
after_filter :post_to_webservice
def show
# show logic
end
def post_to_webservice
stuff = render_to_string :partial => ''stuff''
webservice_post(stuff)
end
I get a DoubleRenderError in the
2006 Sep 03
1
Returning different values with stubs
Right now I''m working on adding tests to a method that looks like this:
def get_via_redirect(path, args={})
get path, args
follow_redirect! while redirect?
status
end
So, I want to confirm that get is called and that status is returned
but I also want to see that when the value of redirect? effects how
many times follow_redirect is called. Is there
2007 Nov 28
2
follow_redirect!() doesn't exist?
Hi all
I want to do some functional testing. I stumbled over the method
follow_redirect!() somewhere, but evidently this doesn''t seem to exist
in my Rails version (1.2.5 or so)?! Then I tried follow_redirect()
(without the exclamation mark), and I get the following error:
TypeError: can''t convert Symbol into String
What am I doing wrong? Thanks for help :-)
Josh
--
Posted via
2006 Apr 03
0
follow_redirect! aborts rake during integration tests
I''m running integration tests on Rails 1.1/Ruby 1.8.4/Windows XP and have
found that any call to follow_redirect! (directly or through
[get|post]_via_redirect) causes rake to abort (see command line output
below). Has anyone else seen this error, or know what might be the trouble?
Thanks!
Tom
C:\dev\h2h>rake test:integration --trace
(in C:/dev/h2h)
** Invoke test:integration
2006 Apr 04
1
integration tests - 1.1
I?m using the new 1.1 integration test facility? I?m trying to write a
test that sees if a controller redirects to the correct place and
preserves the query string.
Here?s the code:
class LoginRedirectTest < ActionController::IntegrationTest
def test_non_admin_auth
request_uri = "/datafeed/event/report?blah=blah"
get(request_uri)
follow_redirect!
2007 Jul 25
3
autotest + integration testing (follow_redirect!) error
I''ve got an interesting (possibly) problem right now between autotest
and rails integration tests. There are a few things to preface this
with.
Works fine:
rake test
rake test:integration
Blows up:
autotest
Autotest is correctly determining rails and runs tests just fine. One
part of the behavior is that if I save a change in just the
integration test (even hitting cmd+s to trigger a
2007 Nov 30
0
Tests not passing
There is a catch-all rescue at the bottom of rails_integration_test
that stops the tests from running if any of the require statements
fail. In my case, require File.dirname(__FILE__)+''/../init'' fails and
none of the tests get run. When I comment out that line, there are a
couple of failures relating to redirection.
Shane
--
http://myfitbuddy.com
http://shanesbrain.net
2007 Dec 11
0
before_filter work around
Hi All,
I am working on a rails app that has facebook and non-facebook
portions and since facebooker seems to want to resolve to the default
route of "/" i''ve written a little before filter that seems to make
these two exist OK.
def is_facebook_request?
redirect_to(params.merge({ :controller => ''facebook_accounts'' }))
and return false if
2008 Mar 11
0
detecting if in the FB canvas
I have been checking the params for params[:fb_sig] to detect if the
client is in the Facebook canvas, but those don''t work at the
beginning of a controller when you''re calling before_filters.
I have a require_login in the before_filter, but I want to skip it if
the user is from Facebook. So are there any other ways to check that
the client is coming from the canvas?
2008 Mar 11
0
Facebooker-talk Digest, Vol 5, Issue 12
Hi all,
I wanted to test requests from internal facebook apps, so I''ve been
mimicking FBML requests from facebook in my tests using the following:
def test_can_facebook_internal_app_login
fb_login_as :facebooker
num_of_members = Member.count
facebook_request :get, :home
assert_response :success
assert_equal num_of_members, Member.count
2008 Mar 11
0
Facebook_request in unit tests
Apologies for not chaning the subject line. :(
Hi all,
I wanted to test requests from internal facebook apps, so I''ve been
mimicking FBML requests from facebook in my tests using the following:
def test_can_facebook_internal_app_login
fb_login_as :facebooker
num_of_members = Member.count
facebook_request :get, :home
assert_response :success
assert_equal
2008 Mar 16
0
bypassing verify_authenticity_token before_filter when in facebook
Hi list,
Not sure if this is helpful for anyone but I am working on a Facebook
project where I need bypass the new CSRF protection (built into Rails
2.0) under certain conditions. However, since my project works
outside of Facebook I don?t want to disable the CSRF protection from
requests made outside of Facebook.
Here is a small extension i wrote for the ForgeryProtection module.
2008 Mar 27
0
handling post-remove URL / uninstall of application
Hi there,
I''ve configured my post-remove URL (which has to be directly to my
site, not an apps.facebook.com URL) and now I''m trying to figure out
how to handle this. It''s poorly documented here:
http://wiki.developers.facebook.com/index.php/Post-Remove_URL
It seems as though support for this is currently not yet in
Facebooker. In order to get it to work, it
2008 Sep 08
0
InvalidAuthenticityToken when user adds application through facebook registration
If a user that has not yet signed up for Facebook attempts to visit an
application page facebook presents them with a registration form. After this
form is completed, the application is automatically added to the user''s
account and Facebook displays the following message:
Welcome George Tesster! Your account has been created.
[application] has been added to your account.
Facebook also