· 8 years ago · Feb 20, 2018, 11:14 PM
1diff --git a/spec/fixtures/data.sql b/spec/fixtures/data.sql
2index 3baaf35..a1ead87 100644
3--- a/spec/fixtures/data.sql
4+++ b/spec/fixtures/data.sql
5@@ -1023,3 +1023,7 @@ insert into `animals` (name, type) values ('nat', 'Cat');
6 insert into `animals` (name, type) values ('molly', 'Cat');
7 insert into `animals` (name, type) values ('jasper', 'Cat');
8 insert into `animals` (name, type) values ('moggy', 'Cat');
9+insert into `cities` (name, zip) values ('Jackson', 49201);
10+insert into `cities` (name, zip) values ('Rives.', 49201);
11+insert into `cities` (name, zip) values ('Hillsdale', 49201);
12+insert into `cities` (name, zip) values ('Jackson', 49277);
13diff --git a/spec/fixtures/models.rb b/spec/fixtures/models.rb
14index b63c7a7..8bf3e73 100644
15--- a/spec/fixtures/models.rb
16+++ b/spec/fixtures/models.rb
17@@ -80,4 +80,12 @@ end
18
19 class Cat < Animal
20 #
21-end
22\ No newline at end of file
23+end
24+
25+class City < ActiveRecord::Base
26+ define_index do
27+ indexes :name
28+ has :zip
29+ set_property :delta => true
30+ end
31+end
32diff --git a/spec/fixtures/structure.sql b/spec/fixtures/structure.sql
33index 8e4f4b0..9f4e06c 100644
34--- a/spec/fixtures/structure.sql
35+++ b/spec/fixtures/structure.sql
36@@ -83,4 +83,14 @@ CREATE TABLE `animals` (
37 `type` varchar(50) NOT NULL,
38 `delta` tinyint(1) NOT NULL DEFAULT 0,
39 PRIMARY KEY (`id`)
40-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
41\ No newline at end of file
42+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
43+
44+DROP TABLE IF EXISTS `cities`;
45+
46+CREATE TABLE `cities` (
47+ `id` int(11) NOT NULL auto_increment,
48+ `name` varchar(50) NOT NULL,
49+ `zip` int(11) NOT NULL,
50+ `delta` tinyint(1) NOT NULL DEFAULT 0,
51+ PRIMARY KEY (`id`)
52+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
53diff --git a/spec/unit/thinking_sphinx/search_spec.rb b/spec/unit/thinking_sphinx/search_spec.rb
54index d6cb1eb..203f93c 100644
55--- a/spec/unit/thinking_sphinx/search_spec.rb
56+++ b/spec/unit/thinking_sphinx/search_spec.rb
57@@ -200,4 +200,16 @@ describe ThinkingSphinx::Search do
58
59 Beta.search("two").should be_empty
60 end
61+
62+ it "should have three items with the 49201 zip in the db" do
63+ City.search(:with => {:zip => 49201}).total_entries.should == 3
64+ end
65+
66+ it "should still have three items with 49201 if we update another attribute" do
67+ record = City.search(:with => {:zip => 49201}).first
68+ record.update_attributes(:name => "Horton")
69+ City.search(:with => {:zip => 49201}).total_entries.should == 3
70+ end
71+
72+
73 end