Forum Discussion
Hi!
Could you please use the `code` feature of the forum - in the toolbar, [...](expand) then [</>](insert code sample) - for better readability?
Your issue seems related to omniauth more than cucumber. You seem to already have looked at their documentation here: https://github.com/omniauth/omniauth/wiki/Integration-Testing#mocking-failurehttps://github.com/omniauth/omniauth/wiki/Integration-Testing#mocking-failure
Did you notice the following part?
By default Omniauth will raise an exception for invalid credentials in the development and test environments. If you'd like to be redirected to the/auth/failure
endpoint in those environments, include this code:OmniAuth.config.on_failure = Proc.new { |env| OmniAuth::FailureEndpoint.new(env).redirect_to_failure }
For debugging, which IDE are you using?
If you are using VS Code, make sure to have `debase` and `ruby-debug-ide` gem installed and the ruby extension for VS Code properly set-up. You'll then have the possibility to have such things in your `launch.json`
{
"version": "0.2.0",
"configurations": [
{
"name": "Cucumber",
"type": "Ruby",
"request": "launch",
"useBundler": true,
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/cucumber",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Cucumber current feature file",
"type": "Ruby",
"request": "launch",
"useBundler": true,
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/cucumber",
"args": ["${file}"],
"internalConsoleOptions": "openOnSessionStart"
}
]
}
Thanks for your reply. Yes, I have incorporated the additional code as well, but I wasn't positive about where it went. I tried several different options, but none seem to work.
Thanks for pointing out where to find the 'code' option.
I have edited my original post to reflect your suggestions. My IDE is Codio, and I'm using byebug for debugging
- aurelien-reeves4 years agoStaff
I don't know "Codio", so I let you dig their documentation 😅
Regarding the snippet I gave you about omniauth, you should put it in the
Before('@omniauth_test5') do
However Cucumber is not related to that. Make sure you can reproduce the behavior you want to test beside, like in a rails console for example.
I know that they are a few things to be careful with omniauth inside rails.- karmaTrinlema4 years agoOccasional Contributor
Still not working. I just hoped that someone in this community had some experience with testing the failure route in Rails4. Obviously this isn't a cucumber issue, but it is a testing issue.
- aurelien-reeves4 years agoStaff
You are using rails 4?
Which version of omniauth are you using?
Maybe there is some kind of incompatibility between all those dependencies
karmaTrinlema wrote:
(...) I just hoped that someone in this community had some experience with testing the failure route in Rails4. Obviously this isn't a cucumber issue, but it is a testing issue.
Yes, of course, and you are welcome to ask. I just wanted to make sure we agree with that 🙂
Related Content
- 2 years ago
- 5 years ago