Rspec_on_rails: controller method not getting called

In my rspec_on_rails controlle rspec, I have this:

require File.dirname(FILE) + ‘/…/spec_helper’

describe FooController, “with a foo” do
it “should be false” do
get ‘index’
assigns[:foo].should be_false
end
end

In my controller I have this:

class FooController < ApplicationController
def index
@foo = FALSE
end
end

But the result of running the spec is:
1)
‘FooController should be false’ FAILED
expected false, got nil

It seems I can give any argument to getin the description and it won’t
complain that the method is missing, so I suppose this means that the
get
in the description is not calling my ‘index’ method. Any advice?

I’m using the latest RSpec and rspec_on_rails, ruby 1.8.6, Rails 1.2.3.

Thanks,

Chad


View this message in context:
http://www.nabble.com/rspec_on_rails%3A-controller-method-not-getting-called-tf4530269.html#a12927783
Sent from the rspec-users mailing list archive at Nabble.com.

I figured it out.

By doing this session sanity check in the spec (as recommended by
dchelimsky):
sess = session
get ‘index’
sess.should equal(session)

I was able to see that a ‘Please log in’ redirect was preventing index
from
getting called.

Chad

cnantais wrote:

end
1)

Chad


View this message in context:
http://www.nabble.com/rspec_on_rails%3A-controller-method-not-getting-called-tf4530269.html#a12928446
Sent from the rspec-users mailing list archive at Nabble.com.