My site is an external Facebook app. I need users to come to the start
page and
if they are not already logged into their Facebook account (and have the
app
installed) see a button to take them to the Facebook login/install page.
Using RFacebook, login is normally achieved with a before_filter. The
user is
sent to the Facebook login/install page and then the app redirects them
back to
one of my pages.
In a story, am I supposed to mock out that filter method to set the
necessary
variables and do the redirection or what? I haven’t seen any examples
that use
mocks in stories. Also am I right in thinking that if I am to mock this
then I
will need to use something like Mocha?
My initial draft looks like this:
Story ‘An unlogged in user’, %{
As an unlogged in user
I want to log in to my Facebook account and start using MyApp
}, :type => RailsStory do
Scenario ‘starts at /’ do
When ‘arrive at /’ do
get ‘/’
end
Then 'the user should see the MyApp home page' do
response.should render_template('/sessions/index')
end
When 'the user clicks the log in/install button' do
post '/'
end
Then 'the user should be redirected to the Facebook login/MyApp
install
page and on success back to their personal MyApp home page’ do
### What might go here???
end
end
end