Rails 3.0.7 fails functional testing with respond_with

As I upgraded my rails 2.x site to rails 3.0.7, I decided to swap the
respond block on my controller actions to “respond_with”.

I have respond_to :html, :xml, :mobile since I have mobile.erb
templates. I have zero issues with testing until I swapped to
respond_with in my controllers.

Now if I test functionals using default rails testing, the html tests
all come out perfect, but the mobile tests state that there are unknown
methods which are false. Here’s an example of a quick test:

HTML format that passes:

test “should get index” do
get :index
assert_response :success
assert_not_nil assigns(:conferences)
end

MOBILE format that fails:

test “should get index.mobile.erb” do
@request.accept = “mobile”
get :index, :format => :mobile
assert_response :success
assert_not_nil assigns(:conferences)
assert_select “table[class=grad header wide]”
assert_select “div[data-role=footer]”
end

The html format does not post an error and @conferences in the
controller has an assignment. There is nothing different in either the
html or mobile erb formats. Yet, the mobile fails stating that
conferences is an unknown method…

Any ideas what the issue is with the respond_with part for testing?

This turned out to not be a problem with respond_with or with the mobile
format. The problem was that the fixtures needed to have pre-set IDs to
match the conferences. Once I set the IDs to match, everything worked
out fine.