Skip to content

RSpec errors when using spring #23

@esambo

Description

@esambo

Problem

ℹ️ FYI, I get RSpec errors when using spring because the custom testing/rspec RSpec matchers aren't loaded.

Errors

NameError:
       undefined local variable or method `act_as_enumerated'

and

expected #<...> to respond to `has_enumerated?`

Fix

My workaround is to add the the following to my rails config/environments/test.rb file:

  config.to_prepare do
    require_dependency "testing/rspec"
  end

Context

This is inspired by rails/spring#505 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions