mover 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,80 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe Mover::Base::Table do
4
-
5
- before(:all) do
6
- $db.migrate(1)
7
- $db.migrate(0)
8
- $db.migrate(1)
9
- end
10
-
11
- describe :create_movable_table do
12
-
13
- before(:all) do
14
- @article_columns = connection.columns("articles").collect(&:name)
15
- @archive_columns = connection.columns("articles_archive").collect(&:name)
16
- end
17
-
18
- it "should create an archive table" do
19
- connection.table_exists?("articles_archive").should == true
20
- end
21
-
22
- it "should create an archive table with the same structure as the original table" do
23
- @article_columns.each do |col|
24
- @archive_columns.include?(col).should == true
25
- end
26
- end
27
-
28
- describe 'with options' do
29
-
30
- before(:all) do
31
- Article.drop_movable_table(:archive)
32
- Article.create_movable_table(
33
- :archive,
34
- :columns => %w(id read),
35
- :indexes => %w(read)
36
- )
37
- @archive_columns = connection.columns("articles_archive").collect(&:name)
38
- end
39
-
40
- after(:all) do
41
- Article.drop_movable_table(:archive)
42
- Article.create_movable_table(:archive)
43
- end
44
-
45
- it "should create the correct columns" do
46
- @archive_columns.length.should == 2
47
- %w(id read).each do |col|
48
- @archive_columns.include?(col).should == true
49
- end
50
- end
51
-
52
- it "should create archive indexes" do
53
- indexes = Article.send(:indexed_columns, 'articles_archive')
54
- indexes.to_set.should == [ "read" ].to_set
55
- end
56
- end
57
-
58
- describe 'without options' do
59
-
60
- it "should create archive indexes" do
61
- indexes = Article.send(:indexed_columns, 'articles_archive')
62
- indexes.to_set.should == [ "id", "title" ].to_set
63
- end
64
- end
65
- end
66
-
67
- describe :drop_movable_table do
68
-
69
- it "should drop the table" do
70
- Article.drop_movable_table(:archive)
71
- output = connection.execute(<<-SQL)
72
- SELECT COUNT(*)
73
- FROM information_schema.tables
74
- WHERE table_schema = '#{Article.configurations['test']['database']}'
75
- AND table_name = 'articles_archive';
76
- SQL
77
- output.fetch_row.should == ['0']
78
- end
79
- end
80
- end