Sha256: 0f7799eff18a39e723c727fd4d895704ba7b7d9dce43e090ed1843dc311c72d2

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require 'test_helper'

class TasksTest < ActiveSupport::TestCase

  setup do
    load File.expand_path('../../lib/tasks/views.rake', __FILE__)
    Rake::Task.define_task :environment
    FileUtils.rm_rf Rails.root.join('tmp/digests/db/views')
  end

  test 'sync' do
    Product.create(name: 'Les Paul', category: 'Guitar')
    Product.create(name: 'Laney', category: 'Amps')

    Rake::Task['db:views:sync'].invoke
    assert_equal 1, connection.execute('SELECT * FROM guitars').to_a.size

    connection.expects(:execute).never
    Rake::Task['db:views:sync'].invoke
  end

  private

  def connection
    ActiveRecord::Base.connection
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
views-0.0.1 test/tasks_test.rb