public
Description: All the extra stuff you could want for the Mack Framework.
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack-more.git
mack-more / mack-active_record / spec / lib / db_migrations_spec.rb
100644 67 lines (67 sloc) 2.078 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# require 'pathname'
# require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
#
# describe Mack::Database::Migrations do
#
# class Zoo
# include DataMapper::Resource
#
# property :id, Serial
# property :name, String
# property :description, Text
# property :created_at, DateTime
# property :updated_at, DateTime
# end
#
# class Animal
# include DataMapper::Resource
#
# property :id, Serial
# end
#
# before(:each) do
# Mack::Database.recreate
# FileUtils.rm_rf(Mack::Paths.migrations)
# FileUtils.mkdir_p(Mack::Paths.migrations)
# File.open(Mack::Paths.migrations("001_create_zoos.rb"), "w") {|f| f.puts fixture("create_zoos.rb")}
# end
#
# after(:each) do
# FileUtils.rm_rf(Mack::Paths.migrations)
# end
#
# describe "migrate" do
#
# it "should migrate the database with the migrations in the db/migrations folder" do
# Zoo.should_not be_storage_exists
# Mack::Database::Migrations.migrate
# Zoo.should be_storage_exists
# end
#
# end
#
# describe "rollback" do
#
# it "should rollback the database by a default of 1 step" do
# Zoo.should_not be_storage_exists
# Mack::Database::Migrations.migrate
# Zoo.should be_storage_exists
# Mack::Database::Migrations.rollback
# Zoo.should_not be_storage_exists
# end
#
# it "should rollback the database by n steps if ENV['STEP'] is set" do
# Zoo.should_not be_storage_exists
# Animal.should_not be_storage_exists
# File.open(Mack::Paths.migrations("002_create_animals.rb"), "w") {|f| f.puts fixture("create_animals.rb")}
# Mack::Database::Migrations.migrate
# Zoo.should be_storage_exists
# Animal.should be_storage_exists
# Mack::Database::Migrations.rollback(2)
# Zoo.should_not be_storage_exists
# Animal.should_not be_storage_exists
# end
#
# end
#
# end