spec/versioned_spec.rb in dm-is-versioned-0.10.2 vs spec/versioned_spec.rb in dm-is-versioned-1.0.0.rc1
- old
+ new
@@ -17,12 +17,14 @@
end
is_versioned :on => :updated_at
end
-if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
- describe 'DataMapper::Is::Versioned' do
+describe 'DataMapper::Is::Versioned' do
+
+ supported_by :sqlite, :mysql, :postgres do
+
describe 'inner class' do
it 'should be present' do
Story::Version.should be_a_kind_of(DataMapper::Model)
end
@@ -37,39 +39,34 @@
end
end
describe '#create' do
before :all do
- Story.auto_migrate!
Story.create(:title => 'A Very Interesting Article')
end
it 'should not create a versioned copy' do
Story::Version.all.size.should == 0
end
end
describe '#save' do
- before :all do
- Story.auto_migrate!
- end
-
describe '(with new resource)' do
before :all do
@story = Story.new(:title => 'A Story')
- @story.save
+ @story.save.should be(true)
end
it 'should not create a versioned copy' do
Story::Version.all.size.should == 0
end
end
describe '(with a clean existing resource)' do
before :all do
@story = Story.create(:title => 'A Story')
- @story.save
+ @story.save.should be(true)
end
it 'should not create a versioned copy' do
Story::Version.all.size.should == 0
end
@@ -78,11 +75,11 @@
describe '(with a dirty existing resource)' do
before :all do
@story = Story.create(:title => 'A Story')
@story.title = 'An Inner Update'
@story.title = 'An Updated Story'
- @story.save
+ @story.save.should be(true)
end
it 'should create a versioned copy' do
Story::Version.all.size.should == 1
end
@@ -98,12 +95,12 @@
end
end
describe '#versions' do
before :all do
- Story.auto_migrate!
@story = Story.create(:title => 'A Story')
+ @story.should be_saved
end
it 'should return an empty array when there are no versions' do
@story.versions.should == []
end
@@ -113,11 +110,13 @@
end
it "should not return another object's versions" do
@story2 = Story.create(:title => 'A Different Story')
@story2.title = 'A Different Title'
- @story2.save
+ @story2.save.should be(true)
@story.versions.should == Story::Version.all(:id => @story.id)
end
end
+
end
+
end