# 无法加载文件 -- spec\_helper

**URL:** https://meta.discourse.org/t/cannot-load-such-file-spec-helper/96877
**Category:** Development
**Created:** [2018 年9 月 10 日 18:04 UTC](https://meta.discourse.org/t/cannot-load-such-file-spec-helper/96877 "2018-09-10T18:04:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)
#### Post date: [2018 年9 月 10 日 18:04 UTC](https://meta.discourse.org/t/cannot-load-such-file-spec-helper/96877/1 "2018-09-10T18:04:14Z")

</div>

Not sure what’s gone wrong here (apart from the obvious missing spec\_helper).

I’ve just cloned the Discourse repo and [followed these steps](https://github.com/discourse/discourse/blob/master/docs/DEVELOPMENT-OSX-NATIVE.md) for mac. I’m used to setting up projects and familiar with the steps involved.

I noticed `rails_helper` doesn’t require `spec_helper` and there is no `spec_helper` in the project. How are you guys running your rspec tests?

I get this error whether I run `bundle exec rspec` or `bundle exec rake autospec`.

Any help would be greatly appreciated as I’d rather not have to run in a VM.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年9 月 11 日 00:20 UTC](https://meta.discourse.org/t/cannot-load-such-file-spec-helper/96877/2 "2018-09-11T00:20:35Z")

</div>

Can you paste the exact version of the error?

What does `ruby --version` return? Are you in the `discourse` directory when you are running this? (and not in a subdirectory like `spec`)

---

<div class="post-metadata">

### Author: ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)
#### Post date: [2018 年9 月 12 日 07:51 UTC](https://meta.discourse.org/t/cannot-load-such-file-spec-helper/96877/4 "2018-09-12T07:51:40Z")

</div>

I’ve fixed this issue, it was nothing to do with Discourse per se.

I had `--require spec_helper` in my `.rspec` file which is recommended in multiple places, even the [rspec github wiki!](https://github.com/rspec/rspec/wiki)

I removed that line and now the tests run. Wanted to reply here in case anyone else runs into this issue.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [2018 年9 月 13 日 22:00 UTC](https://meta.discourse.org/t/cannot-load-such-file-spec-helper/96877/5 "2018-09-13T22:00:08Z")

</div>

This topic was automatically closed after 26 hours. New replies are no longer allowed.
