Sha256: e987c680406b17d6cc338dc717f6a2f99e86193b7b7cffd46972057da718d6ef

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

# -*- encoding : utf-8 -*-
require 'helper'
class VariableTypesTest < Test::Unit::TestCase
  context "Definition & Types of variables" do
    setup do
      RedisModelExtension::Database.redis.flushdb

      @test_model = TestRedisModel.new()
    end 
    
    should "be have accessible fields" do
      assert @test_model.respond_to?(:integer)
      assert @test_model.respond_to?(:string)
      assert @test_model.respond_to?(:boolean)
      assert @test_model.respond_to?(:array)
      assert @test_model.respond_to?(:hash)
      assert @test_model.respond_to?(:time)
      assert @test_model.respond_to?(:date)
      assert @test_model.respond_to?(:float)
    end

    should "be have setable fields" do
      assert @test_model.respond_to?(:"integer=")
      assert @test_model.respond_to?(:"string=")
      assert @test_model.respond_to?(:"boolean=")
      assert @test_model.respond_to?(:"array=")
      assert @test_model.respond_to?(:"hash=")
      assert @test_model.respond_to?(:"time=")
      assert @test_model.respond_to?(:"date=")
      assert @test_model.respond_to?(:"float=")
    end

    should "be have field exist?" do
      assert @test_model.respond_to?(:"integer?")
      assert @test_model.respond_to?(:"string?")
      assert @test_model.respond_to?(:"boolean?")
      assert @test_model.respond_to?(:"array?")
      assert @test_model.respond_to?(:"hash?")
      assert @test_model.respond_to?(:"time?")
      assert @test_model.respond_to?(:"date?")
      assert @test_model.respond_to?(:"float?")
    end    

    should "say if class has attribute method" do
      assert TestRedisModel.attribute_method?(:integer)
      refute TestRedisModel.attribute_method?(:nonexisting)
    end

  end
end
    

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-model-extension-0.4.2 test/redis_model_parts/test_initialize.rb