<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dec0der &#187; authlogic</title>
	<atom:link href="http://blog.d27n.com/category/rails/authlogic/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.d27n.com</link>
	<description>the d27n blog</description>
	<lastBuildDate>Fri, 27 Aug 2010 03:03:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>authlogic facebook-connect and rspec</title>
		<link>http://blog.d27n.com/2009/09/22/authlogic-facebook-connect-and-rspec/</link>
		<comments>http://blog.d27n.com/2009/09/22/authlogic-facebook-connect-and-rspec/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 23:51:01 +0000</pubDate>
		<dc:creator>dryan</dc:creator>
				<category><![CDATA[authlogic]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[facebook connect]]></category>

		<guid isPermaLink="false">http://blog.d27n.com/?p=34</guid>
		<description><![CDATA[
			
		
The past week I&#8217;ve had a chance to add facebook-connect to a rails site we&#8217;ve been working on by using the fantastic Authlogic and the Authlogic Facebook Connect add on.  However I found that all my existing controller tests blew up after adding the facebook-connect add on and after a little digging realized I needed [...]]]></description>
			<content:encoded><![CDATA[<div class="fblikebutton_button" style="float: right; margin-left: 10px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.d27n.com%2F2009%2F09%2F22%2Fauthlogic-facebook-connect-and-rspec%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:26px"></iframe>
		</div>
<p>The past week I&#8217;ve had a chance to add facebook-connect to a rails site we&#8217;ve been working on by using the fantastic <a title="authlogic" href="http://github.com/binarylogic/authlogic" target="_blank">Authlogic</a> and the <a title="Authlogic Facebook Connect" href="http://github.com/kalasjocke/authlogic_facebook_connect" target="_blank">Authlogic Facebook Connect</a> add on.  However I found that all my existing controller tests blew up after adding the facebook-connect add on and after a little digging realized I needed to stub a method on the  rspec TestRequest method.</p>
<p>The <a href="http://rdoc.info/rdoc/binarylogic/authlogic/blob/f2f6988d3b97e11770b00b72a7a9733df69ffa5b/Authlogic/TestCase.html" target="_blank">TestCase rdoc</a> explains how to setup authlogic within your rspec controller tests, so I won&#8217;t get into that here.  Since I already had everything setup with a login method in my spec_helper.rb file, I just had to add a single line to that method.</p>
<p><span style="font-family: monospace, 'Times New Roman', 'Bitstream Charter', Times, serif;">~/spec/spec_helper.rb</span></p>
<p><code></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco;"><span style="color: #b02b8e;">def</span> login(user)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #f55358;"><span style="color: #000000;"> request.stub!(</span>:set_facebook_session<span style="color: #000000;">)</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco;">UserSession.create(users(user))</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #b02b8e;">end</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #b02b8e;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #b02b8e;">
<p></code></p>
<p>Eventually I&#8217;ll have to write some tests for any features that use the facebook api, but for now stubbing that method does the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.d27n.com/2009/09/22/authlogic-facebook-connect-and-rspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
