From 54dd29fd977c731f346311b737be90c4c07aafa8 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 22 Nov 2011 06:41:47 -0500 Subject: [PATCH] don't need activesupport in ruby 1.9 --- keepass-password-generator.gemspec | 2 -- lib/keepass/random.rb | 5 +++-- spec/random_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/keepass-password-generator.gemspec b/keepass-password-generator.gemspec index f145b28..cc53f53 100644 --- a/keepass-password-generator.gemspec +++ b/keepass-password-generator.gemspec @@ -19,8 +19,6 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency 'activesupport', '>= 2.2.0' - s.add_development_dependency 'yard' s.add_development_dependency 'bluecloth' s.add_development_dependency 'rspec' diff --git a/lib/keepass/random.rb b/lib/keepass/random.rb index 70c9c75..50fd479 100644 --- a/lib/keepass/random.rb +++ b/lib/keepass/random.rb @@ -1,4 +1,4 @@ -require 'active_support/secure_random' +require 'securerandom' module KeePass @@ -14,7 +14,7 @@ module KeePass # @return [Integer|Float] the random number # @see ActiveSupport::SecureRandom#random_number def self.random_number(n = 0) - ActiveSupport::SecureRandom.random_number(n) + SecureRandom.random_number(n) end # Returns a randomly sampled item from the array. @@ -36,3 +36,4 @@ module KeePass end end + diff --git a/spec/random_spec.rb b/spec/random_spec.rb index 362d693..68b8e18 100644 --- a/spec/random_spec.rb +++ b/spec/random_spec.rb @@ -5,12 +5,12 @@ describe KeePass::Random do describe "#random_number" 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) end 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 end