# RSpec search\_spec.rb RateLimiter LimitExceeded problems

**URL:** https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707
**Category:** Development
**Created:** [2016年五月5日 06:07 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707 "2016-05-05T06:07:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [2016年五月5日 06:07 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/1 "2016-05-05T06:07:00Z")

</div>

Continuing the discussion from [Search within topic is omitting results](https://meta.discourse.org/t/search-within-topic-is-omitting-results/42982/18):

I was getting things set up to do a PR - Pull Request - and figured it might be nice to include a test.

So I ran  
`bundle exec rspec spec/components/search_spec.rb`  
and got “38 examples, 30 failures” - Ouch!  
\* my change didn’t add any Fails, but then it didn’t remove any either :sadpanda:

After running

```plaintext
RAILS_ENV=development bundle exec rake db:migrate
RAILS_ENV=development bundle exec rspec spec/components/search_spec.rb

```

Much better, only 7 Fails. Some “expecting \_ got 5” etc. and some “RateLimiter LimitExceeded”

I was under the impression that testing was exempt from rate limits.

Am I missing a command option?

TBH, I’m not all that sure that I’ll be able to write some good test code, but I’d rather not be timed out between attempts.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2016年五月5日 06:54 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/2 "2016-05-05T06:54:01Z")

</div>

Have you tried flushing redis (`redis-cli flushall`)?

Also, you’ve got to start using autospec: `rake autospec`. You’re welcome 😉

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年五月5日 10:24 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/3 "2016-05-05T10:24:34Z")

</div>

> [@zogstrip](#):
>
> Also, you’ve got to start using autospec: rake autospec

Doesn’t that run every test? Sometimes it is nice to be able to run the ones you know you are affecting or are throwing errors to help nail things down.

Does autospec do something to help increase ratelimits?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2016年五月5日 13:31 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/4 "2016-05-05T13:31:50Z")

</div>

> [@cpradio](#):
>
> Doesn’t that run every test?

It does, but it’s clever enough to watch the files and stop what it’s currently doing to run the tests associated with the file you just saved 😉 And it will automatically keep re-trying the same tests until they’re green. Huge time saver since you don’t have to wait for rails to launch every time!

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年五月5日 13:34 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/5 "2016-05-05T13:34:17Z")

</div>

Hmm… Okay, with that in mind though, I think it doesn’t like me or it may not like my setup, as I tried it after wiping the discourse\_test database, and re-seeding that database, and it gets about a dozen failures.

3 are related to Search

```plaintext
rspec ./spec/components/search_spec.rb:68 # Search escapes non alphanumeric characters
rspec ./spec/components/search_spec.rb:429 # Search Advanced search supports before and after in:first user:
rspec ./spec/components/search_spec.rb:485 # Search Advanced search can find by status

```

So I guess I’ll have to spend some time to figure out why this is happening, when I get a chance.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2016年五月5日 13:35 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/6 "2016-05-05T13:35:38Z")

</div>

Might be an issue with the locale of your database or your postgresql server.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2016年五月5日 13:40 UTC](https://meta.discourse.org/t/rspec-search-spec-rb-ratelimiter-limitexceeded-problems/43707/7 "2016-05-05T13:40:01Z")

</div>

I followed

> [@Install Discourse on Ubuntu or Debian for Development](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727):
>
> warning This guide covers installation instructions in a development environment. For a production guide see: [Install Discourse in production with the official supported instructions](https://meta.discourse.org/t/how-to-install-discourse-in-production/142537) So you want to set up Discourse on Ubuntu or Debian to hack on and develop with? We’ll assume that you work locally and don’t have Ruby/Rails/Postgres/Redis installed on your Ubuntu or Debian system. Let’s begin! Requirements We suggest having at least 4 GB RAM and 2 CPU cores. Current compatibility: O…

I don’t see anything mentioned there about locale… or ensuring it is set properly.
