sunspot_rails 2.2.7 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -2
- data/Appraisals +60 -0
- data/Gemfile +3 -0
- data/gemfiles/.gitkeep +0 -0
- data/lib/sunspot/rails/solr_logging.rb +3 -3
- data/spec/configuration_spec.rb +67 -67
- data/spec/model_lifecycle_spec.rb +8 -8
- data/spec/model_spec.rb +72 -71
- data/spec/rails_app/app/controllers/application_controller.rb +4 -0
- data/spec/rails_app/app/controllers/posts_controller.rb +16 -0
- data/spec/{rails_template → rails_app}/app/models/author.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/blog.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/location.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/photo_post.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/post.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/post_with_auto.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/post_with_default_scope.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/post_with_only_some_attributes_triggering_reindex.rb +0 -0
- data/spec/{rails_template → rails_app}/app/models/rake_task_auto_load_test_model.rb +0 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +14 -0
- data/spec/rails_app/config/boot.rb +6 -0
- data/spec/rails_app/config/database.yml +5 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/test.rb +38 -0
- data/spec/{rails_template → rails_app}/config/initializers/rails_5_override.rb +0 -0
- data/spec/rails_app/config/initializers/secret_token.rb +1 -0
- data/spec/rails_app/config/initializers/session_store.rb +3 -0
- data/spec/{rails_template → rails_app}/config/routes.rb +0 -0
- data/spec/{rails_template → rails_app}/config/sunspot.yml +0 -0
- data/spec/rails_app/db/schema.rb +26 -0
- data/spec/rake_task_spec.rb +8 -8
- data/spec/request_lifecycle_spec.rb +12 -16
- data/spec/schema.rb +8 -9
- data/spec/searchable_spec.rb +4 -4
- data/spec/server_spec.rb +7 -7
- data/spec/session_spec.rb +3 -3
- data/spec/shared_examples/indexed_after_save.rb +1 -1
- data/spec/shared_examples/not_indexed_after_save.rb +1 -1
- data/spec/spec_helper.rb +18 -51
- data/spec/stub_session_proxy_spec.rb +36 -36
- data/sunspot_rails.gemspec +6 -3
- metadata +94 -58
- data/dev_tasks/spec.rake +0 -97
- data/gemfiles/rails-3.0.0 +0 -21
- data/gemfiles/rails-3.1.0 +0 -21
- data/gemfiles/rails-3.2.0 +0 -21
- data/gemfiles/rails-4.0.0 +0 -25
- data/gemfiles/rails-4.1.0 +0 -24
- data/gemfiles/rails-4.2.0 +0 -24
- data/gemfiles/rails-5.0 +0 -20
- data/spec/rails_template/app/controllers/application_controller.rb +0 -10
- data/spec/rails_template/app/controllers/posts_controller.rb +0 -6
- data/spec/rails_template/config/database.yml +0 -11
- data/spec/rails_template/db/schema.rb +0 -27
data/dev_tasks/spec.rake
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
namespace :spec do
|
4
|
-
def rails_app_path(version)
|
5
|
-
File.join(File.dirname(__FILE__), "..", "tmp", "rails_#{version.gsub(".", "_")}_app")
|
6
|
-
end
|
7
|
-
|
8
|
-
def gemfile_path(version)
|
9
|
-
File.join(File.dirname(__FILE__), "..", "gemfiles", "rails-#{version}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def vendor_path(version)
|
13
|
-
File.expand_path("vendor/bundle", rails_app_path(version))
|
14
|
-
end
|
15
|
-
|
16
|
-
def rails_template_path
|
17
|
-
File.join(File.dirname(__FILE__), "..", "spec", "rails_template")
|
18
|
-
end
|
19
|
-
|
20
|
-
def version
|
21
|
-
ENV['VERSION']
|
22
|
-
end
|
23
|
-
|
24
|
-
task :run_with_rails => [:set_gemfile, :generate_rails_app, :initialize_database, :setup_rails_app, :run]
|
25
|
-
|
26
|
-
task :set_gemfile do
|
27
|
-
ENV['BUNDLE_PATH'] = vendor_path(version)
|
28
|
-
ENV['BUNDLE_GEMFILE'] = gemfile_path(version)
|
29
|
-
|
30
|
-
unless File.exist?(ENV['BUNDLE_PATH'])
|
31
|
-
puts "Installing gems for Rails #{version} (this will only be done once)..."
|
32
|
-
sh("bundle install #{ENV['BUNDLE_ARGS']}") || exit(1)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
task :generate_rails_app do
|
37
|
-
app_path = rails_app_path(version)
|
38
|
-
|
39
|
-
unless File.exist?(File.expand_path("config/environment.rb", app_path))
|
40
|
-
puts "Generating Rails #{version} application..."
|
41
|
-
sh("bundle exec rails _#{version}_ new \"#{app_path}\" --force --skip-git --skip-javascript --skip-gemfile --skip-sprockets") || exit(1)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
task :initialize_database do
|
46
|
-
if ENV['DB'] == 'postgres'
|
47
|
-
sh "bundle exec rake db:test:prepare"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
task :setup_rails_app do
|
52
|
-
FileUtils.cp_r File.join(rails_template_path, "."), rails_app_path(version)
|
53
|
-
end
|
54
|
-
|
55
|
-
task :run do
|
56
|
-
ENV['BUNDLE_GEMFILE'] = gemfile_path(version)
|
57
|
-
ENV['RAILS_ROOT'] = rails_app_path(version)
|
58
|
-
|
59
|
-
sh "bundle exec rspec #{ENV['SPEC'] || 'spec/*_spec.rb'} --color"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def rails_all_versions
|
64
|
-
versions = []
|
65
|
-
Dir.glob(File.join(File.dirname(__FILE__), "..", "gemfiles", "rails-*")).each do |gemfile|
|
66
|
-
if !gemfile.end_with?(".lock") && gemfile =~ /rails-([0-9.]+)/
|
67
|
-
versions << $1
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
versions
|
72
|
-
end
|
73
|
-
|
74
|
-
def reenable_spec_tasks
|
75
|
-
Rake::Task.tasks.each do |task|
|
76
|
-
if task.name =~ /spec:/
|
77
|
-
task.reenable
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
desc 'Run spec suite in all Rails versions'
|
83
|
-
task :spec do
|
84
|
-
versions = if ENV['RAILS']
|
85
|
-
ENV['RAILS'].split(",")
|
86
|
-
else
|
87
|
-
rails_all_versions
|
88
|
-
end
|
89
|
-
|
90
|
-
versions.each do |version|
|
91
|
-
puts "Running specs against Rails #{version}..."
|
92
|
-
|
93
|
-
ENV['VERSION'] = version
|
94
|
-
reenable_spec_tasks
|
95
|
-
Rake::Task['spec:run_with_rails'].invoke
|
96
|
-
end
|
97
|
-
end
|
data/gemfiles/rails-3.0.0
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 3.0.0'
|
4
|
-
|
5
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
6
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
7
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'rspec-rails', '~> 2.14.0'
|
11
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
12
|
-
gem 'test-unit', '~> 3.2.0' if RUBY_VERSION >= '2.2.0'
|
13
|
-
end
|
14
|
-
|
15
|
-
group :postgres do
|
16
|
-
gem 'pg', '~> 0.18.4'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :sqlite do
|
20
|
-
gem 'sqlite3', '~> 1.3.7'
|
21
|
-
end
|
data/gemfiles/rails-3.1.0
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 3.1.0'
|
4
|
-
|
5
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
6
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
7
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'rspec-rails', '~> 2.14.0'
|
11
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
12
|
-
gem 'test-unit', '~> 3.2.0' if RUBY_VERSION >= '2.2.0'
|
13
|
-
end
|
14
|
-
|
15
|
-
group :postgres do
|
16
|
-
gem 'pg', '~> 0.18.4'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :sqlite do
|
20
|
-
gem 'sqlite3', '~> 1.3.7'
|
21
|
-
end
|
data/gemfiles/rails-3.2.0
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 3.2.0'
|
4
|
-
|
5
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
6
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
7
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'rspec-rails', '~> 2.14.0'
|
11
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
12
|
-
gem 'test-unit', '~> 3.2.0' if RUBY_VERSION >= '2.2.0'
|
13
|
-
end
|
14
|
-
|
15
|
-
group :postgres do
|
16
|
-
gem 'pg', '~> 0.18.4'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :sqlite do
|
20
|
-
gem 'sqlite3', '~> 1.3.7'
|
21
|
-
end
|
data/gemfiles/rails-4.0.0
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 4.0.0'
|
4
|
-
if RUBY_VERSION < '2.0'
|
5
|
-
gem 'mime-types', '~> 2.99.0'
|
6
|
-
end
|
7
|
-
|
8
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
9
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
10
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
11
|
-
|
12
|
-
group :test do
|
13
|
-
gem 'protected_attributes' # Rails 4 support for attr_accessor so specs still work
|
14
|
-
gem 'rspec-rails', '~> 2.14.0'
|
15
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
16
|
-
gem 'test-unit', '~> 3.2.0' if RUBY_VERSION >= '2.2.0'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :postgres do
|
20
|
-
gem 'pg', '~> 0.18.4'
|
21
|
-
end
|
22
|
-
|
23
|
-
group :sqlite do
|
24
|
-
gem 'sqlite3', '~> 1.3.7'
|
25
|
-
end
|
data/gemfiles/rails-4.1.0
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 4.1.0'
|
4
|
-
if RUBY_VERSION < '2.0'
|
5
|
-
gem 'mime-types', '~> 2.99.0'
|
6
|
-
end
|
7
|
-
|
8
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
9
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
10
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
11
|
-
|
12
|
-
group :test do
|
13
|
-
gem 'protected_attributes' # Rails 4 support for attr_accessor so specs still work
|
14
|
-
gem 'rspec-rails', '~> 2.14.0'
|
15
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
16
|
-
end
|
17
|
-
|
18
|
-
group :postgres do
|
19
|
-
gem 'pg', '~> 0.18.4'
|
20
|
-
end
|
21
|
-
|
22
|
-
group :sqlite do
|
23
|
-
gem 'sqlite3', '~> 1.3.7'
|
24
|
-
end
|
data/gemfiles/rails-4.2.0
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 4.2.0'
|
4
|
-
if RUBY_VERSION < '2.0'
|
5
|
-
gem 'mime-types', '~> 2.99.0'
|
6
|
-
end
|
7
|
-
|
8
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
9
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
10
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
11
|
-
|
12
|
-
group :test do
|
13
|
-
gem 'protected_attributes' # Rails 4 support for attr_accessor so specs still work
|
14
|
-
gem 'rspec-rails', '~> 2.14.0'
|
15
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
16
|
-
end
|
17
|
-
|
18
|
-
group :postgres do
|
19
|
-
gem 'pg', '~> 0.18.4'
|
20
|
-
end
|
21
|
-
|
22
|
-
group :sqlite do
|
23
|
-
gem 'sqlite3', '~> 1.3.7'
|
24
|
-
end
|
data/gemfiles/rails-5.0
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '~> 5.0'
|
4
|
-
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
5
|
-
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
6
|
-
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
7
|
-
|
8
|
-
group :test do
|
9
|
-
gem 'protected_attributes_continued'
|
10
|
-
gem 'rspec-rails', '~> 2.14.0'
|
11
|
-
gem 'progress_bar', '~> 1.0.5', require: false
|
12
|
-
end
|
13
|
-
|
14
|
-
group :postgres do
|
15
|
-
gem 'pg', '~> 0.18.4'
|
16
|
-
end
|
17
|
-
|
18
|
-
group :sqlite do
|
19
|
-
gem 'sqlite3', '~> 1.3.7'
|
20
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Filters added to this controller apply to all controllers in the application.
|
2
|
-
# Likewise, all the methods added will be available for all controllers.
|
3
|
-
|
4
|
-
class ApplicationController < ActionController::Base
|
5
|
-
helper :all # include all helpers, all the time
|
6
|
-
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
-
|
8
|
-
# Scrub sensitive parameters from your log
|
9
|
-
# filter_parameter_logging :password
|
10
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
ActiveRecord::Schema.define(:version => 0) do
|
2
|
-
create_table :posts, :force => true do |t|
|
3
|
-
t.string :title
|
4
|
-
t.string :type
|
5
|
-
t.integer :location_id
|
6
|
-
t.text :body
|
7
|
-
t.references :blog
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
|
11
|
-
create_table :locations, :force => true do |t|
|
12
|
-
t.float :lat
|
13
|
-
t.float :lng
|
14
|
-
end
|
15
|
-
|
16
|
-
create_table :blogs, :force => true do |t|
|
17
|
-
t.string :name
|
18
|
-
t.string :subdomain
|
19
|
-
t.timestamps
|
20
|
-
end
|
21
|
-
|
22
|
-
create_table :writers, :force => true, :primary_key => :writer_id do |t|
|
23
|
-
t.string :name
|
24
|
-
t.timestamps
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|