sunspot-rails-tester 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/sunspot/rails/tester.rb +2 -2
- data/spec/sunspot/rails/tester_spec.rb +4 -4
- metadata +1 -1
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Here is an example RSpec 2 spec_helper.rb:
|
|
16
16
|
end
|
17
17
|
|
18
18
|
config.before :solr => true do
|
19
|
-
Sunspot::Rails::Tester.
|
19
|
+
Sunspot::Rails::Tester.start_original_sunspot_session
|
20
20
|
Sunspot.session = $original_sunspot_session
|
21
21
|
Sunspot.remove_all!
|
22
22
|
end
|
@@ -34,7 +34,7 @@ Let's go through what the above code does.
|
|
34
34
|
* In the second `before` block, we use RSpec 2's metadata feature by
|
35
35
|
adding `:solr => true`. Any example or example group with this metadata
|
36
36
|
will run the _original_ sunspot session.
|
37
|
-
`Sunspot::Rails::Tester.
|
37
|
+
`Sunspot::Rails::Tester.start_original_sunspot_session` starts the solr instance
|
38
38
|
if it's not running.
|
39
39
|
|
40
40
|
Here is an example spec that utilizes sunspot-rails-tester:
|
data/lib/sunspot/rails/tester.rb
CHANGED
@@ -4,14 +4,14 @@ require 'forwardable'
|
|
4
4
|
module Sunspot
|
5
5
|
module Rails
|
6
6
|
class Tester
|
7
|
-
VERSION = '0.0.
|
7
|
+
VERSION = '0.0.3'
|
8
8
|
|
9
9
|
class << self
|
10
10
|
extend Forwardable
|
11
11
|
|
12
12
|
attr_accessor :server, :started, :pid
|
13
13
|
|
14
|
-
def
|
14
|
+
def start_original_sunspot_session
|
15
15
|
unless started?
|
16
16
|
self.server = Sunspot::Rails::Server.new
|
17
17
|
self.started = Time.now
|
@@ -5,7 +5,7 @@ module Sunspot
|
|
5
5
|
describe Tester do
|
6
6
|
let(:tester) { described_class }
|
7
7
|
|
8
|
-
describe '.
|
8
|
+
describe '.start_original_sunspot_session' do
|
9
9
|
let(:server) { double('sunspot_rails_server') }
|
10
10
|
let(:pid) { 5555 }
|
11
11
|
|
@@ -19,17 +19,17 @@ module Sunspot
|
|
19
19
|
after { tester.clear }
|
20
20
|
|
21
21
|
it 'sets the "server" attribute' do
|
22
|
-
tester.
|
22
|
+
tester.start_original_sunspot_session
|
23
23
|
tester.server.should eq(server)
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'sets the "started" attribute' do
|
27
|
-
tester.
|
27
|
+
tester.start_original_sunspot_session
|
28
28
|
tester.started.should be_an_instance_of(Time)
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'sets the "pid" attribute' do
|
32
|
-
tester.
|
32
|
+
tester.start_original_sunspot_session
|
33
33
|
tester.pid.should eq(pid)
|
34
34
|
end
|
35
35
|
end
|