Is it possible to simulate failing omniauth request with cucumber?
I'm trying to get a cucumber test to follow the failure route in my sessions controller when making an omniauth request with invalid credentials: match 'auth/failure', :to => 'sessions#failure', :via => [:get, :post] But instead of doing that, it seems to return and start the register/login process (which then fails). I thought I could do this by setting up my features/support/env.rb as: Before('@omniauth_test5') do OmniAuth.config.test_mode = true Capybara.default_host = 'http://example.com' OmniAuth.config.mock_auth[:github] = :invalid_credentials Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:github] end After('@omniauth_test5') do OmniAuth.config.test_mode = false OmniAuth.config.mock_auth[:github] = nil end But this is just failing later in my sessions create method I inserted this code as well, but I'm not entirely positive it's in the right place. OmniAuth.config.on_failure = Proc.new { |env| OmniAuth::FailureEndpoint.new(env).redirect_to_failure } I'm also finding it very difficult to find a reasonable place to put a stop for debugging. I realize that this isn't strictly a cucumber question, but I'm hoping that others in this community are familiar with how this can be done properly. THANKS!2.2KViews0likes5Comments