sunspot_rails 2.2.7 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -2
  3. data/Appraisals +63 -0
  4. data/Gemfile +3 -0
  5. data/gemfiles/.gitkeep +0 -0
  6. data/lib/sunspot/rails.rb +2 -0
  7. data/lib/sunspot/rails/configuration.rb +4 -0
  8. data/lib/sunspot/rails/searchable.rb +9 -3
  9. data/lib/sunspot/rails/solr_logging.rb +3 -3
  10. data/lib/sunspot/rails/stub_session_proxy.rb +4 -0
  11. data/spec/configuration_spec.rb +77 -69
  12. data/spec/model_lifecycle_spec.rb +8 -8
  13. data/spec/model_spec.rb +72 -71
  14. data/spec/rails_app/app/controllers/application_controller.rb +4 -0
  15. data/spec/rails_app/app/controllers/posts_controller.rb +16 -0
  16. data/spec/{rails_template → rails_app}/app/models/author.rb +0 -2
  17. data/spec/{rails_template → rails_app}/app/models/blog.rb +0 -2
  18. data/spec/{rails_template → rails_app}/app/models/location.rb +0 -1
  19. data/spec/{rails_template → rails_app}/app/models/photo_post.rb +0 -0
  20. data/spec/{rails_template → rails_app}/app/models/post.rb +0 -2
  21. data/spec/{rails_template → rails_app}/app/models/post_with_auto.rb +0 -2
  22. data/spec/{rails_template → rails_app}/app/models/post_with_default_scope.rb +0 -2
  23. data/spec/{rails_template → rails_app}/app/models/post_with_only_some_attributes_triggering_reindex.rb +0 -2
  24. data/spec/{rails_template → rails_app}/app/models/rake_task_auto_load_test_model.rb +0 -0
  25. data/spec/rails_app/config.ru +4 -0
  26. data/spec/rails_app/config/application.rb +14 -0
  27. data/spec/rails_app/config/boot.rb +6 -0
  28. data/spec/rails_app/config/database.yml +5 -0
  29. data/spec/rails_app/config/environment.rb +5 -0
  30. data/spec/rails_app/config/environments/test.rb +41 -0
  31. data/spec/{rails_template → rails_app}/config/initializers/rails_5_override.rb +0 -0
  32. data/spec/rails_app/config/initializers/secret_token.rb +1 -0
  33. data/spec/rails_app/config/initializers/session_store.rb +3 -0
  34. data/spec/{rails_template → rails_app}/config/routes.rb +0 -0
  35. data/spec/{rails_template → rails_app}/config/sunspot.yml +2 -0
  36. data/spec/rails_app/db/schema.rb +26 -0
  37. data/spec/rake_task_spec.rb +8 -8
  38. data/spec/request_lifecycle_spec.rb +17 -21
  39. data/spec/schema.rb +8 -9
  40. data/spec/searchable_spec.rb +4 -4
  41. data/spec/server_spec.rb +7 -7
  42. data/spec/session_spec.rb +3 -3
  43. data/spec/shared_examples/indexed_after_save.rb +1 -1
  44. data/spec/shared_examples/not_indexed_after_save.rb +1 -1
  45. data/spec/spec_helper.rb +18 -51
  46. data/spec/stub_session_proxy_spec.rb +40 -36
  47. data/sunspot_rails.gemspec +15 -6
  48. metadata +93 -58
  49. data/dev_tasks/spec.rake +0 -97
  50. data/gemfiles/rails-3.0.0 +0 -21
  51. data/gemfiles/rails-3.1.0 +0 -21
  52. data/gemfiles/rails-3.2.0 +0 -21
  53. data/gemfiles/rails-4.0.0 +0 -25
  54. data/gemfiles/rails-4.1.0 +0 -24
  55. data/gemfiles/rails-4.2.0 +0 -24
  56. data/gemfiles/rails-5.0 +0 -20
  57. data/spec/rails_template/app/controllers/application_controller.rb +0 -10
  58. data/spec/rails_template/app/controllers/posts_controller.rb +0 -6
  59. data/spec/rails_template/config/database.yml +0 -11
  60. data/spec/rails_template/db/schema.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9c73686a623e0b8085e678093d6d80a94a65f988
4
- data.tar.gz: 218687305e166d54d3e5240be43cde53c8487abd
2
+ SHA256:
3
+ metadata.gz: fe1c1255087428230f0395ace478a130cc085d17ff4928901d3c3b5d8c533346
4
+ data.tar.gz: 59107a6f61bfe96c726969590ceda3842cee4f78c618e8d90e28eb1ce827cbb0
5
5
  SHA512:
6
- metadata.gz: fb98a7c070f2ca26b62911ca89011bb84f9ac02aa67a6a63f11021a3825d52e65a4956ad647563b82f14ebdc953486a7fd9b58bb40a78643dc3155fb5ebd3339
7
- data.tar.gz: 98c9d8a7acc171cda06429a97eaa6a9ca0874a26c8bb923cd1008b69926d88b0ca882ce847f2df51bf425787fa622909db25095da39fa1cd4c5afc9f3062d320
6
+ metadata.gz: 9e2d165e6ab6da5acecb593607c1d709111f6b211ed60bcc024dea60d8674f265d3c473073154d9f227e47c88cf6a61b039f28530419d290441de8edd05631db
7
+ data.tar.gz: e6e6ab5dd5d2abb029f240f256483f8710f67a689284630b9d42fcb0be690fb6a11789a9d522cab83ff6e59b446689a3b7bd0d0a6eac1b6d46e4c15b2a8acb85
data/.gitignore CHANGED
@@ -3,5 +3,4 @@ doc
3
3
  pkg/*
4
4
  log
5
5
  .bundle
6
- tmp/*
7
- gemfiles/*.lock
6
+ gemfiles/*.gemfile*
@@ -0,0 +1,63 @@
1
+ ruby_version = Gem::Version.new(RUBY_VERSION)
2
+
3
+ if ruby_version < Gem::Version.new('2.2.0')
4
+ ['3.0.0', '3.1.0'].each do |rails_version|
5
+ appraise "rails-#{rails_version}" do
6
+ gem 'bundler', '>= 1.3.0', '< 2.0'
7
+ gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
8
+ gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
9
+ gem 'rails', "~> #{rails_version}"
10
+ gem 'progress_bar', '~> 1.0.5', require: false
11
+ gem 'rspec', '~> 3.4.0'
12
+ gem 'rspec-rails', '~> 3.4.0'
13
+ end
14
+ end
15
+ end
16
+
17
+ if ruby_version < Gem::Version.new('2.4.0')
18
+ appraise 'rails-3.2.0' do
19
+ gem 'bundler', '>= 1.3.0', '< 2.0'
20
+ gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
21
+ gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
22
+ gem 'rails', '~> 3.2.0'
23
+ gem 'progress_bar', '~> 1.0.5', require: false
24
+ gem 'test-unit', '~> 3.2.0'
25
+ gem 'rspec', '~> 3.4.0'
26
+ gem 'rspec-rails', '~> 3.4.0'
27
+ end
28
+
29
+ ['4.0.0', '4.1.0'].each do |rails_version|
30
+ appraise "rails-#{rails_version}" do
31
+ gem 'bundler', '>= 1.3.0', '< 2.0'
32
+ gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
33
+ gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
34
+ gem 'rails', "~> #{rails_version}"
35
+ gem 'progress_bar', '~> 1.0.5', require: false
36
+ gem 'rspec', '~> 3.4.0'
37
+ gem 'rspec-rails', '~> 3.4.0'
38
+ end
39
+ end
40
+ end
41
+
42
+ if ruby_version < Gem::Version.new('2.5.0')
43
+ appraise 'rails-4.2.0' do
44
+ gem 'bundler', '>= 1.3.0', '< 2.0'
45
+ gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
46
+ gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
47
+ gem 'rails', '~> 4.2.0'
48
+ gem 'progress_bar', '~> 1.0.5', require: false
49
+ gem 'rspec', '~> 3.4.0'
50
+ gem 'rspec-rails', '~> 3.4.0'
51
+ end
52
+ end
53
+
54
+ if ruby_version >= Gem::Version.new('2.2.0')
55
+ ['5.0.0', '5.1.0', '5.2.0'].each do |rails_version|
56
+ appraise "rails-#{rails_version}" do
57
+ gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
58
+ gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
59
+ gem 'rails', "~> #{rails_version}"
60
+ gem 'progress_bar', '~> 1.0.5', require: false
61
+ end
62
+ end
63
+ end
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
File without changes
@@ -53,6 +53,7 @@ module Sunspot #:nodoc:
53
53
  config.solr.read_timeout = sunspot_rails_configuration.read_timeout
54
54
  config.solr.open_timeout = sunspot_rails_configuration.open_timeout
55
55
  config.solr.proxy = sunspot_rails_configuration.proxy
56
+ config.solr.update_format = sunspot_rails_configuration.update_format
56
57
  config
57
58
  end
58
59
 
@@ -68,6 +69,7 @@ module Sunspot #:nodoc:
68
69
  config.solr.read_timeout = sunspot_rails_configuration.read_timeout
69
70
  config.solr.open_timeout = sunspot_rails_configuration.open_timeout
70
71
  config.solr.proxy = sunspot_rails_configuration.proxy
72
+ config.solr.update_format = sunspot_rails_configuration.update_format
71
73
  config
72
74
  end
73
75
  end
@@ -301,6 +301,10 @@ module Sunspot #:nodoc:
301
301
  @open_timeout ||= user_configuration_from_key('solr', 'open_timeout')
302
302
  end
303
303
 
304
+ def update_format
305
+ @update_format ||= user_configuration_from_key('solr', 'update_format')
306
+ end
307
+
304
308
  def proxy
305
309
  @proxy ||= user_configuration_from_key('solr', 'proxy')
306
310
  end
@@ -99,9 +99,15 @@ module Sunspot #:nodoc:
99
99
 
100
100
  unless options[:auto_remove] == false
101
101
  # after_commit { |searchable| searchable.remove_from_index }, :on => :destroy
102
- __send__ Sunspot::Rails.configuration.auto_remove_callback,
103
- proc { |searchable| searchable.remove_from_index },
104
- :on => :destroy
102
+ # Only add the on filter if the callback supports it
103
+ if Sunspot::Rails.configuration.auto_remove_callback =~ /save|destroy|create/
104
+ __send__ Sunspot::Rails.configuration.auto_remove_callback,
105
+ proc { |searchable| searchable.remove_from_index }
106
+ else
107
+ __send__ Sunspot::Rails.configuration.auto_remove_callback,
108
+ proc { |searchable| searchable.remove_from_index },
109
+ :on => :destroy
110
+ end
105
111
  end
106
112
  options[:include] = Util::Array(options[:include])
107
113
 
@@ -4,7 +4,7 @@ module Sunspot
4
4
 
5
5
  COMMIT = %r{<commit/>}
6
6
 
7
- def execute_with_rails_logging(client, request_context)
7
+ def execute_with_rails_logging(request_context)
8
8
  body = (request_context[:data]||"").dup
9
9
  action = request_context[:path].capitalize
10
10
  if body =~ COMMIT
@@ -16,7 +16,7 @@ module Sunspot
16
16
  response = nil
17
17
  begin
18
18
  ms = Benchmark.ms do
19
- response = execute_without_rails_logging(client, request_context)
19
+ response = execute_without_rails_logging(request_context)
20
20
  end
21
21
  log_name = 'Solr %s (%.1fms)' % [action, ms]
22
22
  ::Rails.logger.debug(format_log_entry(log_name, body))
@@ -47,7 +47,7 @@ module Sunspot
47
47
  end
48
48
  end
49
49
 
50
- RSolr::Connection.module_eval do
50
+ RSolr::Client.class_eval do
51
51
  include Sunspot::Rails::SolrLogging
52
52
  alias_method :execute_without_rails_logging, :execute
53
53
  alias_method :execute, :execute_with_rails_logging
@@ -44,6 +44,10 @@ module Sunspot
44
44
  def optimize
45
45
  end
46
46
 
47
+ def config
48
+ Sunspot::Configuration.build
49
+ end
50
+
47
51
  def dirty?
48
52
  false
49
53
  end
@@ -2,195 +2,203 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
2
2
 
3
3
  describe Sunspot::Rails::Configuration, "default values without a sunspot.yml" do
4
4
  before(:each) do
5
- File.stub(:exist?).and_return(false) # simulate sunspot.yml not existing
5
+ allow(File).to receive(:exist?).and_return(false) # simulate sunspot.yml not existing
6
6
  @config = Sunspot::Rails::Configuration.new
7
7
  end
8
8
 
9
9
  it "should handle the 'hostname' property when not set" do
10
- @config.hostname.should == 'localhost'
10
+ expect(@config.hostname).to eq('localhost')
11
11
  end
12
12
 
13
13
  it "should handle the 'path' property when not set" do
14
- @config.path.should == '/solr/default'
14
+ expect(@config.path).to eq('/solr/default')
15
15
  end
16
16
 
17
17
  it "should set the scheme to http" do
18
- @config.scheme.should == "http"
18
+ expect(@config.scheme).to eq("http")
19
19
  end
20
20
 
21
21
  it "should not have userinfo" do
22
- @config.userinfo.should be_nil
22
+ expect(@config.userinfo).to be_nil
23
23
  end
24
24
 
25
25
  it "should not set a proxy" do
26
- @config.proxy.should be_nil
26
+ expect(@config.proxy).to be_nil
27
27
  end
28
28
 
29
29
  describe "port" do
30
30
  it "should default to port 8981 in test" do
31
- ::Rails.stub(:env => 'test')
31
+ allow(::Rails).to receive(:env).and_return('test')
32
32
  @config = Sunspot::Rails::Configuration.new
33
- @config.port.should == 8981
33
+ expect(@config.port).to eq(8981)
34
34
  end
35
35
  it "should default to port 8982 in development" do
36
- ::Rails.stub(:env => 'development')
36
+ allow(::Rails).to receive(:env).and_return('development')
37
37
  @config = Sunspot::Rails::Configuration.new
38
- @config.port.should == 8982
38
+ expect(@config.port).to eq(8982)
39
39
  end
40
40
  it "should default to 8983 in production" do
41
- ::Rails.stub(:env => 'production')
41
+ allow(::Rails).to receive(:env).and_return('production')
42
42
  @config = Sunspot::Rails::Configuration.new
43
- @config.port.should == 8983
43
+ expect(@config.port).to eq(8983)
44
44
  end
45
45
  it "should generally default to 8983" do
46
- ::Rails.stub(:env => 'staging')
46
+ allow(::Rails).to receive(:env).and_return('staging')
47
47
  @config = Sunspot::Rails::Configuration.new
48
- @config.port.should == 8983
48
+ expect(@config.port).to eq(8983)
49
49
  end
50
50
  end
51
51
 
52
52
  it "should set the read timeout to nil when not set" do
53
- @config.read_timeout == nil
53
+ expect(@config.read_timeout).to be_nil
54
54
  end
55
55
 
56
56
  it "should set the open timeout to nil when not set" do
57
- @config.open_timeout == nil
57
+ expect(@config.open_timeout).to be_nil
58
+ end
59
+
60
+ it "should set the update_format to nil when not set" do
61
+ expect(@config.update_format).to be_nil
58
62
  end
59
63
 
60
64
  it "should set 'log_level' property using Rails log level when not set" do
61
- ::Rails.logger.stub(:level){ 3 }
62
- @config.log_level.should == 'SEVERE'
65
+ allow(::Rails.logger).to receive(:level){ 3 }
66
+ expect(@config.log_level).to eq('SEVERE')
63
67
  end
64
68
 
65
69
  it "should handle the 'log_file' property" do
66
- @config.log_file.should =~ /log\/solr_test.log/
70
+ expect(@config.log_file).to match(/log\/solr_test.log/)
67
71
  end
68
72
 
69
73
  it "should handle the 'solr_home' property when not set" do
70
- Rails.should_receive(:root).at_least(1).and_return('/some/path')
71
- @config.solr_home.should == '/some/path/solr'
74
+ expect(Rails).to receive(:root).at_least(1).and_return('/some/path')
75
+ expect(@config.solr_home).to eq('/some/path/solr')
72
76
  end
73
77
 
74
78
  it "should handle the 'pid_dir' property when not set" do
75
- Rails.should_receive(:root).at_least(1).and_return('/some/path')
76
- @config.pid_dir.should == '/some/path/solr/pids/test'
79
+ expect(Rails).to receive(:root).at_least(1).and_return('/some/path')
80
+ expect(@config.pid_dir).to eq('/some/path/solr/pids/test')
77
81
  end
78
82
 
79
83
  it "should handle the 'auto_commit_after_request' propery when not set" do
80
- @config.auto_commit_after_request?.should == true
84
+ expect(@config.auto_commit_after_request?).to eq(true)
81
85
  end
82
86
 
83
87
  it "should handle the 'auto_commit_after_delete_request' propery when not set" do
84
- @config.auto_commit_after_delete_request?.should == false
88
+ expect(@config.auto_commit_after_delete_request?).to eq(false)
85
89
  end
86
90
 
87
91
  it "should handle the 'bind_address' property when not set" do
88
- @config.bind_address.should be_nil
92
+ expect(@config.bind_address).to be_nil
89
93
  end
90
94
 
91
95
  it "should handle the 'disabled' property when not set" do
92
- @config.disabled?.should be_false
96
+ expect(@config.disabled?).to be_falsey
93
97
  end
94
98
 
95
99
  it "should handle the 'auto_index_callback' property when not set" do
96
- @config.auto_index_callback.should == "after_save"
100
+ expect(@config.auto_index_callback).to eq("after_save")
97
101
  end
98
102
 
99
103
  it "should handle the 'auto_remove_callback' property when not set" do
100
- @config.auto_remove_callback.should == "after_destroy"
104
+ expect(@config.auto_remove_callback).to eq("after_destroy")
101
105
  end
102
106
  end
103
107
 
104
108
  describe Sunspot::Rails::Configuration, "user provided sunspot.yml" do
105
109
  before(:each) do
106
- ::Rails.stub(:env => 'config_test')
110
+ allow(::Rails).to receive(:env).and_return('config_test')
107
111
  @config = Sunspot::Rails::Configuration.new
108
112
  end
109
113
 
110
114
  it "should handle the 'scheme' property when set" do
111
- @config.scheme.should == "http"
115
+ expect(@config.scheme).to eq("http")
112
116
  end
113
117
 
114
118
  it "should handle the 'user' and 'pass' properties when set" do
115
- @config.userinfo.should == "user:pass"
119
+ expect(@config.userinfo).to eq("user:pass")
116
120
  end
117
121
 
118
122
  it "should handle the 'hostname' property when set" do
119
- @config.hostname.should == 'some.host'
123
+ expect(@config.hostname).to eq('some.host')
120
124
  end
121
125
 
122
126
  it "should handle the 'port' property when set" do
123
- @config.port.should == 1234
127
+ expect(@config.port).to eq(1234)
124
128
  end
125
129
 
126
130
  it "should handle the 'path' property when set" do
127
- @config.path.should == '/solr/idx'
131
+ expect(@config.path).to eq('/solr/idx')
128
132
  end
129
133
 
130
134
  it "should handle the 'log_level' propery when set" do
131
- @config.log_level.should == 'WARNING'
135
+ expect(@config.log_level).to eq('WARNING')
132
136
  end
133
137
 
134
138
  it "should handle the 'solr_home' propery when set" do
135
- @config.solr_home.should == '/my_superior_path'
139
+ expect(@config.solr_home).to eq('/my_superior_path')
136
140
  end
137
141
 
138
142
  it "should handle the 'pid_dir' property when set" do
139
- @config.pid_dir.should == '/my_superior_path/pids'
143
+ expect(@config.pid_dir).to eq('/my_superior_path/pids')
140
144
  end
141
145
 
142
146
  it "should handle the 'solr_home' property when set" do
143
- @config.solr_home.should == '/my_superior_path'
147
+ expect(@config.solr_home).to eq('/my_superior_path')
144
148
  end
145
149
 
146
150
  it "should handle the 'auto_commit_after_request' propery when set" do
147
- @config.auto_commit_after_request?.should == false
151
+ expect(@config.auto_commit_after_request?).to eq(false)
148
152
  end
149
153
 
150
154
  it "should handle the 'auto_commit_after_delete_request' propery when set" do
151
- @config.auto_commit_after_delete_request?.should == true
155
+ expect(@config.auto_commit_after_delete_request?).to eq(true)
152
156
  end
153
157
 
154
158
  it "should handle the 'bind_address' property when set" do
155
- @config.bind_address.should == "127.0.0.1"
159
+ expect(@config.bind_address).to eq("127.0.0.1")
156
160
  end
157
161
 
158
162
  it "should handle the 'read_timeout' property when set" do
159
- @config.read_timeout.should == 2
163
+ expect(@config.read_timeout).to eq(2)
160
164
  end
161
165
 
162
166
  it "should handle the 'open_timeout' property when set" do
163
- @config.open_timeout.should == 0.5
167
+ expect(@config.open_timeout).to eq(0.5)
168
+ end
169
+
170
+ it "should handle the 'update_format' property when set" do
171
+ expect(@config.update_format).to eq('json')
164
172
  end
165
173
 
166
174
  it "should handle the 'proxy' property when set" do
167
- @config.proxy.should == 'http://proxy.com:12345'
175
+ expect(@config.proxy).to eq('http://proxy.com:12345')
168
176
  end
169
177
  end
170
178
 
171
179
  describe Sunspot::Rails::Configuration, "with auto_index_callback and auto_remove_callback set" do
172
180
  before do
173
- ::Rails.stub(:env => 'config_commit_test')
181
+ allow(::Rails).to receive(:env).and_return('config_commit_test')
174
182
  @config = Sunspot::Rails::Configuration.new
175
183
  end
176
184
 
177
185
  it "should handle the 'auto_index_callback' property when set" do
178
- @config.auto_index_callback.should == "after_commit"
186
+ expect(@config.auto_index_callback).to eq("after_commit")
179
187
  end
180
188
 
181
189
  it "should handle the 'auto_remove_callback' property when set" do
182
- @config.auto_remove_callback.should == "after_commit"
190
+ expect(@config.auto_remove_callback).to eq("after_commit")
183
191
  end
184
192
  end
185
193
 
186
194
  describe Sunspot::Rails::Configuration, "with disabled: true in sunspot.yml" do
187
195
  before(:each) do
188
- ::Rails.stub(:env => 'config_disabled_test')
196
+ allow(::Rails).to receive(:env).and_return('config_disabled_test')
189
197
  @config = Sunspot::Rails::Configuration.new
190
198
  end
191
199
 
192
200
  it "should handle the 'disabled' property when set" do
193
- @config.disabled?.should be_true
201
+ expect(@config.disabled?).to be_truthy
194
202
  end
195
203
  end
196
204
 
@@ -200,7 +208,7 @@ describe Sunspot::Rails::Configuration, "with ENV['SOLR_URL'] overriding sunspot
200
208
  end
201
209
 
202
210
  before(:each) do
203
- ::Rails.stub(:env => 'config_test')
211
+ allow(::Rails).to receive(:env).and_return('config_test')
204
212
  @config = Sunspot::Rails::Configuration.new
205
213
  end
206
214
 
@@ -209,15 +217,15 @@ describe Sunspot::Rails::Configuration, "with ENV['SOLR_URL'] overriding sunspot
209
217
  end
210
218
 
211
219
  it "should handle the 'hostname' property when set" do
212
- @config.hostname.should == 'environment.host'
220
+ expect(@config.hostname).to eq('environment.host')
213
221
  end
214
222
 
215
223
  it "should handle the 'port' property when set" do
216
- @config.port.should == 5432
224
+ expect(@config.port).to eq(5432)
217
225
  end
218
226
 
219
227
  it "should handle the 'path' property when set" do
220
- @config.path.should == '/solr/env'
228
+ expect(@config.path).to eq('/solr/env')
221
229
  end
222
230
  end
223
231
 
@@ -227,7 +235,7 @@ describe Sunspot::Rails::Configuration, "with ENV['WEBSOLR_URL'] overriding suns
227
235
  end
228
236
 
229
237
  before(:each) do
230
- ::Rails.stub(:env => 'config_test')
238
+ allow(::Rails).to receive(:env).and_return('config_test')
231
239
  @config = Sunspot::Rails::Configuration.new
232
240
  end
233
241
 
@@ -236,15 +244,15 @@ describe Sunspot::Rails::Configuration, "with ENV['WEBSOLR_URL'] overriding suns
236
244
  end
237
245
 
238
246
  it "should handle the 'hostname' property when set" do
239
- @config.hostname.should == 'index.websolr.test'
247
+ expect(@config.hostname).to eq('index.websolr.test')
240
248
  end
241
249
 
242
250
  it "should handle the 'port' property when set" do
243
- @config.port.should == 80
251
+ expect(@config.port).to eq(80)
244
252
  end
245
253
 
246
254
  it "should handle the 'path' property when set" do
247
- @config.path.should == '/solr/a1b2c3d4e5f'
255
+ expect(@config.path).to eq('/solr/a1b2c3d4e5f')
248
256
  end
249
257
  end
250
258
 
@@ -254,7 +262,7 @@ describe Sunspot::Rails::Configuration, "with ENV['WEBSOLR_URL'] using https" do
254
262
  end
255
263
 
256
264
  before(:each) do
257
- ::Rails.stub(:env => 'config_test')
265
+ allow(::Rails).to receive(:env).and_return('config_test')
258
266
  @config = Sunspot::Rails::Configuration.new
259
267
  end
260
268
 
@@ -263,19 +271,19 @@ describe Sunspot::Rails::Configuration, "with ENV['WEBSOLR_URL'] using https" do
263
271
  end
264
272
 
265
273
  it "should set the scheme to https" do
266
- @config.scheme.should == "https"
274
+ expect(@config.scheme).to eq("https")
267
275
  end
268
276
 
269
277
  it "should handle the 'hostname' property when set" do
270
- @config.hostname.should == 'index.websolr.test'
278
+ expect(@config.hostname).to eq('index.websolr.test')
271
279
  end
272
280
 
273
281
  it "should handle the 'port' property when set" do
274
- @config.port.should == 443
282
+ expect(@config.port).to eq(443)
275
283
  end
276
284
 
277
285
  it "should handle the 'path' property when set" do
278
- @config.path.should == '/solr/a1b2c3d4e5f'
286
+ expect(@config.path).to eq('/solr/a1b2c3d4e5f')
279
287
  end
280
288
  end
281
289
 
@@ -285,7 +293,7 @@ describe Sunspot::Rails::Configuration, "with ENV['WEBSOLR_URL'] including useri
285
293
  end
286
294
 
287
295
  before(:each) do
288
- ::Rails.stub(:env => 'config_test')
296
+ allow(::Rails).to receive(:env).and_return('config_test')
289
297
  @config = Sunspot::Rails::Configuration.new
290
298
  end
291
299
 
@@ -294,22 +302,22 @@ describe Sunspot::Rails::Configuration, "with ENV['WEBSOLR_URL'] including useri
294
302
  end
295
303
 
296
304
  it "should include username and passowrd" do
297
- @config.userinfo.should == "user:pass"
305
+ expect(@config.userinfo).to eq("user:pass")
298
306
  end
299
307
 
300
308
  it "should set the scheme to https" do
301
- @config.scheme.should == "https"
309
+ expect(@config.scheme).to eq("https")
302
310
  end
303
311
 
304
312
  it "should handle the 'hostname' property when set" do
305
- @config.hostname.should == 'index.websolr.test'
313
+ expect(@config.hostname).to eq('index.websolr.test')
306
314
  end
307
315
 
308
316
  it "should handle the 'port' property when set" do
309
- @config.port.should == 443
317
+ expect(@config.port).to eq(443)
310
318
  end
311
319
 
312
320
  it "should handle the 'path' property when set" do
313
- @config.path.should == '/solr/a1b2c3d4e5f'
321
+ expect(@config.path).to eq('/solr/a1b2c3d4e5f')
314
322
  end
315
323
  end