在rails 3.2.12中从webrat迁移到capybara后,未定义的方法'访问'

时间:2013-03-02 04:27:47

标签: ruby-on-rails rspec capybara webrat

我们正在从webrat迁移rails集成测试到capybara。将response.should替换为response.body.should。还将require 'capybara/rails'添加到spec_helper.rb。但是有一个错误说undefined method 'visit'。每个visit都会导致错误。这是导致错误的前两段代码:

describe "TestPaths" do
  describe "GET /customerx_test_paths" do
    before(:each) do
      ul = FactoryGirl.build(:user_level, :sys_user_group_id => ug.id)
      u = FactoryGirl.create(:user, :user_levels => [ul], :login => 'thistest', :password => 'password', :password_confirmation => 'password')
      visit 'authentify/'
      fill_in "login", :with => u.login
      fill_in "password", :with => 'password'
      click_button  
    end

    #customer status category
    it "should display customer status category index page" do
      visit customer_status_categories_path
      response.body.should have_selector("title", :content => "Customerx")
    end

...
end

之前的循环只是为下面的rspec案例登录系统。水豚代码有什么问题?谢谢你的帮助。

0 个答案:

没有答案