don't need activesupport in ruby 1.9

This commit is contained in:
John Bintz 2011-11-22 06:41:47 -05:00
parent 996cc2b1d4
commit 54dd29fd97
3 changed files with 5 additions and 6 deletions

View File

@ -19,8 +19,6 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.add_dependency 'activesupport', '>= 2.2.0'
s.add_development_dependency 'yard' s.add_development_dependency 'yard'
s.add_development_dependency 'bluecloth' s.add_development_dependency 'bluecloth'
s.add_development_dependency 'rspec' s.add_development_dependency 'rspec'

View File

@ -1,4 +1,4 @@
require 'active_support/secure_random' require 'securerandom'
module KeePass module KeePass
@ -14,7 +14,7 @@ module KeePass
# @return [Integer|Float] the random number # @return [Integer|Float] the random number
# @see ActiveSupport::SecureRandom#random_number # @see ActiveSupport::SecureRandom#random_number
def self.random_number(n = 0) def self.random_number(n = 0)
ActiveSupport::SecureRandom.random_number(n) SecureRandom.random_number(n)
end end
# Returns a randomly sampled item from the array. # Returns a randomly sampled item from the array.
@ -36,3 +36,4 @@ module KeePass
end end
end end

View File

@ -5,12 +5,12 @@ describe KeePass::Random do
describe "#random_number" do describe "#random_number" do
it "should use ActiveSupport::SecureRandom" do it "should use ActiveSupport::SecureRandom" do
ActiveSupport::SecureRandom.should_receive(:random_number).once.with(12) SecureRandom.should_receive(:random_number).once.with(12)
described_class.random_number(12) described_class.random_number(12)
end end
it "should accept default argument" do it "should accept default argument" do
ActiveSupport::SecureRandom.should_receive(:random_number).with(0) SecureRandom.should_receive(:random_number).with(0)
described_class.random_number described_class.random_number
end end