Sha256: 9d3c31b634c546f55e4651844c559ab812ed511e928eeee2d72b560a278d8c53
Contents?: true
Size: 939 Bytes
Versions: 3
Compression:
Stored size: 939 Bytes
Contents
require 'spec_helper' describe ::Trax::Model::Restorable do subject{ ::Message.create(:title => "Whatever") } its(:deleted) { should be false } context "when destroyed" do it "should soft delete" do subject.destroy subject.deleted.should be true end it "should be restorable" do subject.destroy subject.restore subject.deleted.should be false end end context "scopes" do subject{ ::Message.create(:title => "My Message") } context ".default_scope" do it { Message.all.where_values_hash["deleted"].should eq false } it do subject Message.all.pluck(:id).should include(subject.id) end it do subject.destroy Message.all.pluck(:id).should_not include(subject.id) end end it ".by_is_deleted" do subject.destroy Message.by_is_deleted.pluck(:id).should include(subject.id) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trax_model-0.0.93 | spec/trax/model/restorable_spec.rb |
trax_model-0.0.92 | spec/trax/model/restorable_spec.rb |
trax_model-0.0.91 | spec/trax/model/restorable_spec.rb |