Broken controller tests after installing Capybara?

前端 未结 2 2009
眼角桃花
眼角桃花 2021-01-26 17:54

I had a bunch of combined controller/view tests written with rspec. I added the Capybara gem and wrote some integrations tests which pass fine. The only problem is that now in a

2条回答
  •  清歌不尽
    2021-01-26 18:30

    Capybara helpers only works within requests specs. Either create a new request spec, or pass in :type => :request in the describe block part, like so:

    describe "test for the testing test", :type => :request do
      it "should work with capybara" do
        visit root_path
        click_link "Home"
        page.should WHATEVA
      end
    end
    

    I realize this question was asked a long time ago, but I thought I would share anyway. GLHF

提交回复
热议问题