Capybara: post, get methods not working when changing function request directory name

After updating to the latest version of Capybara, all of my visit methods stopped working, so I followed the solution provided by some people, which was to rename the request spec directory to "functions". Now my visit methods are working again, but any get or post method in the request spec throws this error:

undefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1::Nested_1:0x007f9cce9adc20>

      

Here's the code that raises the error:

describe "getting posts" do
    before { get(forum_posts_path) }
    it "should respond with a 200" do
        response.response_code.should == 200
    end
end

      

Any workaround for this?

0


source to share


1 answer


You won't rename the spec / requests directory to spec / features : you have both:

  • Tests that use Capybara DSL ( visit

    etc.) and usually assert against page

    in the specs / features .
  • Tests that use DSL test ( get

    etc) and usually assert against response

    in specs / queries


See fooobar.com/questions/1989544 / ... for details, in particular external links.

+4


source







All Articles