Skip to content

Commit

Permalink
Give up on testing with Rails 2.3 and 3.0. The session_store test
Browse files Browse the repository at this point in the history
requires the full stack and I can't find an acceptable solution that
works in Ruby 1.8 and 1.9.  Rails 3.0 is tested at the moment.

Also remove the digest_md5 code which was never tested or supported.
  • Loading branch information
mperham committed Sep 2, 2010
1 parent 561969a commit 2445f5c
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 256 deletions.
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ Rake::TestTask.new(:test) do |test|
test.pattern = 'test/**/test_*.rb'
end

Rake::TestTask.new(:bench) do |test|
test.libs << 'test'
test.pattern = 'test/benchmark_test.rb'
end

task :default => :test
2 changes: 1 addition & 1 deletion dalli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |s|
s.test_files = Dir.glob("test/**/*")
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<mocha>, [">= 0"])
s.add_development_dependency(%q<activesupport>, [">= 3.0.0"])
s.add_development_dependency(%q<rails>, [">= 3.0.0"])
s.add_development_dependency(%q<memcache-client>, [">= 1.8.5"])
end

14 changes: 0 additions & 14 deletions lib/dalli/sasl/base64.rb

This file was deleted.

175 changes: 0 additions & 175 deletions lib/dalli/sasl/digest_md5.rb

This file was deleted.

3 changes: 1 addition & 2 deletions test/abstract_unit.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

require 'rails'
# Used to test the full Rails stack.
# Stolen from the Rails 3.0 source.
# Needed for the session store tests.

require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/string/encoding'
if "ruby".encoding_aware?
Expand Down
File renamed without changes.
11 changes: 0 additions & 11 deletions test/ginger_scenarios.rb

This file was deleted.

65 changes: 18 additions & 47 deletions test/helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'rubygems'
require 'ginger'
# require 'simplecov-html'
# SimpleCov.start
require 'simplecov-html'
SimpleCov.start

require 'test/unit'
require 'shoulda'
Expand All @@ -18,54 +17,26 @@ def assert_error(error, regexp=nil, &block)
assert_match(regexp, ex.message, "#{ex.class.name}: #{ex.message}\n#{ex.backtrace.join("\n\t")}")
end

def with_activesupport(*versions)
versions.each do |version|
begin
pid = fork do
begin
trap("TERM") { exit }
gem 'activesupport', "~> #{version}"
case version
when '3.0.0'
require 'active_support/all'
when '2.3.0'
require 'active_support'
require 'active_support/cache/dalli_store23'
end
yield
rescue Gem::LoadError
puts "Skipping activesupport #{version} test: #{$!.message}"
end
end
ensure
Process.wait(pid)
end
def with_activesupport
case Rails.version
when '3.0.0'
require 'active_support/all'
# when '2.3.0'
# require 'active_support'
# require 'active_support/cache/dalli_store23'
end
yield
end

def with_actionpack(*versions)
versions.each do |version|
begin
pid = fork do
begin
trap("TERM") { exit }
gem 'actionpack', "~> #{version}"
case version
when '3.0.0'
require 'action_dispatch'
require 'action_controller'
when '2.3.0'
raise NotImplementedError
end
yield
rescue Gem::LoadError
puts "Skipping actionpack #{version} test: #{$!.message}"
end
end
ensure
Process.wait(pid)
end
def with_actionpack
case Rails.version
when '3.0.0'
require 'action_dispatch'
require 'action_controller'
# when '2.3.0'
# raise NotImplementedError
end
yield
end

end
11 changes: 6 additions & 5 deletions test/test_active_support.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require 'helper'
require 'rails'

class TestActiveSupport < Test::Unit::TestCase
context 'active_support caching' do

should 'support fetch' do
with_activesupport("2.3.0", "3.0.0") do
with_activesupport do
memcached do
connect
dvalue = @mc.fetch('somekeywithoutspaces', :expires_in => 1.second) { 123 }
Expand All @@ -27,7 +28,7 @@ class TestActiveSupport < Test::Unit::TestCase
end

should 'support keys with spaces' do
with_activesupport("3.0.0") do
with_activesupport do
memcached do
connect
dvalue = @mc.fetch('some key with spaces', :expires_in => 1.second) { 123 }
Expand All @@ -38,7 +39,7 @@ class TestActiveSupport < Test::Unit::TestCase
end

should 'support read_multi' do
with_activesupport("2.3.0", "3.0.0") do
with_activesupport do
memcached do
connect
x = rand_key
Expand All @@ -56,7 +57,7 @@ class TestActiveSupport < Test::Unit::TestCase
end

should 'support read, write and delete' do
with_activesupport("2.3.0", "3.0.0") do
with_activesupport do
memcached do
connect
x = rand_key
Expand All @@ -81,7 +82,7 @@ class TestActiveSupport < Test::Unit::TestCase
end

should 'support other esoteric commands' do
with_activesupport("2.3.0", "3.0.0") do
with_activesupport do
memcached do
connect
ms = @mc.stats
Expand Down
2 changes: 1 addition & 1 deletion test/test_dalli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class TestDalli < Test::Unit::TestCase
end

should "support multithreaded access" do
memcached(11211) do |cache|
memcached(19123) do |cache|
cache.flush
workers = []

Expand Down

0 comments on commit 2445f5c

Please sign in to comment.