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

Getting routes within devise_scope #28

Closed
3dd13 opened this issue Aug 23, 2012 · 5 comments
Closed

Getting routes within devise_scope #28

3dd13 opened this issue Aug 23, 2012 · 5 comments

Comments

@3dd13
Copy link

3dd13 commented Aug 23, 2012

I am using devise to handle authentication.
Routes within devise_scope are not detected by api_taster in my Rails routes file.
any advise on how to make api_taster working with this case ?

I had a brief look at Rails routes,
Rails.application.routes.routes returns the routes with the following constraint:
@constraints=[#<Proc:0x007fa54c0dfd88@ .../gems/devise-2.1.2/lib/devise/rails/routes.rb:338 (lambda)>]

how does api_taster work on parsing the routes.rb file ?

the spec draft should be something like this

    it "should ignore unknown routes DSL" do
      routes = ActionDispatch::Routing::RouteSet.new
      routes.draw do
        devise_scope do
          get 'scoped_route' => 'scoped#route'
        end
      end
      Rails.application.stub(:routes).and_return(routes)
      Route.map_routes

      expected_route = [{:id=>1, :name=>"scoped_route", :verb=>"GET", :path=>"/scoped_route", :reqs=>{:action=>"route", :controller=>"scoped"}}]
      Route.missing_definitions.should == expected_route
    end
@adamlutz
Copy link

i too am experiencing difficulties w/ devise routes not appearing in api_taster

@adamlutz
Copy link

as fyi, i've created a forked version of the project to enable devise_scoped routes to appear. essentially commenting the line 38 in lib/api_taster/route.rb regardung ActionDispatch::Routing::Mapper::Constraints does the trick for me.

here's the fork: https://github.com/adamlutz/api_taster

I'm sure there's a good reason the original developer chose to skip over these types of routes, which I'd be curious to understand why.

as fyi, my forked version also simplifies much of the api_taster interface for my purposes of testing a json only API.

@fredwu
Copy link
Owner

fredwu commented Jan 30, 2013

There is an open pull request (#35) for it, but I'm just trying to remember why I did put this line in in the first place. :)

@timurvafin
Copy link
Contributor

👍 for this

@fredwu
Copy link
Owner

fredwu commented Mar 20, 2013

Fixed via #35

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

No branches or pull requests

4 participants