@@ -20,8 +20,11 @@ def test_metadata_formats_for_record
2020 end
2121
2222 def test_list_records
23- assert_nothing_raised { REXML ::Document . new ( @provider . list_records ) }
24- doc = REXML ::Document . new ( @provider . list_records )
23+ assert_nothing_raised do
24+ REXML ::Document . new ( @provider . list_records ( :metadata_prefix => 'oai_dc' ) )
25+ end
26+ doc = REXML ::Document . new ( @provider . list_records (
27+ :metadata_prefix => 'oai_dc' ) )
2528 assert_equal 100 , doc . elements [ 'OAI-PMH/ListRecords' ] . to_a . size
2629 end
2730
@@ -33,16 +36,21 @@ def test_list_identifiers
3336
3437 def test_get_record
3538 record_id = DCField . find ( :first ) . id
36- assert_nothing_raised { REXML ::Document . new ( @provider . get_record ( :identifier => "oai:test/#{ record_id } " ) ) }
37- doc = REXML ::Document . new ( @provider . get_record ( :identifier => "#{ record_id } " ) )
39+ assert_nothing_raised do
40+ REXML ::Document . new ( @provider . get_record (
41+ :identifier => "oai:test/#{ record_id } " , :metadata_prefix => 'oai_dc' ) )
42+ end
43+ doc = REXML ::Document . new ( @provider . get_record (
44+ :identifier => "#{ record_id } " , :metadata_prefix => 'oai_dc' ) )
3845 assert_equal "oai:test/#{ record_id } " , doc . elements [ 'OAI-PMH/GetRecord/record/header/identifier' ] . text
3946 end
4047
4148 def test_deleted
4249 record = DCField . find ( :first )
4350 record . deleted = true ;
4451 record . save
45- doc = REXML ::Document . new ( @provider . get_record ( :identifier => "oai:test/#{ record . id } " ) )
52+ doc = REXML ::Document . new ( @provider . get_record (
53+ :identifier => "oai:test/#{ record . id } " , :metadata_prefix => 'oai_dc' ) )
4654 assert_equal "oai:test/#{ record . id } " , doc . elements [ 'OAI-PMH/GetRecord/record/header/identifier' ] . text
4755 assert_equal 'deleted' , doc . elements [ 'OAI-PMH/GetRecord/record/header' ] . attributes [ "status" ]
4856 end
@@ -57,14 +65,16 @@ def test_from
5765 from_param = Time . parse ( "January 1 2006" )
5866
5967 doc = REXML ::Document . new (
60- @provider . list_records ( :from => from_param )
61- )
68+ @provider . list_records (
69+ :metadata_prefix => 'oai_dc' , :from => from_param )
70+ )
6271 assert_equal DCField . find ( :all , :conditions => [ "updated_at >= ?" , from_param ] ) . size ,
6372 doc . elements [ 'OAI-PMH/ListRecords' ] . size
6473
6574 doc = REXML ::Document . new (
66- @provider . list_records ( :from => Time . parse ( "May 30 2005" ) )
67- )
75+ @provider . list_records (
76+ :metadata_prefix => 'oai_dc' , :from => Time . parse ( "May 30 2005" ) )
77+ )
6878 assert_equal 20 , doc . elements [ 'OAI-PMH/ListRecords' ] . to_a . size
6979 end
7080
@@ -74,8 +84,9 @@ def test_until
7484 "id < #{ first_id + 10 } " )
7585
7686 doc = REXML ::Document . new (
77- @provider . list_records ( :until => Time . parse ( "June 1 2005" ) )
78- )
87+ @provider . list_records (
88+ :metadata_prefix => 'oai_dc' , :until => Time . parse ( "June 1 2005" ) )
89+ )
7990 assert_equal 10 , doc . elements [ 'OAI-PMH/ListRecords' ] . to_a . size
8091 end
8192
@@ -88,7 +99,9 @@ def test_from_and_until
8899 "id < #{ first_id + 10 } " )
89100
90101 doc = REXML ::Document . new (
91- @provider . list_records ( :from => Time . parse ( "June 3 2005" ) ,
102+ @provider . list_records (
103+ :metadata_prefix => 'oai_dc' ,
104+ :from => Time . parse ( "June 3 2005" ) ,
92105 :until => Time . parse ( "June 16 2005" ) )
93106 )
94107 assert_equal 40 , doc . elements [ 'OAI-PMH/ListRecords' ] . to_a . size
@@ -101,12 +114,12 @@ def test_handles_empty_collections
101114 test_identify
102115 test_metadata_formats
103116 # ListIdentifiers and ListRecords should return "noRecordsMatch" error code
104- assert_raises ( OAI ::NoMatchException ) {
117+ assert_raises ( OAI ::NoMatchException ) do
105118 REXML ::Document . new ( @provider . list_identifiers )
106- }
107- assert_raises ( OAI ::NoMatchException ) {
108- REXML ::Document . new ( @provider . list_records )
109- }
119+ end
120+ assert_raises ( OAI ::NoMatchException ) do
121+ REXML ::Document . new ( @provider . list_records ( :metadata_prefix => 'oai_dc' ) )
122+ end
110123 end
111124
112125 def setup
0 commit comments