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

Improve route spec generation for controller generators #1160

Closed
cupakromer opened this issue Aug 27, 2014 · 13 comments
Closed

Improve route spec generation for controller generators #1160

cupakromer opened this issue Aug 27, 2014 · 13 comments

Comments

@cupakromer
Copy link
Member

If you use the Rails generator to create a controller with some actions, it will automatically add basic routes for it. This feature would need to do two things:

  1. Automatically add passing specs for the generated routes
  2. If no actions / routes were specified, include our default filler message

From #1155 (see discussion)

@glittershark
Copy link
Contributor

I'm happy to take this on if nobody's working on it right now.

@cupakromer
Copy link
Member Author

Sure thanks for the help @glittershark 💙

@b-lambert
Copy link

Looks like @glittershark gave up on this? I'd be happy to take it on!

@fables-tales
Copy link
Member

@b-lambert go ahead! As far as I'm aware we've not seen any further action on this pull request :)

@siakaramalegos
Copy link

siakaramalegos commented Oct 5, 2016

I'm not sure I quite understand what the request is - rspec already generates a controller test for any route specified in the generator. What's an example of an "improved" test?

For example, if you run rails g controller Delete test, it generates a controller spec file with the content:

require 'rails_helper'

RSpec.describe DeleteController, type: :controller do

  describe "GET #test" do
    it "returns http success" do
      get :test
      expect(response).to have_http_status(:success)
    end
  end

end

If the test route is removed from the generated command, this is what you get instead:

require 'rails_helper'

RSpec.describe DeleteController, type: :controller do

end

What do we want instead?

@fables-tales
Copy link
Member

@siakaramalegos I believe the idea is to generate routing specs: https://www.relishapp.com/rspec/rspec-rails/v/2-4/docs/routing-specs

@siakaramalegos
Copy link

Oh interesting! I'll wait a bit to see if @b-lambert picks it up.

@glittershark
Copy link
Contributor

I had actually done this (two years ago D:) but gave up when I couldn't manage to make the tests pass. Maybe I can see if I can dredge it up from a backup on whatever computer I had then

@b-lambert
Copy link

@glittershark see what you can dredge up!

@00dav00
Copy link

00dav00 commented Nov 17, 2016

@cupakromer @b-lambert @glittershark If you guys don't I would like to work on this one :)

@b-lambert
Copy link

I'm no longer working on it so it's up to @glittershark

@00dav00
Copy link

00dav00 commented Apr 21, 2017

@cupakromer This PR should cover the requested feature.

CC @b-lambert

00dav00 pushed a commit to 00dav00/rspec-rails that referenced this issue Jun 5, 2019
00dav00 pushed a commit to 00dav00/rspec-rails that referenced this issue Jun 5, 2019
00dav00 pushed a commit to 00dav00/rspec-rails that referenced this issue Jun 5, 2019
00dav00 pushed a commit to 00dav00/rspec-rails that referenced this issue Jun 7, 2019
benoittgt pushed a commit to benoittgt/rspec-rails that referenced this issue Aug 24, 2019
@klyonrad
Copy link
Contributor

klyonrad commented Jan 2, 2020

Seems like this issue can be closed with #2134, right?

@pirj pirj closed this as completed Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants