views:

108

answers:

1

Hi all

i've developed before_filter - http://gist.github.com/138659 and in tests like

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:articles)
  end

i see

test_should_get_index(ArticlesControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split
    app/controllers/application_controller.rb:20:in

set_locale' /test/functional/articles_controller_test.rb:5:in test_should_get_index'

When i've added

setup do
@request.headers['HTTP_ACCEPT_LANGUAGE'] = "en"
end

nothing changed :( Could you tell me plz - whats wrong?

Rails 2.3.2, Ruby 1.8

+1  A: 

I've solved this issue with

@request.env['HOST'] = "somesite.com"
@request.env['HTTP_ACCEPT_LANGUAGE'] = "en"
Alexey Poimtsev