/
sample_migration_spec.rb
34 lines (27 loc) · 1.02 KB
/
sample_migration_spec.rb
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
require File.dirname(__FILE__) + '/sample_migration'
require File.dirname(__FILE__) + '/../lib/spec/example/migration_example_group'
describe :create_people_table, :type => :migration do
before do
run_migration
end
it 'should create a people table' do
repository(:default).should have_table(:people)
end
it 'should have an id column as the primary key' do
table(:people).should have_column(:id)
table(:people).column(:id).type.should == 'int'
table(:people).column(:id).should be_primary_key
end
it 'should have a name column as a string' do
puts table(:people).inspect
puts query("PRAGMA table_info(people)")
table(:people).should have_column(:name)
table(:people).column(:name).type.should == 'string'
table(:people).column(:name).should_not permit_null
end
it 'should have a nullable age column as a int' do
table(:people).should have_column(:age)
table(:people).column(:age).type.should == 'int'
table(:people).column(:age).should_not permit_null
end
end