sunspot_rails 0.10.9 → 0.11.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.
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe 'Sunspot::Rails session' do
4
+ it 'should be a different object for each thread' do
5
+ end
6
+
7
+ it 'should create a separate master/slave session if configured' do
8
+ end
9
+
10
+ it 'should not create a separate master/slave session if no master configured' do
11
+ end
12
+
13
+ private
14
+
15
+ def with_configuration(options)
16
+ original_configuration = Sunspot::Rails.configuration
17
+ Sunspot::Rails.reset
18
+ Sunspot::Rails.configuration = Sunspot::Rails::Configuration.new
19
+ Sunspot::Rails.configuration.user_configuration = options
20
+ yield
21
+ Sunspot::Rails.reset
22
+ Sunspot::Rails.configuration = original_configuration
23
+ end
24
+ end
@@ -1,18 +1,24 @@
1
1
  ENV['RAILS_ENV'] = 'test'
2
2
  ENV['RAILS_ROOT'] ||= File.join(File.dirname(__FILE__), 'mock_app')
3
3
 
4
+ if File.exist?(sunspot_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'sunspot', 'lib')))
5
+ STDERR.puts("Using sunspot lib at #{sunspot_lib}")
6
+ $: << sunspot_lib
7
+ end
8
+
4
9
  require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config', 'environment.rb'))
5
10
 
6
11
  require 'spec'
7
12
  require 'spec/rails'
8
13
  require 'rake'
9
- require 'ruby-debug'
14
+ require 'ruby-debug' unless RUBY_VERSION > '1.9'
10
15
  require 'sunspot/rails/tasks'
16
+ require 'sunspot/spec/extension'
11
17
 
12
18
  def load_schema
13
19
  stdout = $stdout
14
20
  $stdout = StringIO.new # suppress output while building the schema
15
- load File.join(File.dirname(__FILE__), 'schema.rb')
21
+ load File.join(ENV['RAILS_ROOT'], 'db', 'schema.rb')
16
22
  $stdout = stdout
17
23
  end
18
24
 
@@ -25,8 +31,21 @@ end
25
31
 
26
32
  Spec::Runner.configure do |config|
27
33
  config.before(:each) do
28
- Sunspot.remove_all
29
- Sunspot.commit
34
+ if integrate_sunspot?
35
+ Sunspot.remove_all
36
+ Sunspot.commit
37
+ end
30
38
  load_schema
31
39
  end
32
40
  end
41
+
42
+ module Spec
43
+ module Mocks
44
+ module Methods
45
+ def should_respond_to_and_receive(*args, &block)
46
+ respond_to?(args.first).should ==(true)
47
+ should_receive(*args, &block)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe 'Sunspot Spec Integration - integrate sunspot' do
4
+ integrate_sunspot
5
+
6
+ it "should call sunspot" do
7
+ Sunspot::Rails.reset
8
+ @post = PostWithAuto.create!
9
+ Sunspot.commit
10
+ PostWithAuto.search.results.should == [@post]
11
+ end
12
+ end
13
+
14
+ describe 'Sunspot Spec Integration - mock sunspot' do
15
+ it "should call sunspot" do
16
+ Sunspot.remove_all
17
+ Sunspot.commit
18
+ @post = PostWithAuto.create!
19
+ Sunspot.commit
20
+ PostWithAuto.search.results.should_not include(@post)
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe 'ActiveRecord mixin and instance methods' do
4
+ it "should know about relevant index attributes - relevant attribute changed" do
5
+ @post = PostWithAuto.new
6
+ @post.should_receive(:changes).and_return(:title => 'new title')
7
+ Sunspot::Rails::Util.index_relevant_attribute_changed?(@post).should == true
8
+ end
9
+
10
+ it "should know about relevant index attributes - no relevant attribute changed" do
11
+ @post = PostWithAuto.new
12
+ @post.should_receive(:changes).and_return(:updated_at => Date.tomorrow)
13
+ Sunspot::Rails::Util.index_relevant_attribute_changed?(@post).should == false
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunspot_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.9
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-10-21 00:00:00 -04:00
15
+ date: 2009-11-06 00:00:00 -05:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -31,9 +31,9 @@ dependencies:
31
31
  version_requirement:
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ~>
34
+ - - "="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.10.0
36
+ version: 0.10.5
37
37
  version:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec
@@ -92,27 +92,36 @@ extra_rdoc_files:
92
92
  - LICENSE
93
93
  - README.rdoc
94
94
  files:
95
+ - History.txt
95
96
  - LICENSE
96
97
  - MIT-LICENSE
97
98
  - README.rdoc
98
99
  - Rakefile
