<commit_before>require 'spec_helper'

describe DataMapper::Adapters::RedisAdapter do
  before(:all) do
    @adapter = DataMapper.setup(:default, {
      :adapter  => "redis",
      :db => 15
    })
    @repository = DataMapper.repository(@adapter.name)
    @redis = Redis.new(:db => 15)
  end

  it_should_behave_like 'An Adapter'

  describe "adapter level tests" do
    before(:all) do
      class Hooloovoo
        include DataMapper::Resource

        property :id,      Serial
        property :shade,   String, :index => true
      end
    end

    it "should save the id of the resource in a set" do
      h = Hooloovoo.create
      @redis.smembers("hooloovoo:id:all").should == [h.id.to_s]
    end

    it "should save indexed fields in a set" do
      h = Hooloovoo.create(:shade => '000080')
      @redis.smembers("hooloovoo:shade:MDAwMDgw").should == [h.id.to_s]
    end
  end

  after(:all) do
    @redis.flushdb
  end
end<commit_msg>I beg your pardon, 336699 is the correct RGB representation of a Hooloovoo<commit_after>require 'spec_helper'

describe DataMapper::Adapters::RedisAdapter do
  before(:all) do
    @adapter = DataMapper.setup(:default, {
      :adapter  => "redis",
      :db => 15
    })
    @repository = DataMapper.repository(@adapter.name)
    @redis = Redis.new(:db => 15)
  end

  it_should_behave_like 'An Adapter'

  describe "adapter level tests" do
    before(:all) do
      class Hooloovoo
        include DataMapper::Resource

        property :id,      Serial
        property :shade,   String, :index => true
      end
    end

    it "should save the id of the resource in a set" do
      h = Hooloovoo.create
      @redis.smembers("hooloovoo:id:all").should == [h.id.to_s]
    end

    it "should save indexed fields in a set" do
      h = Hooloovoo.create(:shade => '336699')
      @redis.smembers("hooloovoo:shade:MzM2Njk5").should == [h.id.to_s]
    end
  end

  after(:all) do
    @redis.flushdb
  end
end
{'fraction_non_alphanumeric': 0.1152073732718894, 'fraction_numerical': 0.014336917562724014, 'mean_word_length': 2.7504798464491365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7620877', 'n_tokens_mistral': 717, 'n_tokens_neox': 677, 'n_words': 173}