Sha256: f1c39412c8d6cf77bf8de724fae5bbfb877aab3625685aa7b68c971ab0edde66

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# -*- encoding : utf-8 -*-
require 'helper'
class DatabaseModuleTest < Test::Unit::TestCase
  context "DatabaseModule" do
    setup do
      #cleare previously assigned redis instance
      RedisModelExtension::Database.redis = nil
    end

    should "be initialized directly" do
      assert_nothing_raised do
        RedisModelExtension::Database.redis = Redis.new(host: "127.0.0.1", port: 6379, db: 0)
        RedisModelExtension::Database.redis.info
      end
      assert RedisModelExtension::Database.redis.is_a? Redis
    end

    should "be initialized by config arguments" do
      assert_nothing_raised do
        RedisModelExtension::Database.redis_config = {host: "127.0.0.1", port: 6379, db: 0}
        RedisModelExtension::Database.redis.info
      end
      assert RedisModelExtension::Database.redis.is_a? Redis
    end

    should "be initialized from config" do
      assert_nothing_raised do
        RedisModelExtension::Database.redis.info
      end
      assert RedisModelExtension::Database.redis.is_a? Redis
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
redis-model-extension-0.4.2 test/test_database_module.rb
redis-model-extension-0.4.1 test/test_database_module.rb
redis-model-extension-0.4.0 test/test_database_module.rb
redis-model-extension-0.3.8 test/test_database_module.rb
redis-model-extension-0.3.7 test/test_database_module.rb
redis-model-extension-0.3.6 test/test_database_module.rb