100
+ - TODO
99
101
  - VERSION.yml
100
102
  - dev_tasks/gemspec.rake
101
103
  - dev_tasks/rdoc.rake
102
104
  - dev_tasks/release.rake
103
105
  - dev_tasks/todo.rake
106
+ - generators/sunspot/sunspot_generator.rb
107
+ - generators/sunspot/templates/sunspot.yml
104
108
  - install.rb
105
109
  - lib/sunspot/rails.rb
106
110
  - lib/sunspot/rails/adapters.rb
107
111
  - lib/sunspot/rails/configuration.rb
108
112
  - lib/sunspot/rails/request_lifecycle.rb
109
113
  - lib/sunspot/rails/searchable.rb
114
+ - lib/sunspot/rails/server.rb
115
+ - lib/sunspot/rails/session_proxy.rb
110
116
  - lib/sunspot/rails/tasks.rb
117
+ - lib/sunspot/rails/util.rb
118
+ - lib/sunspot/spec/extension.rb
111
119
  - rails/init.rb
112
120
  - spec/configuration_spec.rb
113
121
  - spec/mock_app/app/controllers/application.rb
114
122
  - spec/mock_app/app/controllers/application_controller.rb
115
123
  - spec/mock_app/app/controllers/posts_controller.rb
124
+ - spec/mock_app/app/models/author.rb
116
125
  - spec/mock_app/app/models/blog.rb
117
126
  - spec/mock_app/app/models/post.rb
118
127
  - spec/mock_app/app/models/post_with_auto.rb
@@ -125,11 +134,17 @@ files:
125
134
  - spec/mock_app/config/initializers/session_store.rb
126
135
  - spec/mock_app/config/routes.rb
127
136
  - spec/mock_app/config/sunspot.yml
137
+ - spec/mock_app/db/schema.rb
138
+ - spec/mock_app/db/test.db
128
139
  - spec/model_lifecycle_spec.rb
129
140
  - spec/model_spec.rb
130
141
  - spec/request_lifecycle_spec.rb
131
142
  - spec/schema.rb
143
+ - spec/server_spec.rb
144
+ - spec/session_spec.rb
132
145
  - spec/spec_helper.rb
146
+ - spec/sunspot_mocking_spec.rb
147
+ - spec/util_spec.rb
133
148
  has_rdoc: true
134
149
  homepage: http://github.com/outoftime/sunspot_rails
135
150
  licenses: []
@@ -154,27 +169,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
169
  requirements: []
155
170
 
156
171
  rubyforge_project: sunspot
157
- rubygems_version: 1.3.5
172
+ rubygems_version: 1.3.2
158
173
  signing_key:
159
174
  specification_version: 3
160
175
  summary: Rails integration for the Sunspot Solr search library
161
176
  test_files:
177
+ - spec/spec_helper.rb
178
+ - spec/session_spec.rb
179
+ - spec/server_spec.rb
162
180
  - spec/configuration_spec.rb
163
- - spec/mock_app/app/controllers/application.rb
164
- - spec/mock_app/app/controllers/application_controller.rb
181
+ - spec/model_lifecycle_spec.rb
182
+ - spec/schema.rb
183
+ - spec/model_spec.rb
184
+ - spec/sunspot_mocking_spec.rb
185
+ - spec/util_spec.rb
165
186
  - spec/mock_app/app/controllers/posts_controller.rb
187
+ - spec/mock_app/app/controllers/application_controller.rb
188
+ - spec/mock_app/app/controllers/application.rb
166
189
  - spec/mock_app/app/models/blog.rb
167
- - spec/mock_app/app/models/post.rb
168
190
  - spec/mock_app/app/models/post_with_auto.rb
169
- - spec/mock_app/config/boot.rb
191
+ - spec/mock_app/app/models/author.rb
192
+ - spec/mock_app/app/models/post.rb
193
+ - spec/mock_app/db/schema.rb
170
194
  - spec/mock_app/config/environment.rb
195
+ - spec/mock_app/config/initializers/session_store.rb
196
+ - spec/mock_app/config/initializers/new_rails_defaults.rb
171
197
  - spec/mock_app/config/environments/development.rb
172
198
  - spec/mock_app/config/environments/test.rb
173
- - spec/mock_app/config/initializers/new_rails_defaults.rb
174
- - spec/mock_app/config/initializers/session_store.rb
175
199
  - spec/mock_app/config/routes.rb
176
- - spec/model_lifecycle_spec.rb
177
- - spec/model_spec.rb
200
+ - spec/mock_app/config/boot.rb
178
201
  - spec/request_lifecycle_spec.rb
179
- - spec/schema.rb
180
- - spec/spec_helper.rb