rspec-solr 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  class RSpecSolr
2
- VERSION = "1.0.1"
2
+ VERSION = '2.0.0'
3
3
  end
@@ -1,5 +1,5 @@
1
- desc "run continuous integration suite (tests, coverage, docs)"
2
- task :ci do
3
- Rake::Task["rspec"].invoke
4
- Rake::Task["doc"].invoke
1
+ desc 'run continuous integration suite (tests, coverage, docs)'
2
+ task :ci do
3
+ Rake::Task['rspec'].invoke
4
+ Rake::Task['doc'].invoke
5
5
  end
@@ -3,19 +3,19 @@ require 'yard/rake/yardoc_task'
3
3
 
4
4
  # Use yard to build docs
5
5
  begin
6
- project_root = File.expand_path(File.dirname(__FILE__) + "/../..")
6
+ project_root = File.expand_path(File.dirname(__FILE__) + '/../..')
7
7
  doc_dest_dir = File.join(project_root, 'doc')
8
8
 
9
9
  YARD::Rake::YardocTask.new(:doc) do |yt|
10
10
  yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb'))
11
- yt.options = ['--output-dir', doc_dest_dir,
12
- '--readme', 'README.rdoc',
13
- '--title', 'RSpec-Solr Documentation',
14
- '--files', 'MATCHERS.rdoc']
11
+ yt.options = ['--output-dir', doc_dest_dir,
12
+ '--readme', 'README.md',
13
+ '--title', 'RSpec-Solr Documentation',
14
+ '--files', 'MATCHERS.md']
15
15
  end
16
16
  rescue LoadError
17
- desc "Generate YARD Documentation"
17
+ desc 'Generate YARD Documentation'
18
18
  task :doc do
19
- abort "Please install the YARD gem to generate rdoc."
19
+ abort 'Please install the YARD gem to generate rdoc.'
20
20
  end
21
- end
21
+ end
@@ -1,5 +1,5 @@
1
1
  require 'rspec/core/rake_task'
2
2
 
3
3
  RSpec::Core::RakeTask.new(:rspec) do |spec|
4
- spec.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
4
+ spec.rspec_opts = ['-c', '-f progress', '-r ./spec/spec_helper.rb']
5
5
  end
