Reputation: 1066
File system looks like this:
page_spec.rb:
require 'rails_helper'
RSpec.describe Page, type: :model do
...
end
rails_helper.rb's require part:
require 'spec_helper'
When I try to run rspec page_spec.rb
it says that "cannot load such file rails_helper".
When i change to require '../rails_helper'
, it says "Cannot load spec_helper". How can I fix this?
Upvotes: 1
Views: 1153
Reputation: 36
Change the line
require 'rails_helper'
in page_spec.rb file to require_relative '../rails_helper'
.
Upvotes: 1
Reputation: 79
Run the rspec
command from the root directory rspec spec/models/page_spec.rb
Upvotes: 1