Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

how to do rspec testing for /.well-known/core #10

Open
mcr opened this issue Feb 7, 2018 · 1 comment
Open

how to do rspec testing for /.well-known/core #10

mcr opened this issue Feb 7, 2018 · 1 comment

Comments

@mcr
Copy link
Collaborator

mcr commented Feb 7, 2018

I naturally want to do rspec testing of my CoAP application.
It also speaks HTTP(S), although I imagine that production that it will be two completely different deploys.

I have changed things so that david is not automatically chosen for "rails server", so that I can develop in both worlds the same time. So one has to do something like: "bin/rails server david -b ::2 -p 5684"

rspec requests skip the framework layer and goes directly to routes. I can test my controllers via config/routes.rb just fine. But I can't test the resource discovery process, doing a GET to /.well-known/core?rt=est.ace to get the location of the resource and then using it.

I propose that the /.well-known/core processing no longer be special cased in lib/david/resource_discovery.rb's call, but instead be referenced in the applications' routes.rb.

The rails5 way might be to use a concern, I see that this how active-scaffold has gone, but the old rails4 "as_routes" may work as well for this.

@nning
Copy link
Owner

nning commented Mar 4, 2018

I am not sure if adding the route completely manually is a good solution. However, I see the problem with /.well-known/core being provided by a middleware and therefor not having a proper route.

Automatically adding routes does not seem to be a solution. We could mount an engine to /.well-known/core with a routing helper (comparable to devise_for for example).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants