Sha256: 054495547a209827f890c825385a92c4441f0c4313d098450e76487963abc593
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
require 'test_helper' class MongrationsTest < ActiveSupport::TestCase context "A valid MongoMapper connection" do setup do @path = File.join("test", "mongrations") @version = "20101125020919" end context "with a valid database" do context "with a pending migration" do should "migrate up to a given version" do Widget.create(:name => "Sparkling Wizzles", :price => 100) Widget.first.price.should == 100 Mongrations::Migrator.run(:up, @path, @version) Widget.first.price.should == 200 end should "run all pending migrations" do Widget.create(:name => "Sparkling Wizzles", :price => 100) Widget.first.price.should == 100 Mongrations::Migrator.migrate(@path, nil) Widget.first.price.should == 200 end end should "run a migration:down" do Widget.create(:name => "Sparkling Wizzles", :price => 100) Widget.first.price.should == 100 Mongrations::Migrator.migrate(@path, nil) Widget.first.price.should == 200 Mongrations::Migrator.run(:down, @path, @version) Widget.first.price.should == 100 end should "run a migration rollback" do Widget.create(:name => "Sparkling Wizzles", :price => 100) Widget.first.price.should == 100 Mongrations::Migrator.migrate(@path, nil) Widget.first.price.should == 200 Mongrations::Migrator.rollback(@path, 1) Widget.first.price.should == 100 end should "not run a migration more than once" do Widget.create(:name => "Sparkling Wizzles", :price => 100) Widget.first.price.should == 100 Mongrations::Migrator.migrate(@path, nil) Widget.first.price.should == 200 Mongrations::Migrator.migrate(@path, nil) Widget.first.price.should == 200 end end teardown do # Not gonna remove it. For now. # MongoMapper.connection.drop_database "mongrations_test" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
leifcr-mongrations-0.1.7 | test/mongrations_test.rb |