2011-04-01 20 views
6

मैं Capybara रेल 3 (और परीक्षण इकाई), लेकिन साथ काम करने के लिए कोशिश कर रहा हूँ जब मैं rake test:integration चलाने का प्रयास मैं कोई त्रुटि मिलती है: ArgumentError: @request must be an ActionDispatch::Request रेल 3 Capybara त्रुटि

परीक्षण:

require 'integration_test_helper' 

class UserNotesTest < ActionDispatch::IntegrationTest 
    test "User should login" do 
    user = Factory.create(:user) 
    visit '/login' 
    assert_response :success 

    fill_in 'user_email', :with => user.email 
    fill_in 'user_password', :with => user.password 
    click_button 'Sign in' 

    assert_redirect_to notes_path 
    end 
end 

integration_test_helper:

require 'test_helper' 
require 'capybara/rails' 

module ActionDispatch 
    class IntegrationTest 
    include Capybara 
    end 
end 

मैं सच में यकीन है कि नहीं कर रहा हूँ क चींटियां गलत हो रही हैं ...

उत्तर

3

यह कैपिबरा के साथ @request वैरिएबल को visit के बाद कुछ भी निर्दिष्ट नहीं करने में समस्या आई है।

एक समाधान अर्थात

get '/login' 
assert_response :success 

rspec में, मैं page बजाय @request पर दावे का उपयोग, रेल में निर्मित तरीकों का उपयोग करने के लिए है।

है some discussion here.

अपनी समस्या के लिए
+1

आधिकारिक स्पष्टीकरण: https://github.com/jnicklas/capybara/issues/240 – user664833

संबंधित मुद्दे