diff --git a/.rspec b/.rspec index 675313d..416e68b 100644 --- a/.rspec +++ b/.rspec @@ -1,4 +1,5 @@ --color --format documentation --backtrace ---default_path spec +--tty +--require spec_helper diff --git a/.travis.yml b/.travis.yml index 337d72c..efdc129 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,24 @@ +language: ruby +bundler_args: --jobs=3 --retry=3 +cache: bundler +sudo: false + +services: + - redis-server + rvm: - - 1.9.3 - 2.0.0 + - 2.1.4 + - 2.2.2 - ruby-head - - jruby-19mode - - rbx-19mode - - jruby-head + - jruby + - rbx-2 matrix: allow_failures: - - rvm: 2.0.0 - rvm: ruby-head - - rvm: jruby-head - - rvm: rbx-19mode + - rvm: jruby + - rvm: rbx-2 notifications: irc: "irc.freenode.org#celluloid" diff --git a/Gemfile b/Gemfile index 4737819..0047527 100644 --- a/Gemfile +++ b/Gemfile @@ -2,5 +2,4 @@ source 'https://rubygems.org' gemspec gem 'coveralls', require: false -gem 'celluloid', github: 'celluloid/celluloid' -gem 'celluloid-io', github: 'celluloid/celluloid-io' +gem 'transpec', require: false diff --git a/celluloid-redis.gemspec b/celluloid-redis.gemspec index a086127..542b189 100644 --- a/celluloid-redis.gemspec +++ b/celluloid-redis.gemspec @@ -5,7 +5,7 @@ require 'celluloid/redis/version' Gem::Specification.new do |spec| spec.name = "celluloid-redis" - spec.version = Celluloid::Redis::VERSION + spec.version = CELLULOID_REDIS_VERSION spec.authors = ["Tony Arcieri"] spec.email = ["tony.arcieri@gmail.com"] spec.description = "Celluloid::IO support for the redis-rb library" @@ -18,11 +18,9 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "redis" - spec.add_runtime_dependency "celluloid-io", ">= 0.13.0.pre" + spec.add_runtime_dependency "redis", "~> 3.2" + spec.add_runtime_dependency "celluloid-io", "~> 0.16" - spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" - spec.add_development_dependency "guard-rspec" + spec.add_development_dependency "rake", "~> 10.4" + spec.add_development_dependency "rspec", "~> 3.0" end diff --git a/lib/celluloid/redis.rb b/lib/celluloid/redis.rb index e0ec131..4648b0e 100644 --- a/lib/celluloid/redis.rb +++ b/lib/celluloid/redis.rb @@ -1,4 +1,3 @@ require "redis" require "celluloid/redis/version" -require "celluloid/redis/redis_ext" \ No newline at end of file diff --git a/lib/celluloid/redis/redis_ext.rb b/lib/celluloid/redis/redis_ext.rb deleted file mode 100644 index 76a72f4..0000000 --- a/lib/celluloid/redis/redis_ext.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Redis - class Client - # Well this is really sad. redis-rb does not provide extensible driver - # support. Instead they couple everything together though this method. - # This leaves us no choice but to monkeypatch - def _parse_driver(driver) - driver = driver.to_s if driver.is_a?(Symbol) - - if driver.kind_of?(String) - case driver - when "ruby" - require "redis/connection/ruby" - driver = Connection::Ruby - when "celluloid" - require "redis/connection/celluloid" - driver = Connection::Celluloid - when "hiredis" - require "redis/connection/hiredis" - driver = Connection::Hiredis - else - raise "Unknown driver: #{driver}" - end - end - - driver - end - end -end \ No newline at end of file diff --git a/lib/celluloid/redis/version.rb b/lib/celluloid/redis/version.rb index 19d8a7a..e1f7e5e 100644 --- a/lib/celluloid/redis/version.rb +++ b/lib/celluloid/redis/version.rb @@ -1,5 +1 @@ -module Celluloid - module Redis - VERSION = "0.0.2" - end -end +CELLULOID_REDIS_VERSION = "0.0.2" diff --git a/spec/redis/connection/celluloid_spec.rb b/spec/redis/connection/celluloid_spec.rb index 7aa3ada..e4aec6a 100644 --- a/spec/redis/connection/celluloid_spec.rb +++ b/spec/redis/connection/celluloid_spec.rb @@ -1,6 +1,4 @@ -require "spec_helper" - -describe Redis::Connection::Celluloid do +RSpec.describe Redis::Connection::Celluloid do let(:example_key) { 'foobar' } let(:example_value) { 'baz' } @@ -9,10 +7,10 @@ # FIXME: perhaps some better tests are in order here? redis.set(example_key, '') - redis.get(example_key).should eq '' + expect(redis.get(example_key)).to eq('') redis.set(example_key, example_value) - redis.get(example_key).should eq example_value + expect(redis.get(example_key)).to eq(example_value) end it "cleanly shuts down an instance" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d01cb69..4ee7908 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,15 @@ require "celluloid/redis" -require "redis/connection/celluloid" + require "redis_instance" require "coveralls" Coveralls.wear! +RSpec.configure(&:disable_monkey_patching!) + +# Trick to test new redis-rb connection driver +# that must load redis/connection/celluloid +Redis.new(driver: :celluloid) + def with_new_instance(opts = {}) begin instance = RedisInstance.new(opts)