Sphincter 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/LICENSE.txt +27 -0
- data/Manifest.txt +16 -0
- data/README.txt +132 -0
- data/Rakefile +21 -0
- data/lib/sphincter.rb +102 -0
- data/lib/sphincter/association_searcher.rb +22 -0
- data/lib/sphincter/configure.rb +380 -0
- data/lib/sphincter/search.rb +173 -0
- data/lib/sphincter/search_stub.rb +60 -0
- data/lib/sphincter/tasks.rb +64 -0
- data/test/sphincter_test_case.rb +190 -0
- data/test/test_sphincter_association_searcher.rb +39 -0
- data/test/test_sphincter_configure.rb +318 -0
- data/test/test_sphincter_search.rb +100 -0
- data/test/test_sphincter_search_stub.rb +50 -0
- metadata +100 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test/sphincter_test_case'
|
2
|
+
require 'sphincter/search_stub'
|
3
|
+
|
4
|
+
class TestSphincterSearchStub < SphincterTestCase
|
5
|
+
|
6
|
+
class StubbedModel
|
7
|
+
extend Sphincter::SearchStub
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_search
|
11
|
+
StubbedModel.search_args = []
|
12
|
+
StubbedModel.search_results = [:blah]
|
13
|
+
|
14
|
+
result = StubbedModel.search 'words', :conditions => { :foo_id => 1 }
|
15
|
+
|
16
|
+
assert_equal :blah, result
|
17
|
+
|
18
|
+
assert_equal 1, StubbedModel.search_args.length
|
19
|
+
assert_equal ['words', { :conditions => { :foo_id => 1 } }],
|
20
|
+
StubbedModel.search_args.first
|
21
|
+
|
22
|
+
assert_equal 0, StubbedModel.search_results.length
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_search_no_setup
|
26
|
+
expected = 'need to set up Sphincter::SearchStub#search_results and/or Sphincter::SearchStub#search_args in test setup'
|
27
|
+
|
28
|
+
StubbedModel.search_args = nil
|
29
|
+
StubbedModel.search_results = nil
|
30
|
+
e = assert_raise RuntimeError do StubbedModel.search 'words' end
|
31
|
+
assert_equal expected, e.message
|
32
|
+
|
33
|
+
StubbedModel.search_args = []
|
34
|
+
StubbedModel.search_results = nil
|
35
|
+
e = assert_raise RuntimeError do StubbedModel.search 'words' end
|
36
|
+
assert_equal expected, e.message
|
37
|
+
|
38
|
+
StubbedModel.search_args = nil
|
39
|
+
StubbedModel.search_results = []
|
40
|
+
e = assert_raise RuntimeError do StubbedModel.search 'words' end
|
41
|
+
assert_equal expected, e.message
|
42
|
+
|
43
|
+
StubbedModel.search_args = []
|
44
|
+
StubbedModel.search_results = []
|
45
|
+
e = assert_raise RuntimeError do StubbedModel.search 'words' end
|
46
|
+
assert_equal 'no more search results in search stub', e.message
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.4.3
|
3
|
+
specification_version: 1
|
4
|
+
name: Sphincter
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-07-30 00:00:00 -07:00
|
8
|
+
summary: Sphincter is an ActiveRecord extension for full-text searching with Sphinx.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: drbrain@segment7.net
|
12
|
+
homepage: http://seattlerb.org/Sphincter
|
13
|
+
rubyforge_project: seattlerb
|
14
|
+
description: Sphincter uses Dmytro Shteflyuk's sphinx Ruby API and automatic configuration to make totally rad ActiveRecord searching. Well, you still have to tell Sphincter what models you want to search. It doesn't read your mind.
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.0
|
30
|
+
version:
|
31
|
+
platform: ruby
|
32
|
+
signing_key:
|
33
|
+
cert_chain:
|
34
|
+
post_install_message:
|
35
|
+
authors:
|
36
|
+
- Eric Hodel
|
37
|
+
files:
|
38
|
+
- History.txt
|
39
|
+
- LICENSE.txt
|
40
|
+
- Manifest.txt
|
41
|
+
- README.txt
|
42
|
+
- Rakefile
|
43
|
+
- lib/sphincter.rb
|
44
|
+
- lib/sphincter/association_searcher.rb
|
45
|
+
- lib/sphincter/configure.rb
|
46
|
+
- lib/sphincter/search.rb
|
47
|
+
- lib/sphincter/search_stub.rb
|
48
|
+
- lib/sphincter/tasks.rb
|
49
|
+
- test/sphincter_test_case.rb
|
50
|
+
- test/test_sphincter_association_searcher.rb
|
51
|
+
- test/test_sphincter_configure.rb
|
52
|
+
- test/test_sphincter_search.rb
|
53
|
+
- test/test_sphincter_search_stub.rb
|
54
|
+
test_files:
|
55
|
+
- test/test_sphincter_association_searcher.rb
|
56
|
+
- test/test_sphincter_configure.rb
|
57
|
+
- test/test_sphincter_search.rb
|
58
|
+
- test/test_sphincter_search_stub.rb
|
59
|
+
rdoc_options:
|
60
|
+
- --main
|
61
|
+
- README.txt
|
62
|
+
extra_rdoc_files:
|
63
|
+
- History.txt
|
64
|
+
- LICENSE.txt
|
65
|
+
- Manifest.txt
|
66
|
+
- README.txt
|
67
|
+
executables: []
|
68
|
+
|
69
|
+
extensions: []
|
70
|
+
|
71
|
+
requirements: []
|
72
|
+
|
73
|
+
dependencies:
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: rake
|
76
|
+
version_requirement:
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.7.3
|
82
|
+
version:
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
version_requirement:
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.2.3
|
91
|
+
version:
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: hoe
|
94
|
+
version_requirement:
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.2.2
|
100
|
+
version:
|