mv-test 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/migration_validators/spec/matchers/db_matchers.rb +14 -3
- data/lib/migration_validators/spec/support/column_wrapper.rb +4 -4
- metadata +69 -97
- data/spec/migration_validators/spec/macros/db_macros_spec.rb +0 -25
- data/spec/migration_validators/spec/matchers/db_matchers_spec.rb +0 -37
- data/spec/migration_validators/spec/support/column_wrapper_spec.rb +0 -148
- data/spec/migration_validators/spec/support/db_spec.rb +0 -56
- data/spec/migration_validators/spec/support/table_wrapper_spec.rb +0 -20
- data/spec/migration_validators/spec/support/test_adapter_spec.rb +0 -4
- data/spec/mv-test_spec.rb +0 -4
- data/spec/spec_helper.rb +0 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aeae238d16f9f9a02bd1d58677b7eced19b1e2b7
|
4
|
+
data.tar.gz: 6d5640e0ac075f20872806c6a195041e0875360b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f659fcaf529b5f12a3e5074ce1dde1296d98f2dfbef11f0a04213e451b3b684ac00bb30135c6ad8ad6c5d02f2cf41c57cd6e53a309e8ac32d42d8501d84ed964
|
7
|
+
data.tar.gz: 751c434dcea9a931b39c8decf72a366b4a37fd79cb1b55c4eb8e28dcfa66d8341029adca468a7d3bf439f21741db34b97ab13c70c38e1b9fb26dac293057e13d
|
@@ -103,7 +103,7 @@ module MigrationValidators
|
|
103
103
|
def matches? column_wrapper
|
104
104
|
column_wrapper.insert(@initial) if @initial
|
105
105
|
|
106
|
-
|
106
|
+
MigrationValidators::Spec::Support::ColumnWrapper.to_array(values).each do |value|
|
107
107
|
passed = true
|
108
108
|
|
109
109
|
if insert?
|
@@ -154,6 +154,12 @@ module MigrationValidators
|
|
154
154
|
super && exception && exception.message =~ /#{message}/
|
155
155
|
end
|
156
156
|
|
157
|
+
def description
|
158
|
+
compose_message do |operations_name, elements_name, last_message, expected_message|
|
159
|
+
"expected that operation #{operations_name} would fail for #{elements_name} from #{values} #{expected_message}"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
157
163
|
|
158
164
|
def failure_message
|
159
165
|
compose_message do |operations_name, elements_name, last_message, expected_message|
|
@@ -161,7 +167,7 @@ module MigrationValidators
|
|
161
167
|
end
|
162
168
|
end
|
163
169
|
|
164
|
-
def
|
170
|
+
def failure_message_when_negated
|
165
171
|
compose_message do |operations_name, elements_name, last_message, expected_message|
|
166
172
|
"not expected that operation #{operations_name} would fail for #{elements_name} from #{values} #{expected_message}. But it happened with #{last_operation} on '#{last_value}'"
|
167
173
|
end
|
@@ -174,6 +180,11 @@ module MigrationValidators
|
|
174
180
|
super && exception.blank?
|
175
181
|
end
|
176
182
|
|
183
|
+
def description
|
184
|
+
compose_message do |operations_name, elements_name, last_message, expected_message|
|
185
|
+
"expected that operation #{operations_name} would success for #{elements_name} from #{values}"
|
186
|
+
end
|
187
|
+
end
|
177
188
|
|
178
189
|
def failure_message
|
179
190
|
compose_message do |operations_name, elements_name, last_message, expected_message|
|
@@ -181,7 +192,7 @@ module MigrationValidators
|
|
181
192
|
end
|
182
193
|
end
|
183
194
|
|
184
|
-
def
|
195
|
+
def failure_message_when_negated
|
185
196
|
compose_message do |operations_name, elements_name, last_message, expected_message|
|
186
197
|
"not expected that operation #{operations_name} would success for #{elements_name} from #{values}. But it happened with #{last_operation} on '#{last_value}'"
|
187
198
|
end
|
@@ -19,17 +19,17 @@ module MigrationValidators
|
|
19
19
|
|
20
20
|
def update *values
|
21
21
|
@last_exception = nil
|
22
|
-
to_array(values).each{|value| execute(value, "UPDATE #{@table_wrapper.table_name} SET #{column_name} = #{value}")}
|
22
|
+
ColumnWrapper.to_array(values).each{|value| execute(value, "UPDATE #{@table_wrapper.table_name} SET #{column_name} = #{value}")}
|
23
23
|
self
|
24
24
|
end
|
25
25
|
|
26
26
|
def insert *values
|
27
27
|
@last_exception = nil
|
28
|
-
to_array(values).each {|value| execute(value, "INSERT INTO #{@table_wrapper.table_name}(#{column_name}) VALUES(#{value})")}
|
28
|
+
ColumnWrapper.to_array(values).each {|value| execute(value, "INSERT INTO #{@table_wrapper.table_name}(#{column_name}) VALUES(#{value})")}
|
29
29
|
self
|
30
30
|
end
|
31
31
|
|
32
|
-
def to_array values
|
32
|
+
def self.to_array values
|
33
33
|
values.collect do |value|
|
34
34
|
case value.class.name
|
35
35
|
when "Range" then to_array(value.to_a)
|
@@ -46,7 +46,7 @@ module MigrationValidators
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
-
def quote value
|
49
|
+
def self.quote value
|
50
50
|
value = "'#{value}" unless value.starts_with?("'")
|
51
51
|
value = "#{value}'" unless value.ends_with?("'")
|
52
52
|
value
|
metadata
CHANGED
@@ -1,82 +1,77 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mv-test
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Valeriy Prokopchuk
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
17
14
|
name: activerecord
|
18
|
-
requirement:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
version: 2.3.5
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.1.6
|
24
20
|
type: :runtime
|
25
21
|
prerelease: false
|
26
|
-
version_requirements:
|
27
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.1.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
|
-
requirement:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
version: 2.3.0
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.0
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
|
-
version_requirements:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-its
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.1
|
48
|
+
type: :runtime
|
47
49
|
prerelease: false
|
48
|
-
version_requirements:
|
49
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
50
56
|
name: jeweler
|
51
|
-
requirement:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
version: 1.5.2
|
57
|
-
type: :development
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: rcov
|
62
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: "0"
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.1
|
68
62
|
type: :development
|
69
63
|
prerelease: false
|
70
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.1
|
71
69
|
description: Contains macros / matchers for database behavious testing
|
72
70
|
email: vprokopchuk@gmail.com
|
73
71
|
executables: []
|
74
|
-
|
75
72
|
extensions: []
|
76
|
-
|
77
73
|
extra_rdoc_files: []
|
78
|
-
|
79
|
-
files:
|
74
|
+
files:
|
80
75
|
- lib/migration_validators/spec/macros/db_macros.rb
|
81
76
|
- lib/migration_validators/spec/matchers/db_matchers.rb
|
82
77
|
- lib/migration_validators/spec/support/column_wrapper.rb
|
@@ -84,51 +79,28 @@ files:
|
|
84
79
|
- lib/migration_validators/spec/support/table_wrapper.rb
|
85
80
|
- lib/migration_validators/spec/support/test_adapter.rb
|
86
81
|
- lib/mv-test.rb
|
87
|
-
- spec/migration_validators/spec/macros/db_macros_spec.rb
|
88
|
-
- spec/migration_validators/spec/matchers/db_matchers_spec.rb
|
89
|
-
- spec/migration_validators/spec/support/column_wrapper_spec.rb
|
90
|
-
- spec/migration_validators/spec/support/db_spec.rb
|
91
|
-
- spec/migration_validators/spec/support/table_wrapper_spec.rb
|
92
|
-
- spec/migration_validators/spec/support/test_adapter_spec.rb
|
93
|
-
- spec/mv-test_spec.rb
|
94
|
-
- spec/spec_helper.rb
|
95
|
-
has_rdoc: true
|
96
82
|
homepage: http://github.com/vprokopchuk256/mv-test
|
97
|
-
licenses:
|
83
|
+
licenses:
|
98
84
|
- MIT
|
85
|
+
metadata: {}
|
99
86
|
post_install_message:
|
100
87
|
rdoc_options: []
|
101
|
-
|
102
|
-
require_paths:
|
88
|
+
require_paths:
|
103
89
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: "0"
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
119
100
|
requirements: []
|
120
|
-
|
121
101
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 2.1.10
|
123
103
|
signing_key:
|
124
|
-
specification_version:
|
104
|
+
specification_version: 4
|
125
105
|
summary: Migration Validators project test suite
|
126
|
-
test_files:
|
127
|
-
- spec/migration_validators/spec/macros/db_macros_spec.rb
|
128
|
-
- spec/migration_validators/spec/matchers/db_matchers_spec.rb
|
129
|
-
- spec/migration_validators/spec/support/column_wrapper_spec.rb
|
130
|
-
- spec/migration_validators/spec/support/db_spec.rb
|
131
|
-
- spec/migration_validators/spec/support/table_wrapper_spec.rb
|
132
|
-
- spec/migration_validators/spec/support/test_adapter_spec.rb
|
133
|
-
- spec/mv-test_spec.rb
|
134
|
-
- spec/spec_helper.rb
|
106
|
+
test_files: []
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
2
|
-
|
3
|
-
describe MigrationValidators::Spec::Macros::DBMacros, "supports", :type => :mv_test do
|
4
|
-
before :all do
|
5
|
-
use_memory_db
|
6
|
-
end
|
7
|
-
|
8
|
-
describe :for_column, "creates column for each internal test" do
|
9
|
-
for_table :test_table do
|
10
|
-
for_column :column, :integer do
|
11
|
-
it { db.column_exists?(:test_table, :column).should be_true }
|
12
|
-
it { db.columns(:test_table).find{|col| col.name.to_s == "column"}.type.to_s.should == "integer" }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe :with_validator do
|
18
|
-
end
|
19
|
-
|
20
|
-
describe :with_option do
|
21
|
-
end
|
22
|
-
|
23
|
-
describe :with_change do
|
24
|
-
end
|
25
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
2
|
-
|
3
|
-
describe MigrationValidators::Spec::Matchers::DBMatchers, "supports", :type => :mv_test do
|
4
|
-
before :all do
|
5
|
-
use_memory_db
|
6
|
-
end
|
7
|
-
|
8
|
-
before :each do
|
9
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
10
|
-
|
11
|
-
migrate do
|
12
|
-
create_table :test_table do |t|
|
13
|
-
t.string :column
|
14
|
-
end
|
15
|
-
|
16
|
-
add_index :test_table, :column, :unique => true
|
17
|
-
end
|
18
|
-
|
19
|
-
@column = table(:test_table).column
|
20
|
-
end
|
21
|
-
|
22
|
-
describe :allow do
|
23
|
-
it { @column.should allow.insert(1, 2) }
|
24
|
-
it { @column.should allow.update(2).with_initial(1) }
|
25
|
-
it { @column.should allow(1) }
|
26
|
-
it { @column.should allow.at_least_one(1, 1) }
|
27
|
-
it { @column.should allow.insert.at_least_one(1, 1) }
|
28
|
-
it { @column.should allow.update.at_least_one(1, 1) }
|
29
|
-
end
|
30
|
-
|
31
|
-
describe :deny do
|
32
|
-
it { @column.should deny.at_least_one(1, 1).with_initial(1, 2) }
|
33
|
-
it { @column.should deny.at_least_one.insert(1, 1) }
|
34
|
-
it { @column.should deny.at_least_one.insert(1, 1).with_message(/not unique/) }
|
35
|
-
it { @column.should deny.insert(1, 1).with_initial(1).with_message(/not unique/) }
|
36
|
-
end
|
37
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
2
|
-
|
3
|
-
describe MigrationValidators::Spec::Support::ColumnWrapper, "supports", :type => :mv_test do
|
4
|
-
before :each do
|
5
|
-
use_memory_db
|
6
|
-
|
7
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
8
|
-
@wrapper = new_table {|t| t.string :str_column }.str_column
|
9
|
-
end
|
10
|
-
|
11
|
-
it "drop" do
|
12
|
-
chg_table(:test_table) {|t| t.string :str_column_1}.str_column_1.drop
|
13
|
-
|
14
|
-
db.column_exists?(:test_table, :str_column_1).should be_false
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "sql wrapping for" do
|
18
|
-
before :each do
|
19
|
-
db.drop_table(:items) if db.table_exists?(:items)
|
20
|
-
|
21
|
-
Item = Class.new(ActiveRecord::Base) do
|
22
|
-
def self.all
|
23
|
-
Item.find(:all, :order => "column ASC").collect{|item| item.column}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe :insert do
|
29
|
-
describe "range" do
|
30
|
-
it "open" do
|
31
|
-
new_table(:items){|t| t.integer :column}.column.insert(1..3)
|
32
|
-
Item.all.should == [1, 2, 3]
|
33
|
-
end
|
34
|
-
|
35
|
-
it "closed" do
|
36
|
-
new_table(:items){|t| t.integer :column}.column.insert(1...3)
|
37
|
-
Item.all.should == [1, 2]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "array" do
|
42
|
-
before :each do
|
43
|
-
@column = new_table(:items){|t| t.integer :column}.column
|
44
|
-
end
|
45
|
-
|
46
|
-
it "of simple elements" do
|
47
|
-
@column.insert([1, 2, 3])
|
48
|
-
Item.all.should == [1, 2, 3]
|
49
|
-
end
|
50
|
-
|
51
|
-
it "as params list" do
|
52
|
-
@column.insert(1, 2, 3)
|
53
|
-
Item.all.should == [1, 2, 3]
|
54
|
-
end
|
55
|
-
|
56
|
-
it "as composite elements" do
|
57
|
-
@column.insert(1, 2, 3, [4, 5], 6..8)
|
58
|
-
Item.all.should == [1, 2, 3, 4, 5, 6, 7, 8]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "string" do
|
63
|
-
before :each do
|
64
|
-
@column = new_table(:items){|t| t.string :column}.column
|
65
|
-
end
|
66
|
-
|
67
|
-
it "parameters" do
|
68
|
-
@column.insert("str1", "str2")
|
69
|
-
Item.all.should == ["str1", "str2"]
|
70
|
-
end
|
71
|
-
|
72
|
-
it "interprets NULL correctly" do
|
73
|
-
@column.insert("NULL")
|
74
|
-
|
75
|
-
Item.all.should == [nil]
|
76
|
-
end
|
77
|
-
|
78
|
-
it "supports internal arrays" do
|
79
|
-
@column.insert(["str1", ["str2"]])
|
80
|
-
Item.all.should == ["str1", "str2"]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
it "date" do
|
85
|
-
column = new_table(:items){|t| t.date :column}.column
|
86
|
-
date = Date.today
|
87
|
-
|
88
|
-
column.insert(date)
|
89
|
-
Item.all.should == [date]
|
90
|
-
end
|
91
|
-
|
92
|
-
it "time" do
|
93
|
-
column = new_table(:items){|t| t.time :column}.column
|
94
|
-
time = Time.now
|
95
|
-
|
96
|
-
column.insert(time)
|
97
|
-
Item.all.first.strftime("%H:%M:%S").should == time.strftime("%H:%M:%S")
|
98
|
-
end
|
99
|
-
it "datetime" do
|
100
|
-
column = new_table(:items){|t| t.datetime :column}.column
|
101
|
-
datetime = DateTime.now
|
102
|
-
|
103
|
-
column.insert(datetime)
|
104
|
-
Item.all.first.strftime("%y-%m-%d %H:%M:%S").should == datetime.strftime("%y-%m-%d %H:%M:%S")
|
105
|
-
end
|
106
|
-
|
107
|
-
it "nil" do
|
108
|
-
column = new_table(:items){|t| t.string :column}.column
|
109
|
-
column.insert(nil)
|
110
|
-
|
111
|
-
Item.all.should == [nil]
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
it :update do
|
116
|
-
new_table(:items){|t| t.integer :column}.column.insert(1..3).update(3)
|
117
|
-
Item.all.should == [3, 3, 3]
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe "last exception" do
|
122
|
-
it "equals nil if operation successed" do
|
123
|
-
column = new_table(:items){|t| t.string :column}.column
|
124
|
-
column.insert("value")
|
125
|
-
|
126
|
-
column.last_exception.should be_blank
|
127
|
-
end
|
128
|
-
|
129
|
-
it "equals last exception if something wrong" do
|
130
|
-
column = new_table(:items){|t| t.string :column}.column
|
131
|
-
db.drop_table(:items)
|
132
|
-
column.insert("value")
|
133
|
-
|
134
|
-
column.last_exception.should_not be_blank
|
135
|
-
end
|
136
|
-
|
137
|
-
it "clears before each new request" do
|
138
|
-
column = new_table(:items){|t| t.string :column}.column
|
139
|
-
db.drop_table(:items)
|
140
|
-
column.insert("value")
|
141
|
-
|
142
|
-
new_table(:items){|t| t.string :column}
|
143
|
-
column.insert("value")
|
144
|
-
|
145
|
-
column.last_exception.should be_blank
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
2
|
-
|
3
|
-
describe MigrationValidators::Spec::Support::DB, "supports", :type => :mv_test do
|
4
|
-
it "connect to the memory db (sqlite in memory)" do
|
5
|
-
use_memory_db
|
6
|
-
|
7
|
-
ActiveRecord::Base.connection.should_not be_blank
|
8
|
-
end
|
9
|
-
|
10
|
-
it "shortcut to active record connection" do
|
11
|
-
use_memory_db
|
12
|
-
|
13
|
-
db.should == ActiveRecord::Base.connection
|
14
|
-
end
|
15
|
-
|
16
|
-
it "migration shortcut" do
|
17
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
18
|
-
|
19
|
-
migrate do
|
20
|
-
create_table :test_table do |t|
|
21
|
-
t.string :str_column
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
db.table_exists?(:test_table).should be_true
|
26
|
-
end
|
27
|
-
|
28
|
-
it "create table shortcut" do
|
29
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
30
|
-
|
31
|
-
new_table :test_table do |t|
|
32
|
-
t.string :str_column
|
33
|
-
end
|
34
|
-
|
35
|
-
db.table_exists?(:test_table).should be_true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "change table shortcut" do
|
39
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
40
|
-
new_table {|t| t.string :str_column }
|
41
|
-
|
42
|
-
chg_table :test_table do |t|
|
43
|
-
t.string :str_column_1
|
44
|
-
end
|
45
|
-
|
46
|
-
db.column_exists?(:test_table, :str_column_1).should be_true
|
47
|
-
end
|
48
|
-
|
49
|
-
it "shortcut for table info" do
|
50
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
51
|
-
new_table {|t| t.string :str_column }
|
52
|
-
|
53
|
-
table(:test_table).should be_kind_of(MigrationValidators::Spec::Support::TableWrapper)
|
54
|
-
table(:test_table).table_name.should == :test_table
|
55
|
-
end
|
56
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
2
|
-
|
3
|
-
describe MigrationValidators::Spec::Support::TableWrapper, "supports", :type => :mv_test do
|
4
|
-
before :each do
|
5
|
-
use_memory_db
|
6
|
-
|
7
|
-
db.drop_table(:test_table) if db.table_exists?(:test_table)
|
8
|
-
@wrapper = new_table {|t| t.string :str_column }
|
9
|
-
end
|
10
|
-
|
11
|
-
it "column information requests" do
|
12
|
-
@wrapper.str_column.column_name.should == :str_column
|
13
|
-
end
|
14
|
-
|
15
|
-
it "supports dropping" do
|
16
|
-
@wrapper.drop
|
17
|
-
|
18
|
-
db.table_exists?(:test_table).should be_false
|
19
|
-
end
|
20
|
-
end
|
data/spec/mv-test_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'mv-test'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|