@@ -3,33 +3,33 @@
3
3
  require File.expand_path('../lib/rspec-solr/version', __FILE__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
- gem.name = "rspec-solr"
6
+ gem.name = 'rspec-solr'
7
7
  gem.version = RSpecSolr::VERSION
8
- gem.authors = ["Naomi Dushay", "Chris Beer"]
9
- gem.email = ["ndushay@stanford.edu", "cabeer@stanford.edu"]
10
- gem.description = "Provides RSpec custom matchers to be used with Solr response objects."
11
- gem.summary = "RSpec custom matchers for Solr response objects"
12
- gem.homepage = "http://github.com/sul-dlss/rspec-solr"
8
+ gem.authors = ['Naomi Dushay', 'Chris Beer']
9
+ gem.email = ['ndushay@stanford.edu', 'cabeer@stanford.edu']
10
+ gem.description = 'Provides RSpec custom matchers to be used with Solr response objects.'
11
+ gem.summary = 'RSpec custom matchers for Solr response objects'
12
+ gem.homepage = 'http://github.com/sul-dlss/rspec-solr'
13
13
 
14
- gem.extra_rdoc_files = ["LICENSE.txt", "README.rdoc", "MATCHERS.rdoc"]
15
- gem.files = `git ls-files`.split($\)
14
+ gem.extra_rdoc_files = ['LICENSE.txt', 'README.md', 'MATCHERS.md']
15
+ gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
16
16
  gem.test_files = gem.files.grep(%r{^spec/})
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- gem.require_path = ["lib"]
19
-
20
- gem.add_runtime_dependency "rspec"
17
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
18
+ gem.require_path = ['lib']
19
+
20
+ gem.add_runtime_dependency 'rspec', '~> 3.0'
21
+ gem.add_runtime_dependency 'rspec-collection_matchers'
21
22
 
22
23
  # Development dependencies
23
24
  # Bundler will install these gems too if you've checked out rspec-solr source from git and run 'bundle install'
24
25
  # It will not add these as dependencies if you require rspec-solr for other projects
25
- gem.add_development_dependency "rake"
26
+ gem.add_development_dependency 'rake'
26
27
  # docs
27
- gem.add_development_dependency "rdoc"
28
- gem.add_development_dependency "yard"
28
+ gem.add_development_dependency 'rdoc'
29
+ gem.add_development_dependency 'yard'
29
30
  # test coverage for this gem
30
- gem.add_development_dependency 'simplecov'
31
- gem.add_development_dependency 'simplecov-rcov'
32
- # continuous integration
33
- gem.add_development_dependency 'travis-lint'
34
-
31
+ gem.add_development_dependency 'simplecov'
32
+ # continuous integration
33
+ gem.add_development_dependency 'travis-lint'
34
+ gem.add_development_dependency 'rubocop'
35
35
  end
@@ -2,276 +2,264 @@ require 'spec_helper'
2
2
  require 'rspec-solr'
3
3
 
4
4
  describe RSpecSolr do
5
-
6
5
  # fixtures below
7
6
 
8
- context "should have_the_same_number_of_results_as()" do
9
- it "passes if both results have same total number of documents" do
10
- @solr_resp_1_doc.should have_the_same_number_of_results_as(@solr_resp_1_doc)
11
- @solr_resp_3_docs.should have_the_same_number_of_results_as(@solr_resp_3_docs)
12
- @solr_resp_many_docs.should have_the_same_number_of_results_as(@solr_resp_many_docs2)
7
+ context 'should have_the_same_number_of_results_as()' do
8
+ it 'passes if both results have same total number of documents' do
9
+ expect(@solr_resp_1_doc).to have_the_same_number_of_results_as(@solr_resp_1_doc)
10
+ expect(@solr_resp_3_docs).to have_the_same_number_of_results_as(@solr_resp_3_docs)
11
+ expect(@solr_resp_many_docs).to have_the_same_number_of_results_as(@solr_resp_many_docs2)
13
12
  end
14
- it "passes if neither search matches any documents" do
15
- @solr_resp_no_docs.should have_the_same_number_of_results_as(@solr_resp_no_docs)
13
+ it 'passes if neither search matches any documents' do
14
+ expect(@solr_resp_no_docs).to have_the_same_number_of_results_as(@solr_resp_no_docs)
16
15
  end
17
- it "fails if the first response has more total results" do
18
- lambda {
19
- @solr_resp_not3_docs.should have_the_same_number_of_results_as(@solr_resp_3_docs)
20
- }.should fail_matching('expected 8 documents in Solr response {')
16
+ it 'fails if the first response has more total results' do
17
+ expect do
18
+ expect(@solr_resp_not3_docs).to have_the_same_number_of_results_as(@solr_resp_3_docs)
19
+ end.to raise_error.with_message a_string_including 'expected 8 documents in Solr response {'
21
20
  end
22
- it "fails if the first response has fewer total results" do
23
- lambda {
24
- @solr_resp_3_docs.should have_the_same_number_of_results_as(@solr_resp_not3_docs)
25
- }.should fail_matching('expected 3 documents in Solr response {')
21
+ it 'fails if the first response has fewer total results' do
22
+ expect do
23
+ expect(@solr_resp_3_docs).to have_the_same_number_of_results_as(@solr_resp_not3_docs)
24
+ end.to raise_error.with_message a_string_including 'expected 3 documents in Solr response {'
26
25
  end
27
- it "fails if only one response has results" do
28
- lambda {
29
- @solr_resp_no_docs.should have_the_same_number_of_results_as(@solr_resp_not3_docs)
30
- }.should fail_matching('expected 0 documents in Solr response {')
31
- lambda {
32
- @solr_resp_3_docs.should have_the_same_number_of_results_as(@solr_resp_no_docs)
33
- }.should fail_matching('expected 3 documents in Solr response {')
26
+ it 'fails if only one response has results' do
27
+ expect do
28
+ expect(@solr_resp_no_docs).to have_the_same_number_of_results_as(@solr_resp_not3_docs)
29
+ end.to raise_error.with_message a_string_including 'expected 0 documents in Solr response {'
30
+ expect do
31
+ expect(@solr_resp_3_docs).to have_the_same_number_of_results_as(@solr_resp_no_docs)
32
+ end.to raise_error.with_message a_string_including 'expected 3 documents in Solr response {'
34
33
  end
35
34
  end # should have_the_same_number_of_results_as()
36
35
 
37
- context "should_NOT have_the_same_number_of_results_as()" do
38
- it "fails if both results have same total number of documents" do
39
- lambda {
40
- @solr_resp_1_doc.should_not have_the_same_number_of_results_as(@solr_resp_1_doc)
41
- }.should fail_matching('expected (not 1) documents in Solr response {')
42
- lambda {
43
- @solr_resp_3_docs.should_not have_the_same_number_of_results_as(@solr_resp_3_docs)
44
- }.should fail_matching('expected (not 3) documents in Solr response {')
45
- lambda {
46
- @solr_resp_many_docs.should_not have_the_same_number_of_results_as(@solr_resp_many_docs2)
47
- }.should fail_matching('expected (not 1019) documents in Solr response {')
36
+ context 'should_NOT have_the_same_number_of_results_as()' do
37
+ it 'fails if both results have same total number of documents' do
38
+ expect do
39
+ expect(@solr_resp_1_doc).not_to have_the_same_number_of_results_as(@solr_resp_1_doc)
40
+ end.to raise_error.with_message a_string_including 'expected (not 1) documents in Solr response {'
41
+ expect do
42
+ expect(@solr_resp_3_docs).not_to have_the_same_number_of_results_as(@solr_resp_3_docs)
43
+ end.to raise_error.with_message a_string_including 'expected (not 3) documents in Solr response {'
44
+ expect do
45
+ expect(@solr_resp_many_docs).not_to have_the_same_number_of_results_as(@solr_resp_many_docs2)
46
+ end.to raise_error.with_message a_string_including 'expected (not 1019) documents in Solr response {'
48
47
  end
49
- it "fails if neither search matches any documents" do
50
- lambda {
51
- @solr_resp_no_docs.should_not have_the_same_number_of_results_as(@solr_resp_no_docs)
52
- }.should fail_matching('expected (not 0) documents in Solr response {')
48
+ it 'fails if neither search matches any documents' do
49
+ expect do
50
+ expect(@solr_resp_no_docs).not_to have_the_same_number_of_results_as(@solr_resp_no_docs)
51
+ end.to raise_error.with_message a_string_including 'expected (not 0) documents in Solr response {'
53
52
  end
54
- it "passes if the first response has more total results" do
55
- @solr_resp_not3_docs.should_not have_the_same_number_of_results_as(@solr_resp_3_docs)
53
+ it 'passes if the first response has more total results' do
54
+ expect(@solr_resp_not3_docs).not_to have_the_same_number_of_results_as(@solr_resp_3_docs)
56
55
  end
57
- it "passes if the first response has fewer total results" do
58
- @solr_resp_3_docs.should_not have_the_same_number_of_results_as(@solr_resp_not3_docs)
56
+ it 'passes if the first response has fewer total results' do
57
+ expect(@solr_resp_3_docs).not_to have_the_same_number_of_results_as(@solr_resp_not3_docs)
59
58
  end
60
- it "passes if only one response has results" do
61
- @solr_resp_no_docs.should_not have_the_same_number_of_results_as(@solr_resp_not3_docs)
62
- @solr_resp_3_docs.should_not have_the_same_number_of_results_as(@solr_resp_no_docs)
59
+ it 'passes if only one response has results' do
60
+ expect(@solr_resp_no_docs).not_to have_the_same_number_of_results_as(@solr_resp_not3_docs)
61
+ expect(@solr_resp_3_docs).not_to have_the_same_number_of_results_as(@solr_resp_no_docs)
63
62
  end
64
63
  end # should_NOT have_the_same_number_of_results_as()
65
64
 
66
-
67
- context "should have_fewer_results_than()" do
68
- it "passes if first response has no results and second doc has results" do
69
- @solr_resp_no_docs.should have_fewer_results_than(@solr_resp_1_doc)
70
- @solr_resp_no_docs.should have_fewer_results_than(@solr_resp_many_docs)
65
+ context 'should have_fewer_results_than()' do
66
+ it 'passes if first response has no results and second doc has results' do
67
+ expect(@solr_resp_no_docs).to have_fewer_results_than(@solr_resp_1_doc)
68
+ expect(@solr_resp_no_docs).to have_fewer_results_than(@solr_resp_many_docs)
71
69
  end
72
- it "passes if first response has a smaller number of total results" do
73
- @solr_resp_1_doc.should have_fewer_results_than(@solr_resp_3_docs)
74
- @solr_resp_3_docs.should have_fewer_results_than(@solr_resp_not3_docs)
75
- @solr_resp_3_docs.should have_fewer_results_than(@solr_resp_many_docs)
70
+ it 'passes if first response has a smaller number of total results' do
71
+ expect(@solr_resp_1_doc).to have_fewer_results_than(@solr_resp_3_docs)
72
+ expect(@solr_resp_3_docs).to have_fewer_results_than(@solr_resp_not3_docs)
73
+ expect(@solr_resp_3_docs).to have_fewer_results_than(@solr_resp_many_docs)
76
74
  end
77
- it "fails if responses have same number of total results" do
78
- lambda {
79
- @solr_resp_3_docs.should have_fewer_results_than(@solr_resp_3_docs)
80
- }.should fail_matching('expected more than 3 documents in Solr response {')
81
- lambda {
82
- @solr_resp_many_docs.should have_fewer_results_than(@solr_resp_many_docs2)
83
- }.should fail_matching('expected more than 1019 documents in Solr response {')
84
- lambda {
85
- @solr_resp_no_docs.should have_fewer_results_than(@solr_resp_no_docs)
86
- }.should fail_matching('expected more than 0 documents in Solr response {')
75
+ it 'fails if responses have same number of total results' do
76
+ expect do
77
+ expect(@solr_resp_3_docs).to have_fewer_results_than(@solr_resp_3_docs)
78
+ end.to raise_error.with_message a_string_including 'expected more than 3 documents in Solr response {'
79
+ expect do
80
+ expect(@solr_resp_many_docs).to have_fewer_results_than(@solr_resp_many_docs2)
81
+ end.to raise_error.with_message a_string_including 'expected more than 1019 documents in Solr response {'
82
+ expect do
83
+ expect(@solr_resp_no_docs).to have_fewer_results_than(@solr_resp_no_docs)
84
+ end.to raise_error.with_message a_string_including 'expected more than 0 documents in Solr response {'
87
85
  end
88
- it "fails if first response has more total results" do
89
- lambda {
90
- @solr_resp_3_docs.should have_fewer_results_than(@solr_resp_1_doc)
91
- }.should fail_matching('expected more than 3 documents in Solr response {')
92
- lambda {
93
- @solr_resp_not3_docs.should have_fewer_results_than(@solr_resp_3_docs)
94
- }.should fail_matching('expected more than 8 documents in Solr response {')
95
- lambda {
96
- @solr_resp_not3_docs.should have_fewer_results_than(@solr_resp_no_docs)
97
- }.should fail_matching('expected more than 8 documents in Solr response {')
86
+ it 'fails if first response has more total results' do
87
+ expect do
88
+ expect(@solr_resp_3_docs).to have_fewer_results_than(@solr_resp_1_doc)
89
+ end.to raise_error.with_message a_string_including 'expected more than 3 documents in Solr response {'
90
+ expect do
91
+ expect(@solr_resp_not3_docs).to have_fewer_results_than(@solr_resp_3_docs)
92
+ end.to raise_error.with_message a_string_including 'expected more than 8 documents in Solr response {'
93
+ expect do
94
+ expect(@solr_resp_not3_docs).to have_fewer_results_than(@solr_resp_no_docs)
95
+ end.to raise_error.with_message a_string_including 'expected more than 8 documents in Solr response {'
98
96
  end
99
97
  end # should have_fewer_results_than()
100
98
 
101
- context "should_NOT have_fewer_results_than()" do
102
- it "fails if first response has no results and second doc has results" do
103
- lambda {
104
- @solr_resp_no_docs.should_not have_fewer_results_than(@solr_resp_1_doc)
105
- }.should fail_matching('expected 0 or fewer documents in Solr response {')
106
- lambda {
107
- @solr_resp_no_docs.should_not have_fewer_results_than(@solr_resp_many_docs)
108
- }.should fail_matching('expected 0 or fewer documents in Solr response {')
99
+ context 'should_NOT have_fewer_results_than()' do
100
+ it 'fails if first response has no results and second doc has results' do
101
+ expect do
102
+ expect(@solr_resp_no_docs).not_to have_fewer_results_than(@solr_resp_1_doc)
103
+ end.to raise_error.with_message a_string_including 'expected 0 or fewer documents in Solr response {'
104
+ expect do
105
+ expect(@solr_resp_no_docs).not_to have_fewer_results_than(@solr_resp_many_docs)
106
+ end.to raise_error.with_message a_string_including 'expected 0 or fewer documents in Solr response {'
109
107
  end
110
- it "fails if first response has a smaller number of total results" do
111
- lambda {
112
- @solr_resp_1_doc.should_not have_fewer_results_than(@solr_resp_3_docs)
113
- }.should fail_matching('expected 1 or fewer documents in Solr response {')
114
- lambda {
115
- @solr_resp_3_docs.should_not have_fewer_results_than(@solr_resp_not3_docs)
116
- }.should fail_matching('expected 3 or fewer documents in Solr response {')
117
- lambda {
118
- @solr_resp_3_docs.should_not have_fewer_results_than(@solr_resp_many_docs)
119
- }.should fail_matching('expected 3 or fewer documents in Solr response {')
108
+ it 'fails if first response has a smaller number of total results' do
109
+ expect do
110
+ expect(@solr_resp_1_doc).not_to have_fewer_results_than(@solr_resp_3_docs)
111
+ end.to raise_error.with_message a_string_including 'expected 1 or fewer documents in Solr response {'
112
+ expect do
113
+ expect(@solr_resp_3_docs).not_to have_fewer_results_than(@solr_resp_not3_docs)
114
+ end.to raise_error.with_message a_string_including 'expected 3 or fewer documents in Solr response {'
115
+ expect do
116
+ expect(@solr_resp_3_docs).not_to have_fewer_results_than(@solr_resp_many_docs)
117
+ end.to raise_error.with_message a_string_including 'expected 3 or fewer documents in Solr response {'
120
118
  end
121
- it "passes if responses have same number of total results" do
122
- @solr_resp_3_docs.should_not have_fewer_results_than(@solr_resp_3_docs)
123
- @solr_resp_many_docs.should_not have_fewer_results_than(@solr_resp_many_docs2)
124
- @solr_resp_no_docs.should_not have_fewer_results_than(@solr_resp_no_docs)
119
+ it 'passes if responses have same number of total results' do
120
+ expect(@solr_resp_3_docs).not_to have_fewer_results_than(@solr_resp_3_docs)
121
+ expect(@solr_resp_many_docs).not_to have_fewer_results_than(@solr_resp_many_docs2)
122
+ expect(@solr_resp_no_docs).not_to have_fewer_results_than(@solr_resp_no_docs)
125
123
  end
126
- it "passes if first response has more total results" do
127
- @solr_resp_3_docs.should_not have_fewer_results_than(@solr_resp_1_doc)
128
- @solr_resp_not3_docs.should_not have_fewer_results_than(@solr_resp_3_docs)
129
- @solr_resp_not3_docs.should_not have_fewer_results_than(@solr_resp_no_docs)
124
+ it 'passes if first response has more total results' do
125
+ expect(@solr_resp_3_docs).not_to have_fewer_results_than(@solr_resp_1_doc)
126
+ expect(@solr_resp_not3_docs).not_to have_fewer_results_than(@solr_resp_3_docs)
127
+ expect(@solr_resp_not3_docs).not_to have_fewer_results_than(@solr_resp_no_docs)
130
128
  end
131
129
  end # should_NOT have_fewer_results_than()
132
130
 
133
-
134
- context "should have_more_results_than()" do
135
- it "passes if first response has results and second response does not" do
136
- @solr_resp_1_doc.should have_more_results_than(@solr_resp_no_docs)
137
- @solr_resp_many_docs.should have_more_results_than(@solr_resp_no_docs)
131
+ context 'should have_more_results_than()' do
132
+ it 'passes if first response has results and second response does not' do
133
+ expect(@solr_resp_1_doc).to have_more_results_than(@solr_resp_no_docs)
134
+ expect(@solr_resp_many_docs).to have_more_results_than(@solr_resp_no_docs)
138
135
  end
139
- it "passes if first response has a larger number of total results" do
140
- @solr_resp_3_docs.should have_more_results_than(@solr_resp_1_doc)
141
- @solr_resp_not3_docs.should have_more_results_than(@solr_resp_3_docs)
142
- @solr_resp_many_docs.should have_more_results_than(@solr_resp_not3_docs)
136
+ it 'passes if first response has a larger number of total results' do
137
+ expect(@solr_resp_3_docs).to have_more_results_than(@solr_resp_1_doc)
138
+ expect(@solr_resp_not3_docs).to have_more_results_than(@solr_resp_3_docs)
139
+ expect(@solr_resp_many_docs).to have_more_results_than(@solr_resp_not3_docs)
143
140
  end
144
- it "fails if responses have same number of total results" do
145
- lambda {
146
- @solr_resp_3_docs.should have_more_results_than(@solr_resp_3_docs)
147
- }.should fail_matching('expected fewer than 3 documents in Solr response {')
148
- lambda {
149
- @solr_resp_many_docs.should have_more_results_than(@solr_resp_many_docs2)
150
- }.should fail_matching('expected fewer than 1019 documents in Solr response {')
151
- lambda {
152
- @solr_resp_no_docs.should have_more_results_than(@solr_resp_no_docs)
153
- }.should fail_matching('expected fewer than 0 documents in Solr response {')
141
+ it 'fails if responses have same number of total results' do
142
+ expect do
143
+ expect(@solr_resp_3_docs).to have_more_results_than(@solr_resp_3_docs)
144
+ end.to raise_error.with_message a_string_including 'expected fewer than 3 documents in Solr response {'
145
+ expect do
146
+ expect(@solr_resp_many_docs).to have_more_results_than(@solr_resp_many_docs2)
147
+ end.to raise_error.with_message a_string_including 'expected fewer than 1019 documents in Solr response {'
148
+ expect do
149
+ expect(@solr_resp_no_docs).to have_more_results_than(@solr_resp_no_docs)
150
+ end.to raise_error.with_message a_string_including 'expected fewer than 0 documents in Solr response {'
154
151
  end
155
- it "fails if first response has fewer total results" do
156
- lambda {
157
- @solr_resp_1_doc.should have_more_results_than(@solr_resp_3_docs)
158
- }.should fail_matching('expected fewer than 1 documents in Solr response {')
159
- lambda {
160
- @solr_resp_3_docs.should have_more_results_than(@solr_resp_not3_docs)
161
- }.should fail_matching('expected fewer than 3 documents in Solr response {')
162
- lambda {
163
- @solr_resp_3_docs.should have_more_results_than(@solr_resp_many_docs)
164
- }.should fail_matching('expected fewer than 3 documents in Solr response {')
152
+ it 'fails if first response has fewer total results' do
153
+ expect do
154
+ expect(@solr_resp_1_doc).to have_more_results_than(@solr_resp_3_docs)
155
+ end.to raise_error.with_message a_string_including 'expected fewer than 1 documents in Solr response {'
156
+ expect do
157
+ expect(@solr_resp_3_docs).to have_more_results_than(@solr_resp_not3_docs)
158
+ end.to raise_error.with_message a_string_including 'expected fewer than 3 documents in Solr response {'
159
+ expect do
160
+ expect(@solr_resp_3_docs).to have_more_results_than(@solr_resp_many_docs)
161
+ end.to raise_error.with_message a_string_including 'expected fewer than 3 documents in Solr response {'
165
162
  end
166
163
  end # should have_more_results_than()
167
164
 
168
- context "should_NOT have_more_results_than()" do
169
- it "fails if first response has results and second response does not" do
170
- lambda {
171
- @solr_resp_1_doc.should_not have_more_results_than(@solr_resp_no_docs)
172
- }.should fail_matching('expected 1 or more documents in Solr response {')
173
- lambda {
174
- @solr_resp_many_docs.should_not have_more_results_than(@solr_resp_no_docs)
175
- }.should fail_matching('expected 1019 or more documents in Solr response {')
165
+ context 'should_NOT have_more_results_than()' do
166
+ it 'fails if first response has results and second response does not' do
167
+ expect do
168
+ expect(@solr_resp_1_doc).not_to have_more_results_than(@solr_resp_no_docs)
169
+ end.to raise_error.with_message a_string_including 'expected 1 or more documents in Solr response {'
170
+ expect do
171
+ expect(@solr_resp_many_docs).not_to have_more_results_than(@solr_resp_no_docs)
172
+ end.to raise_error.with_message a_string_including 'expected 1019 or more documents in Solr response {'
176
173
  end
177
- it "fails if first response has a larger number of total results" do
178
- lambda {
179
- @solr_resp_3_docs.should_not have_more_results_than(@solr_resp_1_doc)
180
- }.should fail_matching('expected 3 or more documents in Solr response {')
181
- lambda {
182
- @solr_resp_not3_docs.should_not have_more_results_than(@solr_resp_3_docs)
183
- }.should fail_matching('expected 8 or more documents in Solr response {')
184
- lambda {
185
- @solr_resp_many_docs.should_not have_more_results_than(@solr_resp_not3_docs)
186
- }.should fail_matching('expected 1019 or more documents in Solr response {')
174
+ it 'fails if first response has a larger number of total results' do
175
+ expect do
176
+ expect(@solr_resp_3_docs).not_to have_more_results_than(@solr_resp_1_doc)
177
+ end.to raise_error.with_message a_string_including 'expected 3 or more documents in Solr response {'
178
+ expect do
179
+ expect(@solr_resp_not3_docs).not_to have_more_results_than(@solr_resp_3_docs)
180
+ end.to raise_error.with_message a_string_including 'expected 8 or more documents in Solr response {'
181
+ expect do
182
+ expect(@solr_resp_many_docs).not_to have_more_results_than(@solr_resp_not3_docs)
183
+ end.to raise_error.with_message a_string_including 'expected 1019 or more documents in Solr response {'
187
184
  end
188
- it "passes if responses have same number of total results" do
189
- @solr_resp_3_docs.should_not have_more_results_than(@solr_resp_3_docs)
190
- @solr_resp_many_docs.should_not have_more_results_than(@solr_resp_many_docs2)
191
- @solr_resp_no_docs.should_not have_more_results_than(@solr_resp_no_docs)
185
+ it 'passes if responses have same number of total results' do
186
+ expect(@solr_resp_3_docs).not_to have_more_results_than(@solr_resp_3_docs)
187
+ expect(@solr_resp_many_docs).not_to have_more_results_than(@solr_resp_many_docs2)
188
+ expect(@solr_resp_no_docs).not_to have_more_results_than(@solr_resp_no_docs)
192
189
  end
193
- it "passes if first response has fewer total results" do
194
- @solr_resp_1_doc.should_not have_more_results_than(@solr_resp_3_docs)
195
- @solr_resp_3_docs.should_not have_more_results_than(@solr_resp_not3_docs)
196
- @solr_resp_3_docs.should_not have_more_results_than(@solr_resp_many_docs)
190
+ it 'passes if first response has fewer total results' do
191
+ expect(@solr_resp_1_doc).not_to have_more_results_than(@solr_resp_3_docs)
192
+ expect(@solr_resp_3_docs).not_to have_more_results_than(@solr_resp_not3_docs)
193
+ expect(@solr_resp_3_docs).not_to have_more_results_than(@solr_resp_many_docs)
197
194
  end
198
195
  end # should_NOT have_more_results_than()
199
196
 
200
-
201
- context "the word documents should be interchangeable with results" do
202
- it "have_the_same_number_of_documents_as" do
203
- @solr_resp_1_doc.should have_the_same_number_of_documents_as(@solr_resp_1_doc)
204
- @solr_resp_not3_docs.should_not have_the_same_number_of_documents_as(@solr_resp_3_docs)
197
+ context 'the word documents should be interchangeable with results' do
198
+ it 'have_the_same_number_of_documents_as' do
199
+ expect(@solr_resp_1_doc).to have_the_same_number_of_documents_as(@solr_resp_1_doc)
200
+ expect(@solr_resp_not3_docs).not_to have_the_same_number_of_documents_as(@solr_resp_3_docs)
205
201
  end
206
- it "have_fewer_results_than" do
207
- @solr_resp_3_docs.should have_fewer_results_than(@solr_resp_not3_docs)
208
- @solr_resp_many_docs.should_not have_fewer_results_than(@solr_resp_many_docs2)
202
+ it 'have_fewer_results_than' do
203
+ expect(@solr_resp_3_docs).to have_fewer_results_than(@solr_resp_not3_docs)
204
+ expect(@solr_resp_many_docs).not_to have_fewer_results_than(@solr_resp_many_docs2)
209
205
  end
210
- it "have_more_results_than" do
211
- @solr_resp_not3_docs.should have_more_results_than(@solr_resp_3_docs)
212
- @solr_resp_1_doc.should_not have_more_documents_than(@solr_resp_3_docs)
206
+ it 'have_more_results_than' do
207
+ expect(@solr_resp_not3_docs).to have_more_results_than(@solr_resp_3_docs)
208
+ expect(@solr_resp_1_doc).not_to have_more_documents_than(@solr_resp_3_docs)
213
209
  end
214
210
  end
215
211
 
216
-
217
212
  before(:all) do
218
- @solr_resp_1_doc = RSpecSolr::SolrResponseHash.new({ "response" =>
219
- { "numFound" => 1,
220
- "start" => 0,
221
- "docs" => [ {"id"=>"111"} ]
222
- }
223
- })
213
+ @solr_resp_1_doc = RSpecSolr::SolrResponseHash.new('response' =>
214
+ { 'numFound' => 1,
215
+ 'start' => 0,
216
+ 'docs' => [{ 'id' => '111' }]
217
+ })
224
218
 
225
- @solr_resp_3_docs = RSpecSolr::SolrResponseHash.new({ "response" =>
226
- { "numFound" => 3,
227
- "start" => 0,
228
- "docs" =>
229
- [ {"id"=>"111"},
230
- {"id"=>"222"},
231
- {"id"=>"333"},
219
+ @solr_resp_3_docs = RSpecSolr::SolrResponseHash.new('response' =>
220
+ { 'numFound' => 3,
221
+ 'start' => 0,
222
+ 'docs' =>
223
+ [{ 'id' => '111' },
224
+ { 'id' => '222' },
225
+ { 'id' => '333' }
232
226
  ]
233
- }
234
- })
227
+ })
235
228
 
236
- @solr_resp_not3_docs = RSpecSolr::SolrResponseHash.new({ "response" =>
237
- { "numFound" => 8,
238
- "start" => 0,
239
- "docs" =>
240
- [ {"id"=>"111"},
241
- {"id"=>"222"},
242
- {"id"=>"333"},
229
+ @solr_resp_not3_docs = RSpecSolr::SolrResponseHash.new('response' =>
230
+ { 'numFound' => 8,
231
+ 'start' => 0,
232
+ 'docs' =>
233
+ [{ 'id' => '111' },
234
+ { 'id' => '222' },
235
+ { 'id' => '333' }
243
236
  ]
244
- }
245
- })
237
+ })
246
238
 
247
- @solr_resp_many_docs = RSpecSolr::SolrResponseHash.new({ "response" =>
248
- { "numFound" => 1019,
249
- "start" => 0,
250
- "docs" =>
251
- [ {"id"=>"111"},
252
- {"id"=>"222"},
253
- {"id"=>"333"},
239
+ @solr_resp_many_docs = RSpecSolr::SolrResponseHash.new('response' =>
240
+ { 'numFound' => 1019,
241
+ 'start' => 0,
242
+ 'docs' =>
243
+ [{ 'id' => '111' },
244
+ { 'id' => '222' },
245
+ { 'id' => '333' }
254
246
  ]
255
- }
256
- })
247
+ })
257
248
 
258
- @solr_resp_many_docs2 = RSpecSolr::SolrResponseHash.new({ "response" =>
259
- { "numFound" => 1019,
260
- "start" => 10,
261
- "docs" =>
262
- [ {"id"=>"777"},
263
- {"id"=>"888"},
264
- {"id"=>"999"},
249
+ @solr_resp_many_docs2 = RSpecSolr::SolrResponseHash.new('response' =>
250
+ { 'numFound' => 1019,
251
+ 'start' => 10,
252
+ 'docs' =>
253
+ [{ 'id' => '777' },
254
+ { 'id' => '888' },
255
+ { 'id' => '999' }
265
256
  ]
266
- }
267
- })
257
+ })
268
258
 
269
- @solr_resp_no_docs = RSpecSolr::SolrResponseHash.new({ "response" =>
270
- { "numFound" => 0,
271
- "start" => 0,
272
- "docs" => []
273
- }
274
- })
259
+ @solr_resp_no_docs = RSpecSolr::SolrResponseHash.new('response' =>
260
+ { 'numFound' => 0,
261
+ 'start' => 0,
262
+ 'docs' => []
263
+ })
275
264
  end
276
-
277
- end
265
+ end