Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route helpers sometimes return route with extension, and sometimes do not #10

Open
tmertens opened this issue Apr 6, 2016 · 3 comments
Assignees
Labels

Comments

@tmertens
Copy link

tmertens commented Apr 6, 2016

When running tests for an app, sometimes the grape route helpers return a string with the extension for the route appended (expected behavior), and sometimes they do not (not expected). This causes tests to fail for code that generates a payload with callback URLs using grape route helpers, because the return value is not consistent.

Any ideas why this would be happening? I suspect it is a load order issue but I have not been able to identify the specific culprit yet as it only happens 1:20 builds; however, when it does occur we see all tests that rely on grape route helpers fail, not just one or two intermittent failures within the specs.

@reprah
Copy link
Owner

reprah commented Apr 11, 2016

Thanks for reporting this. I'm not sure why there's an intermittent failure off the top of my head. Are you able to write a generic test that helps me reproduce this?

@reprah
Copy link
Owner

reprah commented Apr 29, 2016

Can you describe how you're using the helpers more? That might help me figure out what's going on. How are you using the helpers to generate a payload that has callback URLs in them? Can you paste an example, and example return value?

Did you only see test failures when you're using the helpers in that specific way?

@reprah reprah added the bug label May 2, 2016
@tmertens
Copy link
Author

tmertens commented May 3, 2016

@reprah Yes, we are using the helpers to generate callback URLs. Here is an example:

class Capabilities
  include GrapeRouteHelpers::NamedRouteMatcher

  def my_callback_hash_generator
    # Where `api_install_complete_path` is the grape route helper
    { callbackUrl: URI.join(root_url, api_install_complete_path).to_s }
  end

  def root_url
    Rails.application.routes.url_helpers.root_url
  end
end

The return value is always the same path, with the exception that sometimes it is missing the .json extension.

I only use the helpers in a couple of places, so unfortunately I don't have a lot of other use cases to draw from.

@reprah reprah self-assigned this May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants