locomotivecms-search 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ <ul>
2
+
3
+ Liquid error: undefined method `to_liquid' for #<ActiveSearch::Mongoid::Model:0x007fc888529740>
4
+
5
+ Liquid error: undefined method `to_liquid' for #<ActiveSearch::Mongoid::Model:0x007fc888530748>
6
+
7
+ </ul>
@@ -0,0 +1,3 @@
1
+ <ul>
2
+ Liquid error: undefined method `to_liquid' for #<ActiveSearch::Proxy:0x007fac7060a468>
3
+ </ul>
@@ -0,0 +1,3 @@
1
+ <ul>
2
+ Liquid error: undefined method `to_liquid' for #<ActiveSearch::Proxy:0x007ff334a54fe0>
3
+ </ul>
@@ -0,0 +1,11 @@
1
+ <ul>
2
+
3
+
4
+ <li><a href="/examples/findable-entry">Findable entry</a></li>
5
+
6
+
7
+
8
+ <li><a href="/{"en"=>"findable"}">{"en"=>"Please search for this findable page"}</a></li>
9
+
10
+
11
+ </ul>
@@ -0,0 +1,11 @@
1
+ <ul>
2
+
3
+
4
+ <li><a href="/examples/findable-entry">Findable entry</a></li>
5
+
6
+
7
+
8
+ <li><a href="/findable">Please search for this findable page</a></li>
9
+
10
+
11
+ </ul>
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Algolia" do
4
+ before do
5
+ setup_search
6
+ require "activesearch/algolia"
7
+ config = YAML.load_file(Rails.root.join('config', 'backends.yml'))
8
+ require "activesearch/algolia/client"
9
+ ActiveSearch::Algolia::Client.configure(config["algolia"]["api_key"], config["algolia"]["app_id"], "locomotivecms")
10
+ ActiveSearch::Algolia::Client.new.delete_index
11
+ Locomotive.config.search_engine = "algolia"
12
+ end
13
+
14
+ it_behaves_like "a search backend"
15
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Mongoid" do
4
+ before do
5
+ setup_search
6
+ require "activesearch/mongoid"
7
+ Locomotive.config.search_engine = "mongoid"
8
+ end
9
+
10
+ it_behaves_like "a search backend"
11
+ end
@@ -9,7 +9,7 @@ require 'database_cleaner'
9
9
  # Requires supporting ruby files with custom matchers and macros, etc,
10
10
  # in spec/support/ and its subdirectories.
11
11
  require Locomotive::Engine.root.join('spec', 'support', 'factories')
12
- Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
12
+ Dir[Locomotive::Search::Engine.root.join("spec/support/**/*.rb")].each {|f| require f}
13
13
 
14
14
  RSpec.configure do |config|
15
15
  # ## Mock Framework
@@ -34,10 +34,30 @@ RSpec.configure do |config|
34
34
  config.include FactoryGirl::Syntax::Methods
35
35
 
36
36
  config.before(:each) do
37
- DatabaseCleaner.start
37
+ Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&:drop)
38
38
  end
39
-
39
+
40
40
  config.after(:each) do
41
- DatabaseCleaner.clean
41
+ Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&:drop)
42
+ end
43
+ end
44
+
45
+ shared_examples "a search backend" do
46
+ it "that works" do
47
+ visit 'http://test.example.com'
48
+ fill_in "Search", with: "findable"
49
+ click_on "Search"
50
+ page.should have_content "Please search for this"
51
+ page.should have_content "Findable entry"
52
+ page.should_not have_content "Hidden"
53
+ page.should_not have_content "This should never show up"
54
+ page.should_not have_content "NOT Findable entry"
55
+ click_on "Please search for this"
56
+ page.should have_content "This is what you were looking for"
57
+
58
+ visit 'http://test.example.com'
59
+ fill_in "Search", with: "not found"
60
+ click_on "Search"
61
+ page.should_not have_content "Page not found"
42
62
  end
43
63
  end
@@ -1,7 +1,5 @@
1
- require 'spec_helper'
2
-
3
- feature "Search" do
4
- before do
1
+ module SpecHelpers
2
+ def setup_search
5
3
  @site = create('test site')
6
4
  @ctype = build(:content_type, site: @site, name: "Examples")
7
5
  @ctype.entries_custom_fields.create!(label: "Name", type: "string", searchable: true)
@@ -20,7 +18,7 @@ feature "Search" do
20
18
  {% endfor %}
21
19
  </ul>
22
20
  EOT
23
-
21
+
24
22
  @index = @site.pages.where(slug: "index").first
25
23
  @index.raw_template = %|
26
24
  <form action="/{{ locale }}/search" method="GET">
@@ -31,22 +29,10 @@ feature "Search" do
31
29
  @index.save!
32
30
  @another_site = create('another site')
33
31
  create(:page, site: @another_site, title: "This should never show up in the search, even if it would be findable", slug: "rickroll", raw_template: "Rickroll")
32
+ @ctype = build(:content_type, site: @another_site, name: "Examples")
33
+ @ctype.entries_custom_fields.create!(label: "Name", type: "string", searchable: true)
34
+ @ctype.entries.create!(name: "NOT Findable entry", stuff: "Some stuff")
34
35
  end
35
-
36
- scenario "on a single site" do
37
- visit 'http://test.example.com'
38
- fill_in "Search", with: "findable"
39
- click_on "Search"
40
- page.should have_content "Please search for this"
41
- page.should have_content "Findable entry"
42
- page.should_not have_content "Hidden"
43
- page.should_not have_content "This should never show up"
44
- click_on "Please search for this"
45
- page.should have_content "This is what you were looking for"
46
-
47
- visit 'http://test.example.com'
48
- fill_in "Search", with: "not found"
49
- click_on "Search"
50
- page.should_not have_content "Page not found"
51
- end
52
- end
36
+ end
37
+
38
+ Rspec.configure { |c| c.include SpecHelpers }
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alvarez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-04 00:00:00.000000000 Z
11
+ date: 2013-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: locomotive_cms
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesearch
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.0.14
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.0.14
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: parallel_tests
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: LocomotiveSearch is an engine which integrates ActiveSearch into LocomotiveCMS.
112
126
  email:
113
127
  - papipo@gmail.com
@@ -119,7 +133,7 @@ files:
119
133
  - app/models/locomotive/content_entry.rb
120
134
  - app/models/locomotive/page.rb
121
135
  - config/routes.rb
122
- - lib/locomotive/search/concerns/activesearch/mongoid/model.rb
136
+ - lib/locomotive/search/concerns/activesearch/proxy.rb
123
137
  - lib/locomotive/search/concerns/custom_fields/field.rb
124
138
  - lib/locomotive/search/concerns/locomotive/liquid/drops/site.rb
125
139
  - lib/locomotive/search/concerns.rb
@@ -135,6 +149,7 @@ files:
135
149
  - spec/dummy/app/helpers/application_helper.rb
136
150
  - spec/dummy/app/views/layouts/application.html.erb
137
151
  - spec/dummy/config/application.rb
152
+ - spec/dummy/config/backends.yml
138
153
  - spec/dummy/config/boot.rb
139
154
  - spec/dummy/config/environment.rb
140
155
  - spec/dummy/config/environments/development.rb
@@ -152,6 +167,7 @@ files:
152
167
  - spec/dummy/config/locales/en.yml
153
168
  - spec/dummy/config/mongoid.yml
154
169
  - spec/dummy/config/routes.rb
170
+ - spec/dummy/config/sample.backends.yml
155
171
  - spec/dummy/config.ru
156
172
  - spec/dummy/log/development.log
157
173
  - spec/dummy/log/test.log
@@ -553,9 +569,16 @@ files:
553
569
  - spec/dummy/tmp/cache/sass/de5fa1264e247c74a31d8c6c2112ab09d4522445/main.css.scssc
554
570
  - spec/dummy/tmp/cache/sass/de5fa1264e247c74a31d8c6c2112ab09d4522445/sub.css.scssc
555
571
  - spec/dummy/tmp/cache/sass/fddee6582dd8de3f34f33315492ad10ef5329dc3/ui.css.scssc
572
+ - spec/dummy/tmp/capybara/capybara-20130422110141656147449.html
573
+ - spec/dummy/tmp/capybara/capybara-201304221102578439136278.html
574
+ - spec/dummy/tmp/capybara/capybara-201304221104068569441460.html
575
+ - spec/dummy/tmp/capybara/capybara-201304221104343252248803.html
576
+ - spec/dummy/tmp/capybara/capybara-201304221109199028584195.html
556
577
  - spec/dummy/tmp/pids/server.pid
557
- - spec/features/search_spec.rb
578
+ - spec/features/algolia_spec.rb
579
+ - spec/features/mongoid_spec.rb
558
580
  - spec/spec_helper.rb
581
+ - spec/support/helpers.rb
559
582
  homepage: https://github.com/Papipo/locomotivecms-search
560
583
  licenses: []
561
584
  metadata: {}
@@ -586,6 +609,7 @@ test_files:
586
609
  - spec/dummy/app/helpers/application_helper.rb
587
610
  - spec/dummy/app/views/layouts/application.html.erb
588
611
  - spec/dummy/config/application.rb
612
+ - spec/dummy/config/backends.yml
589
613
  - spec/dummy/config/boot.rb
590
614
  - spec/dummy/config/environment.rb
591
615
  - spec/dummy/config/environments/development.rb
@@ -603,6 +627,7 @@ test_files:
603
627
  - spec/dummy/config/locales/en.yml
604
628
  - spec/dummy/config/mongoid.yml
605
629
  - spec/dummy/config/routes.rb
630
+ - spec/dummy/config/sample.backends.yml
606
631
  - spec/dummy/config.ru
607
632
  - spec/dummy/log/development.log
608
633
  - spec/dummy/log/test.log
@@ -1004,6 +1029,13 @@ test_files:
1004
1029
  - spec/dummy/tmp/cache/sass/de5fa1264e247c74a31d8c6c2112ab09d4522445/main.css.scssc
1005
1030
  - spec/dummy/tmp/cache/sass/de5fa1264e247c74a31d8c6c2112ab09d4522445/sub.css.scssc
1006
1031
  - spec/dummy/tmp/cache/sass/fddee6582dd8de3f34f33315492ad10ef5329dc3/ui.css.scssc
1032
+ - spec/dummy/tmp/capybara/capybara-20130422110141656147449.html
1033
+ - spec/dummy/tmp/capybara/capybara-201304221102578439136278.html
1034
+ - spec/dummy/tmp/capybara/capybara-201304221104068569441460.html
1035
+ - spec/dummy/tmp/capybara/capybara-201304221104343252248803.html
1036
+ - spec/dummy/tmp/capybara/capybara-201304221109199028584195.html
1007
1037
  - spec/dummy/tmp/pids/server.pid
1008
- - spec/features/search_spec.rb
1038
+ - spec/features/algolia_spec.rb
1039
+ - spec/features/mongoid_spec.rb
1009
1040
  - spec/spec_helper.rb
1041
+ - spec/support/helpers.rb
@@ -1,7 +0,0 @@
1
- class ActiveSearch::Mongoid::Model
2
- def to_liquid
3
- _stored.each_with_object({}) do |(k,v),memo|
4
- memo[k] = v.respond_to?(:has_key?) && v.has_key?(I18n.locale.to_s) ? v[I18n.locale.to_s] : v
5
- end
6
- end
7
- end