Sha256: 86ab093d3ccd4cc871bd1f2c9c7ec8fb89afe240905e0cc077a1bc24a31cc29d

Contents?: true

Size: 883 Bytes

Versions: 7

Compression:

Stored size: 883 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

if RUBY_VERSION < '1.9'
  puts "Skipping EventMachine test"
else

require 'thrift_client/event_machine'

class EventmachineTest < Test::Unit::TestCase
  
  def test_twitter
    @twitter = Cassandra.new('Twitter', "127.0.0.1:9160", :retries => 2, :exception_classes => [], :transport => Thrift::EventMachineTransport, :transport_wrapper => nil)
    @twitter.clear_keyspace!
  end

  private
  
  def em_test(name)
    EM.run do
      Fiber.new do
        begin
          send("raw_#{name}".to_sym)
        ensure
          EM.stop
        end
      end.resume
    end
  end
  
  def self.wrap_tests
    self.public_instance_methods.select { |m| m =~ /^test_/ }.each do |meth|
      alias_method :"raw_#{meth}", meth
      define_method(meth) do
        em_test(meth)
      end
    end
  end
  
  wrap_tests
  
end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
cassilds-0.9.2 test/eventmachine_test.rb
cassilds-0.9.1 test/eventmachine_test.rb
cassandra-0.9.1 test/eventmachine_test.rb
cassandra-0.9.0 test/eventmachine_test.rb
jamesgolick-cassandra-0.8.2 test/eventmachine_test.rb
cassandra-0.8.2 test/eventmachine_test.rb
cassandra-0.8.1 test/eventmachine_test.rb