dusen 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,11 +7,16 @@ task :default => 'all:spec'
7
7
  namespace :travis_ci do
8
8
 
9
9
  desc 'Things to do before Travis CI begins'
10
- task :prepare do
10
+ task :prepare => :slimgems do
11
11
  Rake::Task['travis_ci:create_database'].invoke &&
12
12
  Rake::Task['travis_ci:create_database_yml'].invoke
13
13
  end
14
14
 
15
+ desc 'Install slimgems'
16
+ task :slimgems do
17
+ system('gem install slimgems')
18
+ end
19
+
15
20
  desc 'Creates a test database'
16
21
  task :create_database do
17
22
  system("mysql -e 'create database dusen_test;'")
@@ -10,7 +10,7 @@ module Dusen
10
10
  Dusen::Description.parse_syntax(@search_syntax, &dsl) if dsl
11
11
  unless singleton_class.method_defined?(:search)
12
12
  singleton_class.send(:define_method, :search) do |query_string|
13
- @search_syntax.search(self, query_string)
13
+ @search_syntax.search(scoped({}), query_string)
14
14
  end
15
15
  end
16
16
  @search_syntax
data/lib/dusen/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Dusen
4
- VERSION = '0.4.4'
4
+ VERSION = '0.4.5'
5
5
  end
@@ -6,6 +6,7 @@ gem 'rspec-rails', '~>1.3'
6
6
  gem 'mysql2', '~>0.2.0'
7
7
  gem 'ruby-debug', :platforms => :ruby_18
8
8
  gem 'test-unit', '~>1.2', :platforms => :ruby_19
9
+ gem 'hoe', '=2.8.0', :platforms => :ruby_19
9
10
  gem 'database_cleaner'
10
11
  gem 'andand'
11
12
 
@@ -70,7 +70,22 @@ shared_examples_for 'model with search syntax' do
70
70
  it 'should distinguish between "Baden" and "Baden-Baden" (bugfix)' do
71
71
  match = subject.create!(:city => 'Baden-Baden')
72
72
  no_match = subject.create!(:city => 'Baden')
73
- subject.search('Baden-Baden').all.should == [match]
73
+ subject.search('Baden-Baden').to_a.should == [match]
74
+ end
75
+
76
+ context 'when the given query is blank' do
77
+
78
+ it 'returns all records' do
79
+ match = subject.create!
80
+ subject.search('').to_a.should == [match]
81
+ end
82
+
83
+ it 'respects an existing scope chain' do
84
+ match = subject.create!(:name => 'Abraham')
85
+ no_match = subject.create!(:name => 'Elizabath')
86
+ subject.scoped(:conditions => { :name => 'Abraham' }).search('').to_a.should == [match]
87
+ end
88
+
74
89
  end
75
90
 
76
91
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dusen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-15 00:00:00 Z
18
+ date: 2013-05-17 00:00:00 +02:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rails
@@ -132,6 +133,7 @@ files:
132
133
  - spec/shared/spec/dusen/parser_spec.rb
133
134
  - spec/shared/spec/dusen/query_spec.rb
134
135
  - spec/shared/spec/dusen/util_spec.rb
136
+ has_rdoc: true
135
137
  homepage: https://github.com/makandra/dusen
136
138
  licenses: []
137
139
 
@@ -161,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
163
  requirements: []
162
164
 
163
165
  rubyforge_project:
164
- rubygems_version: 1.8.25
166
+ rubygems_version: 1.3.9.5
165
167
  signing_key:
166
168
  specification_version: 3
167
169
  summary: Comprehensive full text search for ActiveRecord and MySQL