spec/acceptance/resque_deltas_spec.rb in ts-resque-delta-2.0.0 vs spec/acceptance/resque_deltas_spec.rb in ts-resque-delta-2.1.0
- old
+ new
@@ -1,50 +1,46 @@
require 'acceptance/spec_helper'
describe 'SQL delta indexing', :live => true do
- def sleep_for_sphinx
- sleep ENV['CI'] ? 1.0 : 0.25
- end
-
it "automatically indexes new records" do
guards = Book.create(
:title => 'Guards! Guards!', :author => 'Terry Pratchett'
)
index
- Book.search('Terry Pratchett').to_a.should == [guards]
+ expect(Book.search('Terry Pratchett').to_a).to eq([guards])
men = Book.create(
:title => 'Men At Arms', :author => 'Terry Pratchett'
)
work
- sleep_for_sphinx
+ sleep 0.25
- Book.search('Terry Pratchett').to_a.should == [guards, men]
+ expect(Book.search('Terry Pratchett').to_a).to eq([guards, men])
end
it "automatically indexes updated records" do
book = Book.create :title => 'Night Watch', :author => 'Harry Pritchett'
index
- Book.search('Harry').to_a.should == [book]
+ expect(Book.search('Harry').to_a).to eq([book])
- book.reload.update_attributes(:author => 'Terry Pratchett')
+ book.reload.update(:author => 'Terry Pratchett')
work
- sleep_for_sphinx
+ sleep 0.25
- Book.search('Terry').to_a.should == [book]
+ expect(Book.search('Terry').to_a).to eq([book])
end
it "does not match on old values" do
book = Book.create :title => 'Night Watch', :author => 'Harry Pritchett'
index
- Book.search('Harry').to_a.should == [book]
+ expect(Book.search('Harry').to_a).to eq([book])
- book.reload.update_attributes(:author => 'Terry Pratchett')
+ book.reload.update(:author => 'Terry Pratchett')
work
- sleep_for_sphinx
+ sleep 0.25
- Book.search('Harry').should be_empty
+ expect(Book.search('Harry')).to be_empty
end
end