Reputation: 10162
I have a Rails 4.2 project that uses Bundler and Rspec. I want ruby-lint to work with my specs. By default it doesn't:
$ ruby-lint spec/models/user_spec.rb
user_spec.rb: error: line 3, column 1: undefined constant RSpec
user_spec.rb: error: line 4, column 3: undefined method describe
user_spec.rb: error: line 5, column 5: undefined method let
I have require 'rails_helper'
in spec/models/user_spec.rb
so it is natural to expect that ruby-lint
would load it and therefore load rspec
.
What should I do in order to make ruby-lint handle spec files correctly?
P.S. I don't have any specific ruby-lint configuration.
P.P.S. I have the same question for the Gemfile
file.
P.P.P.S. Actually I need it in order to get error checking in vim via synstastic or neomake.
Upvotes: 3
Views: 631
Reputation: 692
I have only used ruby-lint sparingly (because of the many false negatives it gives). So I am no expert unfortunately.
I suppose you want to use it in some automated way, because from the command line you can just point it to the directory that you need.
Looking at the code you can put the directories that you want to lint in a config file. I think something like the following entry should work:
directories: ['lib']
See example config.yaml and example rspecs and of course the relevant config code.
Upvotes: 1