0
@@ -8,7 +8,7 @@ if ADAPTER
0
class Impostor < DataMapper::Type
0
include DataMapper::Resource
0
@@ -118,13 +118,13 @@ if ADAPTER
0
lemon.deleted_at.should be_kind_of(DateTime)
0
repository(ADAPTER) do |repository|
0
Lemon.all.should be_empty
0
Lemon.get(lemon.id).should be_nil
0
it "should provide access to paranoid items with DateTime" do
0
Lemon.auto_migrate!(ADAPTER)
0
@@ -134,26 +134,26 @@ if ADAPTER
0
%w(red green yellow blue).each do |color|
0
Lemon.create(:color => color)
0
Lemon.all.size.should == 4
0
Lemon.all.size.should == 3
0
Lemon.with_deleted{Lemon.all.size.should == 1}
0
it "should set paranoid datetime to a date time" do
0
tmp = (DateTime.now - 0.5)
0
DateTime.stub!(:now).and_return(tmp)
0
repository(ADAPTER) do |repository|
0
lemon.deleted_at.should == tmp
0
it "should respect paranoia with a boolean" do
0
@@ -176,7 +176,7 @@ if ADAPTER
0
Lime.get(lime.id).should be_nil
0
it "should provide access to paranoid items with Boolean" do
0
Lime.auto_migrate!(ADAPTER)
0
@@ -186,18 +186,18 @@ if ADAPTER
0
%w(red green yellow blue).each do |color|
0
Lime.create(:color => color)
0
Lime.all.size.should == 4
0
Lime.all.size.should == 3
0
Lime.with_deleted{Lime.all.size.should == 1}
0
describe "paranoid types across repositories" do
0
DataMapper::Repository.adapters[:alternate_paranoid] = repository(ADAPTER).adapter.dup
0
include DataMapper::Resource
0
@@ -213,26 +213,26 @@ if ADAPTER
0
property :deleted_at, DataMapper::Types::ParanoidDateTime
0
repository(:alternate_paranoid){Orange.auto_migrate!}
0
%w(red orange blue green).each{|color| o = Orange.create(:color => color)}
0
Orange.repository.adapter.execute("DELETE FROM oranges")
0
it "should setup the correct objects for the spec" do
0
repository(:alternate_paranoid){Orange.all.should have(4).items}
0
it "should allow access the the default repository" do
0
Orange.all.should have(4).items
0
it "should mark the objects as deleted in the alternate_paranoid repository" do
0
repository(:alternate_paranoid) do
0
@@ -240,31 +240,31 @@ if ADAPTER
0
Orange.find_by_sql("SELECT * FROM oranges").should have(4).items
0
it "should mark the objects as deleted in the alternate_paranoid repository but ignore it in the #{ADAPTER} repository" do
0
repository(:alternate_paranoid) do
0
Orange.all.should have(4).items
0
it "should raise an error when trying to destroy from a repository that is not paranoid" do
0
end.should raise_error(ArgumentError)
0
it "should set all paranoid attributes on delete" do
0
repository(:alternate_paranoid) do
0
orange.deleted.should be_false
0
orange.deleted_at.should be_nil
0
orange.deleted.should be_true
0
orange.deleted_at.should be_a_kind_of(DateTime)
Comments
No one has commented yet.