I've recently been trying to run RSpec in a Rails application and I can't seem to get it to work. I've followed all the instructions and I still can't even get a simple test to run.
RSpec is in my Gemfile, and I've run rails generate rspec:install
.
I have the spec folder set up with a simple model test. However, every time I try to run RSpec, I get the following error:
An error occurred while loading ./spec/models/user_spec.rb. - Did you mean?
rspec ./spec/spec_helper.rb
Failure/Error: require File.expand_path('../config/environment', __dir__)
LoadError:
cannot load such file -- rexml/document
My user_spec.rb looks like this:
require 'rails_helper'
RSpec.describe User, type: :model do
it "tests my rspec installation"
end
I'm new to Rails so I would really appreciate any help!
question from:
https://stackoverflow.com/questions/65914634/rspec-is-giving-me-a-loaderror 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…