rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

Cop idea: don't use render_views

Open Floppy opened this issue 6 years ago • 4 comments
trafficstars

render_views couples together controller and view tests, which some may find undesirable. Rubocop could help out by adding a cop forbidding use of that feature?

Floppy avatar May 14 '19 21:05 Floppy

I don’t think we can do that. Investigating your rspec configuration is a runtime check, but RuboCop does static analysis i.e. looks at your code without running it.

bquorning avatar May 15 '19 04:05 bquorning

Could it just check for that text in the spec files? I mean, I can basically do it with grep. Forgive me if that's wildly unhelpful, I have no idea how Rubocop works internally :)

I guess though if someone else uses that method name, that wouldn't work.

Floppy avatar May 15 '19 10:05 Floppy

You are right, render_views isn’t a config option, but an rspec-rails method. We can catch this in rubocop-rspec.

bquorning avatar May 15 '19 12:05 bquorning

Controller specs are deprecated in favour of request specs. Do you think it still makes sense to implement this?

pirj avatar Dec 20 '19 17:12 pirj