Sha256: 074f43c274a49ed1fb552f5ef60a053318b737c2305da5894c9784444c801d41

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

require 'test_helper'

class TasksTest < ActiveSupport::TestCase

  setup do
    load File.expand_path('../../lib/tasks/cachers.rake', __FILE__)
    Rake::Task.define_task :environment
  end

  test 'tasks' do
    users = %w(mike john).map do |name|
      User.create name: name
    end
    Rake::Task['cachers:cache'].invoke
    users.each do |user|
      assert_equal user.name, $redis.get("users/#{user.id}")
    end

    $redis.flushall
    Rake::Task['cachers:recache'].invoke
    users.each do |user|
      assert_equal user.name, $redis.get("users/#{user.id}")
    end

    Rake::Task['cachers:uncache'].invoke
    assert_equal 0, $redis.keys.size
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cachers-0.1.1 test/tasks_test.rb
cachers-0.0.1 test/tasks_test.rb