flextures 4.2.6 → 4.2.7

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,6 +1,6 @@
1
- Flextures::Configuration.configure do |config|
2
- # config.init_all_tables = true
3
- # config.ignore_tables = ["schema_migrations"]
4
- # config.load_directory = "test/fixtures/"
5
- # config.dump_directory = "test/fixtures/"
6
- end
1
+ Flextures::Configuration.configure do |config|
2
+ # config.init_all_tables = true
3
+ # config.ignore_tables = ["schema_migrations"]
4
+ # config.load_directory = "test/fixtures/"
5
+ # config.dump_directory = "test/fixtures/"
6
+ end
@@ -1,8 +1,8 @@
1
- $:.push( File.join(File.dirname(File.expand_path(__FILE__)), '../') )
2
- require 'test_helper'
3
-
4
- describe Flextures do
5
- it "data type test" do
6
- assert_equal true, true
7
- end
8
- end
1
+ $:.push( File.join(File.dirname(File.expand_path(__FILE__)), '../') )
2
+ require 'test_helper'
3
+
4
+ describe Flextures do
5
+ it "data type test" do
6
+ assert_equal true, true
7
+ end
8
+ end
@@ -1,13 +1,13 @@
1
- # encoding: utf-8
2
-
3
- require 'stringio'
4
- require 'minitest'
5
- require "minitest/autorun"
6
- require 'rubygems'
7
- require 'drb/drb'
8
-
9
- require File.dirname(__FILE__) + '/../lib/flextures'
10
-
11
- ## under 'lib' directories your library write below
12
-
13
- require "flextures"
1
+ # encoding: utf-8
2
+
3
+ require 'stringio'
4
+ require 'minitest'
5
+ require "minitest/autorun"
6
+ require 'rubygems'
7
+ require 'drb/drb'
8
+
9
+ require File.dirname(__FILE__) + '/../lib/flextures'
10
+
11
+ ## under 'lib' directories your library write below
12
+
13
+ require "flextures"
@@ -1,127 +1,127 @@
1
- $:.push( File.join(File.dirname(File.expand_path(__FILE__)), '../') )
2
-
3
- require 'test_helper'
4
-
5
- describe Flextures::ARGS do
6
- describe "if set TABLE='table_name' option " do
7
- before do
8
- @format = Flextures::ARGS.parse("TABLE"=>"users")
9
- end
10
-
11
- it "return table_name" do
12
- assert_equal "users", @format.first[:table]
13
- end
14
-
15
- it "filename is same table_name" do
16
- assert_equal "users", @format.first[:file]
17
- end
18
- end
19
-
20
- describe "if set T=table_name option " do
21
- before do
22
- @format = Flextures::ARGS.parse("T"=>"s_user")
23
- end
24
-
25
- it "retrun table_name" do
26
- assert_equal "s_user", @format.first[:table]
27
- end
28
-
29
- it "filename is same table_name" do
30
- assert_equal "s_user", @format.first[:file]
31
- end
32
- end
33
-
34
- describe " DIR=option " do
35
- before do
36
- @format = Flextures::ARGS.parse("T"=>"users", "DIR"=>"test/fixtures/")
37
- end
38
-
39
- it "directory name is exist" do
40
- assert_equal "test/fixtures/", @format.first[:dir]
41
- end
42
-
43
- it "set table name" do
44
- assert_equal "users", @format.first[:table]
45
- end
46
-
47
- it "file name is equal table name" do
48
- assert_equal "users", @format.first[:file]
49
- end
50
- end
51
-
52
- describe " D=option " do
53
- before do
54
- @format = Flextures::ARGS.parse("T"=>"users", "D"=>"test/fixtures/")
55
- end
56
-
57
- it "directory name" do
58
- assert_equal "test/fixtures/", @format.first[:dir]
59
- end
60
-
61
- it "table name is exist" do
62
- assert_equal "users", @format.first[:table]
63
- end
64
-
65
- it "file name is equal table name" do
66
- assert_equal "users", @format.first[:file]
67
- end
68
- end
69
-
70
- describe " FIXTURES=option " do
71
- before do
72
- @format = Flextures::ARGS.parse("T"=>"users", "FIXTURES"=>"user_another")
73
- end
74
-
75
- it "table name is exist" do
76
- assert_equal "users", @format.first[:table]
77
- end
78
-
79
- it " file name is changed by option's name " do
80
- assert_equal "user_another", @format.first[:file]
81
- end
82
- end
83
-
84
- describe " MINUS option " do
85
- describe "only one columns" do
86
- before do
87
- @format = Flextures::ARGS.parse("T"=>"users", "MINUS"=>"id")
88
- end
89
-
90
- it " option contain 'minus' parameters" do
91
- assert_equal ["id"], @format.first[:minus]
92
- end
93
- end
94
-
95
- describe "many columns" do
96
- before do
97
- @format = Flextures::ARGS.parse("T"=>"users", "MINUS"=>"id,created_at,updated_at")
98
- end
99
-
100
- it " option contain 'minus' parameters" do
101
- assert_equal ["id","created_at","updated_at"], @format.first[:minus]
102
- end
103
- end
104
- end
105
-
106
- describe " PLUS options " do
107
- describe "only one columns" do
108
- before do
109
- @format = Flextures::ARGS.parse("T"=>"users", "PLUS"=>"hoge")
110
- end
111
-
112
- it " option contain 'plus' parameters" do
113
- assert_equal ["hoge"], @format.first[:plus]
114
- end
115
- end
116
-
117
- describe "many columns" do
118
- before do
119
- @format = Flextures::ARGS.parse("T"=>"users", "PLUS"=>"hoge,mage")
120
- end
121
-
122
- it " option contain 'plus' parameters" do
123
- assert_equal ["hoge","mage"], @format.first[:plus]
124
- end
125
- end
126
- end
127
- end
1
+ $:.push( File.join(File.dirname(File.expand_path(__FILE__)), '../') )
2
+
3
+ require 'test_helper'
4
+
5
+ describe Flextures::ARGS do
6
+ describe "if set TABLE='table_name' option " do
7
+ before do
8
+ @format = Flextures::ARGS.parse("TABLE"=>"users")
9
+ end
10
+
11
+ it "return table_name" do
12
+ assert_equal "users", @format.first[:table]
13
+ end
14
+
15
+ it "filename is same table_name" do
16
+ assert_equal "users", @format.first[:file]
17
+ end
18
+ end
19
+
20
+ describe "if set T=table_name option " do
21
+ before do
22
+ @format = Flextures::ARGS.parse("T"=>"s_user")
23
+ end
24
+
25
+ it "retrun table_name" do
26
+ assert_equal "s_user", @format.first[:table]
27
+ end
28
+
29
+ it "filename is same table_name" do
30
+ assert_equal "s_user", @format.first[:file]
31
+ end
32
+ end
33
+
34
+ describe " DIR=option " do
35
+ before do
36
+ @format = Flextures::ARGS.parse("T"=>"users", "DIR"=>"test/fixtures/")
37
+ end
38
+
39
+ it "directory name is exist" do
40
+ assert_equal "test/fixtures/", @format.first[:dir]
41
+ end
42
+
43
+ it "set table name" do
44
+ assert_equal "users", @format.first[:table]
45
+ end
46
+
47
+ it "file name is equal table name" do
48
+ assert_equal "users", @format.first[:file]
49
+ end
50
+ end
51
+
52
+ describe " D=option " do
53
+ before do
54
+ @format = Flextures::ARGS.parse("T"=>"users", "D"=>"test/fixtures/")
55
+ end
56
+
57
+ it "directory name" do
58
+ assert_equal "test/fixtures/", @format.first[:dir]
59
+ end
60
+
61
+ it "table name is exist" do
62
+ assert_equal "users", @format.first[:table]
63
+ end
64
+
65
+ it "file name is equal table name" do
66
+ assert_equal "users", @format.first[:file]
67
+ end
68
+ end
69
+
70
+ describe " FIXTURES=option " do
71
+ before do
72
+ @format = Flextures::ARGS.parse("T"=>"users", "FIXTURES"=>"user_another")
73
+ end
74
+
75
+ it "table name is exist" do
76
+ assert_equal "users", @format.first[:table]
77
+ end
78
+
79
+ it " file name is changed by option's name " do
80
+ assert_equal "user_another", @format.first[:file]
81
+ end
82
+ end
83
+
84
+ describe " MINUS option " do
85
+ describe "only one columns" do
86
+ before do
87
+ @format = Flextures::ARGS.parse("T"=>"users", "MINUS"=>"id")
88
+ end
89
+
90
+ it " option contain 'minus' parameters" do
91
+ assert_equal ["id"], @format.first[:minus]
92
+ end
93
+ end
94
+
95
+ describe "many columns" do
96
+ before do
97
+ @format = Flextures::ARGS.parse("T"=>"users", "MINUS"=>"id,created_at,updated_at")
98
+ end
99
+
100
+ it " option contain 'minus' parameters" do
101
+ assert_equal ["id","created_at","updated_at"], @format.first[:minus]
102
+ end
103
+ end
104
+ end
105
+
106
+ describe " PLUS options " do
107
+ describe "only one columns" do
108
+ before do
109
+ @format = Flextures::ARGS.parse("T"=>"users", "PLUS"=>"hoge")
110
+ end
111
+
112
+ it " option contain 'plus' parameters" do
113
+ assert_equal ["hoge"], @format.first[:plus]
114
+ end
115
+ end
116
+
117
+ describe "many columns" do
118
+ before do
119
+ @format = Flextures::ARGS.parse("T"=>"users", "PLUS"=>"hoge,mage")
120
+ end
121
+
122
+ it " option contain 'plus' parameters" do
123
+ assert_equal ["hoge","mage"], @format.first[:plus]
124
+ end
125
+ end
126
+ end
127
+ end
@@ -1,232 +1,232 @@
1
- $:.push( File.join(File.dirname(File.expand_path(__FILE__)), '../') )
2
- require 'test_helper'
3
-
4
- describe Flextures::Dumper do
5
- describe "TRANSLATE function rules" do
6
- describe :binary do
7
- describe :yml do
8
- before do
9
- @trans = Flextures::Dumper::TRANSLATER[:binary]
10
- end
11
-
12
- it "nil translate 'null' string" do
13
- assert_equal "null", @trans.call( nil, :yml )
14
- end
15
- end
16
-
17
- describe :binary do
18
- describe :csv do
19
- before do
20
- @trans = Flextures::Dumper::TRANSLATER[:binary]
21
- end
22
- end
23
- end
24
-
25
- describe :boolean do
26
- describe :yml do
27
- before do
28
- @trans = Flextures::Dumper::TRANSLATER[:boolean]
29
- end
30
-
31
- it "nil translate 'null' string" do
32
- assert_equal "null", @trans.call( nil, :yml )
33
- end
34
-
35
- it "0 translate false" do
36
- assert_equal false, @trans.call( 0, :yml )
37
- end
38
-
39
- it "natural number translat true" do
40
- assert_equal true, @trans.call( 1, :yml )
41
- end
42
-
43
- it " empty string translate dalse" do
44
- assert_equal false, @trans.call( "", :yml )
45
- end
46
-
47
- it "string translate true" do
48
- assert_equal true, @trans.call( "Hello", :yml )
49
- end
50
- end
51
-
52
- describe :csv do
53
- before do
54
- @trans = Flextures::Dumper::TRANSLATER[:boolean]
55
- end
56
- end
57
- end
58
-
59
- describe :date do
60
- describe :yml do
61
- before do
62
- @trans = Flextures::Dumper::TRANSLATER[:date]
63
- end
64
-
65
- it "nil translate 'null' string" do
66
- assert_equal "null", @trans.call( nil, :yml )
67
- end
68
-
69
- it "empty string translate 'null' string" do
70
- assert_equal "null", @trans.call( "", :yml )
71
- end
72
-
73
- it "false translate 'null' string" do
74
- assert_equal "null", @trans.call( false, :yml )
75
- end
76
- end
77
-
78
- describe :csv do
79
- before do
80
- @trans = Flextures::Dumper::TRANSLATER[:date]
81
- end
82
- end
83
- end
84
-
85
- describe :datetime do
86
- describe :yml do
87
- before do
88
- @trans = Flextures::Dumper::TRANSLATER[:datetime]
89
- end
90
-
91
- it "nil translate 'null' string" do
92
- assert_equal "null", @trans.call( nil, :yml )
93
- end
94
-
95
- it "empty string translate 'null' string" do
96
- assert_equal "null", @trans.call( "", :yml )
97
- end
98
-
99
- it "false translate 'null' string" do
100
- assert_equal "null", @trans.call( false, :yml )
101
- end
102
- end
103
-
104
- describe :csv do
105
- end
106
- end
107
-
108
- describe :float do
109
- describe :yml do
110
- before do
111
- @trans = Flextures::Dumper::TRANSLATER[:float]
112
- end
113
-
114
- it "integral number don't translate" do
115
- assert_equal 10, @trans.call( 10, :yml )
116
- end
117
-
118
- it "floating number don't translate" do
119
- assert_equal 1.5, @trans.call( 1.5, :yml )
120
- end
121
-
122
- it "nil translate 'null' string" do
123
- assert_equal "null", @trans.call( nil, :yml )
124
- end
125
-
126
- it "0 don't translate" do
127
- assert_equal "null", @trans.call( nil, :yml )
128
- end
129
-
130
- it "false don't translate" do
131
- assert_equal "null", @trans.call( nil, :yml )
132
- end
133
- end
134
-
135
- describe :csv do
136
- end
137
- end
138
-
139
- describe :integer do
140
- describe :yml do
141
- before do
142
- @trans = Flextures::Dumper::TRANSLATER[:integer]
143
- end
144
-
145
- it "integral number don't translate" do
146
- assert_equal 10, @trans.call( 10, :yml )
147
- end
148
-
149
- it "float number is floored" do
150
- assert_equal 1, @trans.call( 1.5, :yml )
151
- end
152
-
153
- it "nil translate 'null' string" do
154
- assert_equal "null", @trans.call( nil, :yml )
155
- end
156
-
157
- it "0 don't translate" do
158
- assert_equal 0, @trans.call( 0, :yml )
159
- end
160
-
161
- it "false translate 0" do
162
- assert_equal 0, @trans.call( false, :yml )
163
- end
164
-
165
- it "true translate 1" do
166
- assert_equal 1, @trans.call( true, :yml )
167
- end
168
- end
169
-
170
- describe :csv do
171
- before do
172
- @trans = Flextures::Dumper::TRANSLATER[:integer]
173
- end
174
-
175
- it "integral number don't translate" do
176
- assert_equal 10, @trans.call( 10, :csv )
177
- end
178
-
179
- it 'nil translate empty string' do
180
- assert_equal "", @trans.call( nil, :csv )
181
- end
182
- end
183
-
184
- describe :string do
185
- describe :yml do
186
- before do
187
- @trans = Flextures::Dumper::TRANSLATER[:string]
188
- end
189
-
190
- it "nil translate 'null' string" do
191
- assert_equal "null", @trans.call( nil, :yml )
192
- end
193
-
194
- it "empty string don't translate" do
195
- assert_equal "null", @trans.call( nil, :yml )
196
- end
197
-
198
- it "false don't translate" do
199
- assert_equal false, @trans.call( false, :yml )
200
- end
201
-
202
- it "true don't translate" do
203
- assert_equal true, @trans.call( true, :yml )
204
- end
205
- end
206
- end
207
-
208
- describe :null do
209
- describe :yml do
210
- before do
211
- @trans = Flextures::Dumper::TRANSLATER[:null]
212
- end
213
-
214
- it "values is 'null' string" do
215
- assert_equal "null", @trans.call( nil, :yml )
216
- end
217
- end
218
-
219
- describe :csv do
220
- before do
221
- @trans = Flextures::Dumper::TRANSLATER[:null]
222
- end
223
-
224
- it "values is empty string" do
225
- assert_equal "", @trans.call( nil, :csv )
226
- end
227
- end
228
- end
229
- end
230
- end
231
- end
232
- end
1
+ $:.push( File.join(File.dirname(File.expand_path(__FILE__)), '../') )
2
+ require 'test_helper'
3
+
4
+ describe Flextures::Dumper do
5
+ describe "TRANSLATE function rules" do
6
+ describe :binary do
7
+ describe :yml do
8
+ before do
9
+ @trans = Flextures::Dumper::TRANSLATER[:binary]
10
+ end
11
+
12
+ it "nil translate 'null' string" do
13
+ assert_equal "null", @trans.call( nil, :yml )
14
+ end
15
+ end
16
+
17
+ describe :binary do
18
+ describe :csv do
19
+ before do
20
+ @trans = Flextures::Dumper::TRANSLATER[:binary]
21
+ end
22
+ end
23
+ end
24
+
25
+ describe :boolean do
26
+ describe :yml do
27
+ before do
28
+ @trans = Flextures::Dumper::TRANSLATER[:boolean]
29
+ end
30
+
31
+ it "nil translate 'null' string" do
32
+ assert_equal "null", @trans.call( nil, :yml )
33
+ end
34
+
35
+ it "0 translate false" do
36
+ assert_equal false, @trans.call( 0, :yml )
37
+ end
38
+
39
+ it "natural number translat true" do
40
+ assert_equal true, @trans.call( 1, :yml )
41
+ end
42
+
43
+ it " empty string translate dalse" do
44
+ assert_equal false, @trans.call( "", :yml )
45
+ end
46
+
47
+ it "string translate true" do
48
+ assert_equal true, @trans.call( "Hello", :yml )
49
+ end
50
+ end
51
+
52
+ describe :csv do
53
+ before do
54
+ @trans = Flextures::Dumper::TRANSLATER[:boolean]
55
+ end
56
+ end
57
+ end
58
+
59
+ describe :date do
60
+ describe :yml do
61
+ before do
62
+ @trans = Flextures::Dumper::TRANSLATER[:date]
63
+ end
64
+
65
+ it "nil translate 'null' string" do
66
+ assert_equal "null", @trans.call( nil, :yml )
67
+ end
68
+
69
+ it "empty string translate 'null' string" do
70
+ assert_equal "null", @trans.call( "", :yml )
71
+ end
72
+
73
+ it "false translate 'null' string" do
74
+ assert_equal "null", @trans.call( false, :yml )
75
+ end
76
+ end
77
+
78
+ describe :csv do
79
+ before do
80
+ @trans = Flextures::Dumper::TRANSLATER[:date]
81
+ end
82
+ end
83
+ end
84
+
85
+ describe :datetime do
86
+ describe :yml do
87
+ before do
88
+ @trans = Flextures::Dumper::TRANSLATER[:datetime]
89
+ end
90
+
91
+ it "nil translate 'null' string" do
92
+ assert_equal "null", @trans.call( nil, :yml )
93
+ end
94
+
95
+ it "empty string translate 'null' string" do
96
+ assert_equal "null", @trans.call( "", :yml )
97
+ end
98
+
99
+ it "false translate 'null' string" do
100
+ assert_equal "null", @trans.call( false, :yml )
101
+ end
102
+ end
103
+
104
+ describe :csv do
105
+ end
106
+ end
107
+
108
+ describe :float do
109
+ describe :yml do
110
+ before do
111
+ @trans = Flextures::Dumper::TRANSLATER[:float]
112
+ end
113
+
114
+ it "integral number don't translate" do
115
+ assert_equal 10, @trans.call( 10, :yml )
116
+ end
117
+
118
+ it "floating number don't translate" do
119
+ assert_equal 1.5, @trans.call( 1.5, :yml )
120
+ end
121
+
122
+ it "nil translate 'null' string" do
123
+ assert_equal "null", @trans.call( nil, :yml )
124
+ end
125
+
126
+ it "0 don't translate" do
127
+ assert_equal "null", @trans.call( nil, :yml )
128
+ end
129
+
130
+ it "false don't translate" do
131
+ assert_equal "null", @trans.call( nil, :yml )
132
+ end
133
+ end
134
+
135
+ describe :csv do
136
+ end
137
+ end
138
+
139
+ describe :integer do
140
+ describe :yml do
141
+ before do
142
+ @trans = Flextures::Dumper::TRANSLATER[:integer]
143
+ end
144
+
145
+ it "integral number don't translate" do
146
+ assert_equal 10, @trans.call( 10, :yml )
147
+ end
148
+
149
+ it "float number is floored" do
150
+ assert_equal 1, @trans.call( 1.5, :yml )
151
+ end
152
+
153
+ it "nil translate 'null' string" do
154
+ assert_equal "null", @trans.call( nil, :yml )
155
+ end
156
+
157
+ it "0 don't translate" do
158
+ assert_equal 0, @trans.call( 0, :yml )
159
+ end
160
+
161
+ it "false translate 0" do
162
+ assert_equal 0, @trans.call( false, :yml )
163
+ end
164
+
165
+ it "true translate 1" do
166
+ assert_equal 1, @trans.call( true, :yml )
167
+ end
168
+ end
169
+
170
+ describe :csv do
171
+ before do
172
+ @trans = Flextures::Dumper::TRANSLATER[:integer]
173
+ end
174
+
175
+ it "integral number don't translate" do
176
+ assert_equal 10, @trans.call( 10, :csv )
177
+ end
178
+
179
+ it 'nil translate empty string' do
180
+ assert_equal "", @trans.call( nil, :csv )
181
+ end
182
+ end
183
+
184
+ describe :string do
185
+ describe :yml do
186
+ before do
187
+ @trans = Flextures::Dumper::TRANSLATER[:string]
188
+ end
189
+
190
+ it "nil translate 'null' string" do
191
+ assert_equal "null", @trans.call( nil, :yml )
192
+ end
193
+
194
+ it "empty string don't translate" do
195
+ assert_equal "null", @trans.call( nil, :yml )
196
+ end
197
+
198
+ it "false don't translate" do
199
+ assert_equal false, @trans.call( false, :yml )
200
+ end
201
+
202
+ it "true don't translate" do
203
+ assert_equal true, @trans.call( true, :yml )
204
+ end
205
+ end
206
+ end
207
+
208
+ describe :null do
209
+ describe :yml do
210
+ before do
211
+ @trans = Flextures::Dumper::TRANSLATER[:null]
212
+ end
213
+
214
+ it "values is 'null' string" do
215
+ assert_equal "null", @trans.call( nil, :yml )
216
+ end
217
+ end
218
+
219
+ describe :csv do
220
+ before do
221
+ @trans = Flextures::Dumper::TRANSLATER[:null]
222
+ end
223
+
224
+ it "values is empty string" do
225
+ assert_equal "", @trans.call( nil, :csv )
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end