We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6e3ad3e + 293bab1 commit cf868a3Copy full SHA for cf868a3
lib/forgery/extensions/range.rb
@@ -9,7 +9,7 @@ def unextend
9
def random
10
Integer(first) && Integer(last)
11
raise ArgumentError if first > last
12
- Kernel.rand(last - first + (exclude_end? ? 0 : 1)) + first
+ Random.rand self
13
rescue ArgumentError
14
Forgery::Extend(to_a).random
15
end
spec/extensions/range_spec.rb
@@ -27,7 +27,7 @@
27
28
29
it "should not return the maximum at excluded range" do
30
- expect(Kernel).to receive(:rand).with(9).and_return(8)
31
- expect(Forgery::Extend(0...9).random).not_to be_equal 9
+ Random.should_receive(:rand).with(0...9).and_return(8)
+ Forgery::Extend(0...9).random.should_not be_equal 9
32
33
0 commit comments