spec/integration/constraints_spec.rb in dm-constraints-1.0.0.rc2 vs spec/integration/constraints_spec.rb in dm-constraints-1.0.0.rc3
- old
+ new
@@ -90,16 +90,16 @@
@other_article = Article.create(:title => 'Dolly cloned')
@revision = Revision.create(:text => 'Riveting!', :article => @other_article)
end
it 'should destroy the parent if there are no children in the association' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
it 'the child should be destroyable' do
- @revision.destroy.should be_true
+ @revision.destroy.should be(true)
@revision.model.get(*@revision.key).should be_nil
end
end
describe 'constraint options' do
@@ -110,16 +110,16 @@
@other_author = Author.create(:first_name => 'Joe', :last_name => 'Smith')
@comment = @other_author.comments.create(:body => 'So true!', :article => @article)
end
it 'should destroy the parent if there are no children in the association' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should not destroy the parent if there are children in the association' do
- @other_author.destroy.should be_false
+ @other_author.destroy.should be(false)
@other_author.model.get(*@other_author.key).should_not be_nil
end
end
describe 'when :constraint => :protect is given' do
@@ -150,16 +150,16 @@
@article = Article.create(:title => 'Man on the Moon')
@revision = Revision.create(:text => 'Riveting!', :article => @article)
end
it 'should not destroy the parent if there are children in the association' do
- @article.destroy.should be_false
+ @article.destroy.should be(false)
@article.model.get(*@article.key).should_not be_nil
end
it 'the child should be destroyable' do
- @revision.destroy.should be_true
+ @revision.destroy.should be(true)
@revision.model.get(*@revision.key).should be_nil
end
end
describe 'one-to-many associations' do
@@ -169,20 +169,20 @@
@another_author = Author.create(:first_name => 'Joe', :last_name => 'Smith')
@comment = @another_author.comments.create(:body => 'So true!', :article => @article)
end
it 'should destroy the parent if there are no children in the association' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should not destroy the parent if there are children in the association' do
- @another_author.destroy.should be_false
+ @another_author.destroy.should be(false)
end
it 'the child should be destroyable' do
- @comment.destroy.should be_true
+ @comment.destroy.should be(true)
@comment.model.get(*@comment.key).should be_nil
end
end
describe 'many-to-many associations' do
@@ -195,22 +195,22 @@
@another_author = Author.create(:first_name => 'Joe', :last_name => 'Smith')
@article = Article.create(:title => 'Man on the Moon', :authors => [ @author ])
end
it 'should destroy the parent if there are no children in the association' do
- @another_author.destroy.should be_true
+ @another_author.destroy.should be(true)
@another_author.model.get(*@another_author.key).should be_nil
end
it 'should not destroy the parent if there are children in the association' do
@author.articles.should_not == []
- @author.destroy.should be_false
+ @author.destroy.should be(false)
end
it 'the child should be destroyable' do
@article.authors.clear
- @article.save.should be_true
+ @article.save.should be(true)
@article.authors.should be_empty
end
end
end
@@ -242,22 +242,22 @@
@article = Article.create(:title => 'Man on the Moon')
@revision = Revision.create(:text => 'Riveting!', :article => @article)
end
it 'should let the parent to be destroyed' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
it 'should destroy the children' do
revision = @article.revision
- @article.destroy.should be_true
+ @article.destroy.should be(true)
revision.model.get(*revision.key).should be_nil
end
it 'the child should be destroyable' do
- @revision.destroy.should be_true
+ @revision.destroy.should be(true)
@revision.model.get(*@revision.key).should be_nil
end
end
describe 'one-to-many associations' do
@@ -267,21 +267,21 @@
@comment = @author.comments.create(:body => 'So true!', :article => @article)
@another_comment = @author.comments.create(:body => 'Nice comment', :article => @article)
end
it 'should let the parent to be destroyed' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should destroy the children' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.comments.all? { |comment| comment.should be_new }
end
it 'the child should be destroyable' do
- @comment.destroy.should be_true
+ @comment.destroy.should be(true)
@comment.model.get(*@comment.key).should be_nil
end
end
describe 'many-to-many associations' do
@@ -294,22 +294,22 @@
@other_article = Article.create(:title => 'Dolly cloned')
@author = Author.create(:first_name => 'John', :last_name => 'Doe', :articles => [ @article, @other_article ])
end
it 'should let the parent to be destroyed' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should destroy the children' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
@other_article.model.get(*@other_article.key).should be_nil
end
it 'the child should be destroyable' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
end
end
@@ -341,22 +341,22 @@
@article = Article.create(:title => 'Man on the Moon')
@revision = Revision.create(:text => 'Riveting!', :article => @article)
end
it 'should let the parent to be destroyed' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
it 'should destroy the children' do
revision = @article.revision
- @article.destroy.should be_true
+ @article.destroy.should be(true)
revision.model.get(*revision.key).should be_nil
end
it 'the child should be destroyable' do
- @revision.destroy.should be_true
+ @revision.destroy.should be(true)
@revision.model.get(*@revision.key).should be_nil
end
end
describe 'one-to-many associations' do
@@ -366,21 +366,21 @@
@comment = @author.comments.create(:body => 'So true!', :article => @article)
@other_comment = @author.comments.create(:body => "That's nonsense", :article => @article)
end
it 'should let the parent to be destroyed' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should destroy the children' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.comments.all? { |comment| comment.should be_new }
end
it 'the child should be destroyable' do
- @comment.destroy.should be_true
+ @comment.destroy.should be(true)
@comment.model.get(*@comment.key).should be_nil
end
end
describe 'many-to-many associations' do
@@ -393,19 +393,19 @@
@other_article = Article.create(:title => 'Dolly cloned')
@author = Author.create(:first_name => 'John', :last_name => 'Doe', :articles => [ @article, @other_article ])
end
it 'should destroy the parent and the children, too' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
@article.model.get(*@article.key).should be_nil
@other_article.model.get(*@other_article.key).should be_nil
end
it 'the child should be destroyable' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
end
end
@@ -438,23 +438,23 @@
@article = Article.create(:title => 'Man on the Moon')
@revision = Revision.create(:text => 'Riveting!', :article => @article)
end
it 'should let the parent to be destroyed' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
it "should set the child's foreign_key id to nil" do
revision = @article.revision
- @article.destroy.should be_true
+ @article.destroy.should be(true)
revision.article.should be_nil
revision.model.get(*revision.key).article.should be_nil
end
it 'the child should be destroyable' do
- @revision.destroy.should be_true
+ @revision.destroy.should be(true)
@revision.model.get(*@revision.key).should be_nil
end
end
describe 'one-to-many associations' do
@@ -463,24 +463,24 @@
@comment = @author.comments.create(:body => 'So true!')
@other_comment = @author.comments.create(:body => "That's nonsense")
end
it 'should let the parent to be destroyed' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should set the foreign_key ids of children to nil' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.comments.all? { |comment| comment.author.should be_nil }
end
it 'the children should be destroyable' do
- @comment.destroy.should be_true
+ @comment.destroy.should be(true)
@comment.model.get(*@comment.key).should be_nil
- @other_comment.destroy.should be_true
+ @other_comment.destroy.should be(true)
@other_comment.model.get(*@other_comment.key).should be_nil
end
end
end
@@ -512,21 +512,21 @@
@article = Article.create(:title => 'Man on the Moon')
@revision = Revision.create(:text => 'Riveting!', :article => @article)
end
it 'should let the parent be destroyed' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
it 'should let the children become orphan records' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@revision.model.get(*@revision.key).article.should be_nil
end
it 'the child should be destroyable' do
- @revision.destroy.should be_true
+ @revision.destroy.should be(true)
@revision.model.get(*@revision.key).should be_nil
end
end
describe 'one-to-many associations' do
@@ -536,23 +536,23 @@
@comment = @author.comments.create(:body => 'So true!', :article => @article)
@other_comment = @author.comments.create(:body => "That's nonsense", :article => @article)
end
it 'should let the parent to be destroyed' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@author.model.get(*@author.key).should be_nil
end
it 'should let the children become orphan records' do
- @author.destroy.should be_true
+ @author.destroy.should be(true)
@comment.model.get(*@comment.key).author.should be_nil
@other_comment.model.get(*@other_comment.key).author.should be_nil
end
it 'the children should be destroyable' do
- @comment.destroy.should be_true
- @other_comment.destroy.should be_true
+ @comment.destroy.should be(true)
+ @other_comment.destroy.should be(true)
@other_comment.model.get(*@other_comment.key).should be_nil
end
end
describe 'many-to-many associations' do
@@ -565,10 +565,10 @@
@other_article = Article.create(:title => 'Dolly cloned')
@author = Author.create(:first_name => 'John', :last_name => 'Doe', :articles => [ @article, @other_article ])
end
it 'the children should be destroyable' do
- @article.destroy.should be_true
+ @article.destroy.should be(true)
@article.model.get(*@article.key).should be_nil
end
end
end