Skip to content

Commit

Permalink
[dm-is-versioned] add some specs to verify DataMapper.auto_migrate! b…
Browse files Browse the repository at this point in the history
…ehaviour on version class

[#656 state:resolved]
  • Loading branch information
jamie authored and Dan Kubb committed Mar 7, 2009
1 parent c94166c commit 7fea15f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions dm-is-versioned/spec/versioned_spec.rb
Expand Up @@ -18,6 +18,35 @@ class Story
end

if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
describe 'DataMapper' do
describe "#auto_migrate!" do
before do
# I *think* AutoMigrator breaks toplevel auto_migrate
# into two calls to reduce redundancy, so auto_migrate!
# never actually gets called on decendents after a
# DataMapper.auto_migrate! call.
Story::Version.should_receive(:auto_migrate_down!)
Story::Version.should_receive(:auto_migrate_up!)
end
it "should get called on a versioned inner class" do
DataMapper.auto_migrate!
end
end # #auto_migrate!

describe "#auto_upgrade!" do
before do
# AutoMigrator collects all descendents, triggering once
# but triggers a second time after Story gets upgraded.
# Since it's non-destructive, shouldn't matter that it
# gets called twice though.
Story::Version.should_receive(:auto_upgrade!).twice
end
it "should get called on a versioned inner class" do
DataMapper.auto_upgrade!
end
end # #auto_upgrade!
end

describe 'DataMapper::Is::Versioned' do
describe "inner class" do
it "should be present" do
Expand Down

0 comments on commit 7fea15f

Please sign in to comment.