Permalink
Browse files

Always install the snappy gem so that the compression tests can run

  • Loading branch information...
iconara committed Jan 1, 2014
1 parent 288373c commit 8630c87f4a4146fc0dc7c7d86e7ae510c57ac8c9
Showing with 18 additions and 25 deletions.
  1. +1 −1 Gemfile
  2. +16 −24 spec/integration/protocol_spec.rb
  3. +1 −0 spec/spec_helper.rb
View
@@ -3,12 +3,12 @@ source 'https://rubygems.org/'
gemspec
gem 'rake'
+gem 'snappy'
group :development do
gem 'pry'
gem 'viiite'
gem 'travis-lint'
- gem 'snappy'
platforms :mri do
gem 'yard'
gem 'redcarpet'
@@ -370,31 +370,23 @@ def in_keyspace_with_counters_table
end
context 'with compression' do
- begin
- require 'cql/compression/snappy_compressor'
-
- let :compressor do
- Cql::Compression::SnappyCompressor.new(0)
- end
+ let :compressor do
+ Cql::Compression::SnappyCompressor.new(0)
+ end
- it 'sends a compressed request and receives a compressed response' do
- compressor.stub(:compress).and_call_original
- compressor.stub(:decompress).and_call_original
- io_reactor = Cql::Io::IoReactor.new(lambda { |*args| Cql::Protocol::CqlProtocolHandler.new(*args, compressor) })
- io_reactor.start.value
- begin
- connection = io_reactor.connect(ENV['CASSANDRA_HOST'], 9042, 0.1).value
- connection.send_request(Cql::Protocol::StartupRequest.new(nil, 'snappy')).value
- connection.send_request(Cql::Protocol::PrepareRequest.new('SELECT * FROM system.peers')).value
- compressor.should have_received(:compress).at_least(1).times
- compressor.should have_received(:decompress).at_least(1).times
- ensure
- io_reactor.stop.value
- end
- end
- rescue LoadError
- it 'compresses requests and decompresses responses' do
- pending 'No compressor available for the current platform'
+ it 'sends a compressed request and receives a compressed response' do
+ compressor.stub(:compress).and_call_original
+ compressor.stub(:decompress).and_call_original
+ io_reactor = Cql::Io::IoReactor.new(lambda { |*args| Cql::Protocol::CqlProtocolHandler.new(*args, compressor) })
+ io_reactor.start.value
+ begin
+ connection = io_reactor.connect(ENV['CASSANDRA_HOST'], 9042, 0.1).value
+ connection.send_request(Cql::Protocol::StartupRequest.new(nil, 'snappy')).value
+ connection.send_request(Cql::Protocol::PrepareRequest.new('SELECT * FROM system.peers')).value
+ compressor.should have_received(:compress).at_least(1).times
+ compressor.should have_received(:decompress).at_least(1).times
+ ensure
+ io_reactor.stop.value
end
end
end
View
@@ -26,3 +26,4 @@
end
require 'cql'
+require 'cql/compression/snappy_compressor'

0 comments on commit 8630c87

Please sign in to comment.