Sha256: e3dc8ce56c89d6a2df0e11778c42142ea46c8754830f8e01156418f42d8318db

Contents?: true

Size: 1.01 KB

Versions: 24

Compression:

Stored size: 1.01 KB

Contents

# The filename is so that this test gets loaded last, since it depends on all the other tests.
#  Suggestions of less janky ways to do this would be appreciated. -rk

require 'test_helper'

class MockTest < CassandraObjectTestCase
  context CassandraObject::Base do
    should "respond to use_mock!" do
      assert CassandraObject::Base.respond_to?(:use_mock!)
    end
    context "use_mock!" do
      should "set the connection_class" do
        CassandraObject::Base.use_mock!
        assert_equal Cassandra::Mock, CassandraObject::Base.connection_class
        CassandraObject::Base.use_mock!(false)
      end
    end
  end
end

module MockTestMixin
  def setup
    CassandraObject::Base.use_mock!
    super
  end

  def teardown
    CassandraObject::Base.use_mock!(false)
  end
end

%w[BasicScenarios Cursor Dirty Index Migration OneToManyAssociations Time Types Validation].each do |test|
  klass = Class.new(Kernel.const_get(test + 'Test'))
  klass.send(:include, MockTestMixin)
  Kernel.const_set(test + 'WithMockTest', klass)
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
gotime-cassandra_object-0.7.3 test/z_mock_test.rb
gotime-cassandra_object-0.7.2 test/z_mock_test.rb
gotime-cassandra_object-0.7.1 test/z_mock_test.rb
gotime-cassandra_object-0.6.1 test/z_mock_test.rb