Skip to content

Commit 1ba66eb

Browse files
committed
Get all tests running in ONE Rake::TestTask.new
With them as separate sub-tasks, you get test results reported once for each sub-task, too easy to miss failures or not understand what's going on. One step to a more modern test setup.
1 parent cdca408 commit 1ba66eb

26 files changed

+60
-49
lines changed

Rakefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ require 'yard'
1414

1515
task :default => ["test", "yard"]
1616

17-
task :test => ["test:client", "test:provider", "test:activerecord_provider"]
17+
Rake::TestTask.new('test') do |t|
18+
t.description = "Run all Test::Unit tests"
1819

20+
t.libs << ['lib', 'test/client', 'test/provider', 'test/activerecord_provider']
21+
22+
t.pattern = 'test/{client,provider,activerecord_provider}/tc_*.rb'
23+
#t.verbose = true
24+
t.warning = false
25+
end
26+
27+
28+
# To run just subsets of tests
1929
namespace :test do
2030
Rake::TestTask.new('client') do |t|
2131
t.libs << ['lib', 'test/client']
@@ -31,8 +41,9 @@ namespace :test do
3141
t.warning = false
3242
end
3343

34-
desc "Active Record base Provider Tests"
3544
Rake::TestTask.new('activerecord_provider') do |t|
45+
t.description = "Active Record base Provider Tests"
46+
3647
t.libs << ['lib', 'test/activerecord_provider']
3748
t.pattern = 'test/activerecord_provider/tc_*.rb'
3849
#t.verbose = true

test/activerecord_provider/tc_ar_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test_helper'
1+
require 'test_helper_ar_provider'
22

33
class ActiveRecordProviderTest < TransactionalTestCase
44

test/activerecord_provider/tc_ar_sets_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test_helper'
1+
require 'test_helper_ar_provider'
22

33
class ActiveRecordSetProviderTest < TransactionalTestCase
44

test/activerecord_provider/tc_caching_paging_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test_helper'
1+
require 'test_helper_ar_provider'
22

33
class CachingPagingProviderTest < TransactionalTestCase
44
include REXML

test/activerecord_provider/tc_simple_paging_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test_helper'
1+
require 'test_helper_ar_provider'
22

33
class SimpleResumptionProviderTest < TransactionalTestCase
44
include REXML

test/client/helpers/provider.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
require 'webrick'
22
require File.dirname(__FILE__) + '/../../provider/models'
33

4-
class ComplexProvider < OAI::Provider::Base
5-
repository_name 'Complex Provider'
6-
repository_url 'http://localhost'
7-
record_prefix 'oai:test'
8-
source_model ComplexModel.new(100)
9-
end
104

115
class ProviderServer
6+
class ComplexClientProvider < OAI::Provider::Base
7+
repository_name 'Complex Provider'
8+
repository_url 'http://localhost'
9+
record_prefix 'oai:test'
10+
source_model ComplexModel.new(100)
11+
end
1212

1313
attr_reader :consumed, :server
1414

1515
def initialize(port, mount_point)
1616
@consumed = []
17-
@provider = ComplexProvider.new
17+
@provider = ComplexClientProvider.new
1818
@server = WEBrick::HTTPServer.new(
1919
:BindAddress => '127.0.0.1',
2020
:Logger => WEBrick::Log.new('/dev/null'),
@@ -62,4 +62,4 @@ def server_proc
6262
end
6363
end
6464

65-
end
65+
end

test/client/tc_exception.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test_helper'
1+
require 'test_helper_client'
22

33
class ExceptionTest < Test::Unit::TestCase
44

@@ -9,7 +9,7 @@ def test_not_found
99

1010
def test_xml_error
1111
client = OAI::Client.new 'http://www.yahoo.com'
12-
begin
12+
begin
1313
client.identify
1414
rescue OAI::Exception => e
1515
assert_match /response not well formed XML/, e.to_s, 'xml error'
@@ -23,7 +23,7 @@ def test_oai_error
2323
end
2424
end
2525

26-
# must pass in options as a hash
26+
# must pass in options as a hash
2727
def test_parameter_error
2828
client = OAI::Client.new 'http://localhost:3333/oai'
2929
assert_raises(OAI::ArgumentException) {client.get_record('foo')}
@@ -32,5 +32,5 @@ def test_parameter_error
3232
assert_raises(OAI::ArgumentException) {client.list_metadata_formats('foo')}
3333
assert_raises(OAI::ArgumentException) {client.list_sets('foo')}
3434
end
35-
35+
3636
end

test/client/tc_get_record.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
require 'test_helper'
1+
require 'test_helper_client'
22

33
class GetRecordTest < Test::Unit::TestCase
4-
4+
55
def test_get_one
66
client = OAI::Client.new 'http://localhost:3333/oai'
77
response = client.get_record :identifier => 'oai:test/3'
@@ -13,7 +13,7 @@ def test_get_one
1313
assert_kind_of REXML::Element, response.record.about
1414

1515
# minimal check that the header is working
16-
assert_equal 'oai:test/3',
16+
assert_equal 'oai:test/3',
1717
response.record.header.identifier
1818

1919
# minimal check that the metadata is working
@@ -33,7 +33,7 @@ def test_missing_identifier
3333

3434
def test_deleted_record
3535
client = OAI::Client.new 'http://localhost:3333/oai'
36-
record = client.get_record :identifier => 'oai:test/275'
36+
record = client.get_record :identifier => 'oai:test/275'
3737
assert record.deleted?
3838
end
3939

test/client/tc_http_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test_helper'
1+
require 'test_helper_client'
22
require 'webrick'
33

44
class HttpClientTest < Test::Unit::TestCase

0 commit comments

Comments
 (0)