spec/functional/backends/file_spec.rb in picky-4.27.1 vs spec/functional/backends/file_spec.rb in picky-4.28.1
- old
+ new
@@ -5,11 +5,11 @@
# Describes a Picky index that uses the File backend
# for data storage.
#
describe Picky::Backends::File do
- class Book
+ class PoetryBook
attr_reader :id, :title, :author
def initialize id, title, author
@id, @title, @author = id, title, author
end
end
@@ -42,30 +42,30 @@
data.remove 1
books.search('title').ids.should == []
end
it 'handles removing with more than one entry' do
- data.add Book.new(2, 'title', 'author')
+ data.add PoetryBook.new(2, 'title', 'author')
books.search('title').ids.should == ['2', '1']
data.remove '1'
books.search('title').ids.should == ['2']
end
it 'handles removing with three entries' do
- data.add Book.new(2, 'title', 'author')
- data.add Book.new(3, 'title', 'author')
+ data.add PoetryBook.new(2, 'title', 'author')
+ data.add PoetryBook.new(3, 'title', 'author')
books.search('title').ids.should == ['3', '2', '1']
data.remove '1'
books.search('title').ids.should == ['3', '2']
end
it 'handles replacing' do
- data.replace Book.new(1, 'toitle', 'oithor')
+ data.replace PoetryBook.new(1, 'toitle', 'oithor')
books.search('title').ids.should == []
books.search('toitle').ids.should == ['1']
end
it 'handles clearing' do
@@ -98,30 +98,30 @@
data.remove 1
books.search('title').ids.should == []
end
it 'handles removing with more than one entry' do
- data.add Book.new(2, 'title', 'author')
+ data.add PoetryBook.new(2, 'title', 'author')
books.search('title').ids.should == [2, 1]
data.remove 1
books.search('title').ids.should == [2]
end
it 'handles removing with three entries' do
- data.add Book.new(2, 'title', 'author')
- data.add Book.new(3, 'title', 'author')
+ data.add PoetryBook.new(2, 'title', 'author')
+ data.add PoetryBook.new(3, 'title', 'author')
books.search('title').ids.should == [3, 2, 1]
data.remove 1
books.search('title').ids.should == [3, 2]
end
it 'handles replacing' do
- data.replace Book.new(1, 'toitle', 'oithor')
+ data.replace PoetryBook.new(1, 'toitle', 'oithor')
books.search('title').ids.should == []
books.search('toitle').ids.should == [1]
end
it 'handles clearing' do
@@ -142,11 +142,11 @@
before(:each) do
data.key_format :to_s
data.backend described_class.new
data.clear
- data.add Book.new(1, 'title', 'author')
+ data.add PoetryBook.new(1, 'title', 'author')
end
instance_eval &its_to_s
end
end
@@ -155,10 +155,10 @@
before(:each) do
data.key_format :to_i
data.backend described_class.new
data.clear
- data.add Book.new(1, 'title', 'author')
+ data.add PoetryBook.new(1, 'title', 'author')
end
instance_eval &its_to_i
end
end
\ No newline at end of file