teamcapybara / capybara

Acceptance test framework for web applications
http://teamcapybara.github.io/capybara/
MIT License
10.03k stars 1.45k forks source link

undefined method `post' for #<Capybara::Selenium::Driver #568

Closed leequarella closed 12 years ago

leequarella commented 12 years ago

Completely flubbered on this one... not finding references to this error. Capybara is working just fine with my rpsec setup, but when setting the :js => true option on a test, this error occurs:

undefined method `post' for #<Capybara::Selenium::Driver>

Maybe my brain just borked, but I don't even know where to start :-(

joliss commented 12 years ago

I think you're trying to call a post method from your test -- there is no such method in Capybara (apart from an internal Rack-Test method). Use the visit method instead. See the README at https://github.com/jnicklas/capybara, section The DSL, for more info.

joliss commented 12 years ago

By the way, the mailing list is a better place for questions like this -- this issue tracker is meant for reproducible bugs with Capybara.

g-ilham commented 10 years ago

Hi Guys I have a strange issue with 'remote: true' links on my side I use link_to to send post request on view:

 = link_to 'Toggle', toggle_moderator_user_path(user), method: :patch, remote: true

In config/routes.rb I have:

 resources :users do
      member do
        patch :toggle_moderator
      end
    end

this my test

 describe 'toggle moderator' do
    it 'remove moderator privilegue', js: true do
      click("Toggle")
    end
  end

And then I see fail in log

ActionController::RoutingError:
       No route matches [GET] "/users/9/toggle_moderator"

Seems, that on click to link to it always sends GET Thanks for any help)