Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Nov 29, 2011

Conversation

Projects
None yet
2 participants
Contributor

hexgnu commented Nov 29, 2011

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!

@justinko justinko added a commit that referenced this pull request Nov 29, 2011

@justinko justinko Merge pull request #514 from hexgnu/master
Use `Kernel.rand` instead of `rand` for randomization.
bb2b02a

@justinko justinko merged commit bb2b02a into rspec:master Nov 29, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment