Rails, Devise, Rspec: Undefined method ‘sign_in’

Did you recently upgrade to RSpec 3 like I did? This is from the RSpec 3 documentation:

Automatically Adding Metadata
RSpec versions before 3.0.0 automatically added metadata to specs based on
their location on the filesystem. This was both confusing to new users and not
desirable for some veteran users.

In RSpec 3, this behavior must be explicitly enabled:

​# spec/rails_helper.rb
RSpec.configure do |config|
    config.infer_spec_type_from_file_location!
end

Since this assumed behavior is so prevalent in tutorials, the default
configuration generated by rails generate rspec:install enables this.

If you follow the above listed canonical directory structure and have
configured infer_spec_type_from_file_location!, RSpec will automatically
include the correct support functions for each type.

After I add that configuration snippet, I no longer have to specify the spec type (e.g. type: :controller).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)