Skip to content

Instead of using rand in --order random please use Kernel.rand

gitlab-qa-bot requested to merge github/fork/hexgnu/master into master

Created by: hexgnu

Hi There,

I found an interesting little bug due to someone monkey patching Array#rand.

When running rspec --order random it would throw an error

Exception encountered: #<ArgumentError: wrong number of arguments (1 for 0)> backtrace: /Users/matthewkirk/.rvm/gems/ruby-1.9.2-p290@svsecure/gems/faker-0.3.1/lib/extensions/array.rb:2:in `rand'

I know it's Faker who is monkey patching Array but it seems like an easy enough fix to just call Kernel.rand and Kernel.srand instead of relying on whatever is included at that particular point.

Thanks!

Merge request reports