flextures 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a329b8898f61de2db35609a4550b01ff71d3161
4
- data.tar.gz: 4a4990b17c74688bc183d88e87fea0c0d68c9f0c
3
+ metadata.gz: b662bba9471c429a21431597c9cf7e290c6e5f37
4
+ data.tar.gz: 82a85f274b963fb15a2cf7949b74c41622206607
5
5
  SHA512:
6
- metadata.gz: 56bef866d44651bfe71ae22c7d1d0f3adfc32663043a49435956bafdeb3488e3913d0a2b6eda6a8cf9e3cd3b71fc5a9ee3ecc5af3cd58cfcb64dd3a7bfd081c0
7
- data.tar.gz: d21f5bd3ae482ff707a9681be5d6c3ff3020fc126db26c486a715fc37a864f9bc0815b53233c4a0ab40758c2e3abdbbba561d2cba184773d3e6ff8394dcb0fd5
6
+ metadata.gz: b03024429c88c61ca34421ef1748b15ad2da6e801ffa912fce348c4dea133d15726a5241d81546e8e3102c3a46001739fa92ad4cc549195ef05588a1e35fda67
7
+ data.tar.gz: d2c304dfadec3dab3d33a61f33d82c32bcd300bdcafda9796313a9a514d0f7f67605e60abd8bf4810ae696e5862f9ee8438c72135de25f070a28333605bb06f3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flextures (3.1.2)
4
+ flextures (3.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -27,3 +27,6 @@ DEPENDENCIES
27
27
  flextures!
28
28
  rake
29
29
  shoulda
30
+
31
+ BUNDLED WITH
32
+ 1.10.6
@@ -1,61 +1,61 @@
1
- # encoding: utf-8
2
-
3
- require 'flextures/flextures'
4
-
5
- namespace :db do
6
- namespace :flextures do
7
- desc "Dump data to csv format"
8
- task :dump => :environment do
9
- Flextures::Rake::Command::dump
10
- end
11
-
12
- desc "Dump data to prefer csv format"
13
- task :csvdump => :environment do
14
- puts "This command is deprecated"
15
- # TODO: deprecated message
16
- # please use 'FOAMRT=csv' option
17
- ENV["FORMAT"]="csv"
18
- Flextures::Rake::Command::dump
19
- end
20
-
21
- desc "Dump data to yaml format"
22
- task :ymldump => :environment do
23
- puts "This command is deprecated"
24
- puts "please use 'rake db:flextures:dump FORMAT='yml''"
25
- # TODO: deprecated message
26
- # please use 'FOAMRT=yml' option
27
- ENV["FORMAT"]="yml"
28
- Flextures::Rake::Command::dump
29
- end
30
-
31
- desc "load fixture data csv format"
32
- task :load => :environment do
33
- Flextures::Rake::Command::load
34
- end
35
-
36
- desc "load fixture data only csv format files"
37
- task :csvload => :environment do
38
- puts "This command is deprecated"
39
- puts "please use 'rake db:flextures:load FORMAT='csv''"
40
- # TODO: deprecated message
41
- # please use 'FOAMRT=csv' option
42
- ENV["FORMAT"]="csv"
43
- Flextures::Rake::Command::load
44
- end
45
-
46
- desc "load fixture files only yaml format"
47
- task :ymlload => :environment do
48
- # TODO: deprecated message
49
- # please use 'FOAMRT=yml' option
50
- ENV["FORMAT"]="yml"
51
- puts "This command is deprecated"
52
- puts "please use 'rake db:flextures:load FORMAT='yml''"
53
- Flextures::Rake::Command::load
54
- end
55
-
56
- desc "load and dump file (replace) new data file"
57
- task :generate => :environment do
58
- Flextures::Rake::Command::generate
59
- end
60
- end
61
- end
1
+ # encoding: utf-8
2
+
3
+ require 'flextures/flextures'
4
+
5
+ namespace :db do
6
+ namespace :flextures do
7
+ desc "Dump data to csv format"
8
+ task :dump => :environment do
9
+ Flextures::Rake::Command::dump
10
+ end
11
+
12
+ desc "Dump data to prefer csv format"
13
+ task :csvdump => :environment do
14
+ puts "This command is deprecated"
15
+ # TODO: deprecated message
16
+ # please use 'FOAMRT=csv' option
17
+ ENV["FORMAT"]="csv"
18
+ Flextures::Rake::Command::dump
19
+ end
20
+
21
+ desc "Dump data to yaml format"
22
+ task :ymldump => :environment do
23
+ puts "This command is deprecated"
24
+ puts "please use 'rake db:flextures:dump FORMAT='yml''"
25
+ # TODO: deprecated message
26
+ # please use 'FOAMRT=yml' option
27
+ ENV["FORMAT"]="yml"
28
+ Flextures::Rake::Command::dump
29
+ end
30
+
31
+ desc "load fixture data csv format"
32
+ task :load => :environment do
33
+ Flextures::Rake::Command::load
34
+ end
35
+
36
+ desc "load fixture data only csv format files"
37
+ task :csvload => :environment do
38
+ puts "This command is deprecated"
39
+ puts "please use 'rake db:flextures:load FORMAT='csv''"
40
+ # TODO: deprecated message
41
+ # please use 'FOAMRT=csv' option
42
+ ENV["FORMAT"]="csv"
43
+ Flextures::Rake::Command::load
44
+ end
45
+
46
+ desc "load fixture files only yaml format"
47
+ task :ymlload => :environment do
48
+ # TODO: deprecated message
49
+ # please use 'FOAMRT=yml' option
50
+ ENV["FORMAT"]="yml"
51
+ puts "This command is deprecated"
52
+ puts "please use 'rake db:flextures:load FORMAT='yml''"
53
+ Flextures::Rake::Command::load
54
+ end
55
+
56
+ desc "load and dump file (replace) new data file"
57
+ task :generate => :environment do
58
+ Flextures::Rake::Command::generate
59
+ end
60
+ end
61
+ end
@@ -102,7 +102,7 @@ module Flextures
102
102
  },
103
103
  datetime:->( d, format ){
104
104
  procs = (format == :yml) ?
105
- [:nullstr, :blank2null, :false2nullstr, proc { |d| d.try(:strftime,"%F %T").to_s }] :
105
+ [:nullstr, :blank2null, :false2nullstr, proc { |d| d.to_s }] :
106
106
  [proc { |d| d.to_s }]
107
107
  self.translate_creater d, procs
108
108
  },
@@ -137,14 +137,12 @@ module Flextures
137
137
  self.translate_creater d, procs
138
138
  },
139
139
  time:->( d, format ){
140
- p d
141
140
  procs = (format == :yml) ?
142
- [:ymlnulltime, proc { |d| d.try(:strftime,"%F %T").to_s }] :
141
+ [:ymlnulltime, proc { |d| d.to_s }] :
143
142
  [proc { |d| d.to_s }]
144
143
  self.translate_creater d, procs
145
144
  },
146
145
  timestamp:->( d, format ){
147
- p d
148
146
  procs = (format == :yml) ?
149
147
  [:ymlnulltime, proc { |d| d.try(:strftime,"%F %T").to_s }] :
150
148
  [proc { |d| d.to_s }]
@@ -36,7 +36,7 @@ module Flextures
36
36
  },
37
37
  boolean:->(d){
38
38
  return d if d.nil?
39
- !("false"==d || "0"==d || ""==d || 0==d || !d)
39
+ !("FALSE"==d || "false"==d || "0"==d || ""==d || 0==d || !d)
40
40
  },
41
41
  date:->(d){
42
42
  return d if d.nil?
@@ -1,3 +1,3 @@
1
1
  module Flextures
2
- VERSION="3.1.2"
2
+ VERSION="3.1.3"
3
3
  end
@@ -1,12 +1,12 @@
1
- # encoding: utf-8
2
-
3
- require 'stringio'
4
- require 'test/unit'
5
- require 'rubygems'
6
- require 'drb/drb'
7
- require "shoulda"
8
- require File.dirname(__FILE__) + '/../lib/flextures'
9
-
10
- ##ここ以下にlibにおいたソースを追記する
11
-
12
- require "flextures"
1
+ # encoding: utf-8
2
+
3
+ require 'stringio'
4
+ require 'test/unit'
5
+ require 'rubygems'
6
+ require 'drb/drb'
7
+ require "shoulda"
8
+ require File.dirname(__FILE__) + '/../lib/flextures'
9
+
10
+ ##ここ以下にlibにおいたソースを追記する
11
+
12
+ require "flextures"
@@ -1,187 +1,187 @@
1
- # encoding: utf-8
2
-
3
- class FlexturesDumperTest < Test::Unit::TestCase
4
- context Flextures::Dumper do
5
- context "TRANSLATE function rules" do
6
- context :binary do
7
- context :yml do
8
- setup do
9
- @trans = Flextures::Dumper::TRANSLATER[:binary]
10
- end
11
- should "nil translate 'null' string" do
12
- assert_equal "null", @trans.call( nil, :yml )
13
- end
14
- end
15
- context :csv do
16
- setup do
17
- @trans = Flextures::Dumper::TRANSLATER[:binary]
18
- end
19
- end
20
- end
21
- context :boolean do
22
- context :yml do
23
- setup do
24
- @trans = Flextures::Dumper::TRANSLATER[:boolean]
25
- end
26
- should "nil translate 'null' string" do
27
- assert_equal "null", @trans.call( nil, :yml )
28
- end
29
- should "0 translate false" do
30
- assert_equal false, @trans.call( 0, :yml )
31
- end
32
- should "natural number translat true" do
33
- assert_equal true, @trans.call( 1, :yml )
34
- end
35
- should " empty string translate dalse" do
36
- assert_equal false, @trans.call( "", :yml )
37
- end
38
- should "string translate true" do
39
- assert_equal true, @trans.call( "Hello", :yml )
40
- end
41
- end
42
- context :csv do
43
- setup do
44
- @trans = Flextures::Dumper::TRANSLATER[:boolean]
45
- end
46
- end
47
- end
48
- context :date do
49
- context :yml do
50
- setup do
51
- @trans = Flextures::Dumper::TRANSLATER[:date]
52
- end
53
- should "nil translate 'null' string" do
54
- assert_equal "null", @trans.call( nil, :yml )
55
- end
56
- should "empty string translate 'null' string" do
57
- assert_equal "null", @trans.call( "", :yml )
58
- end
59
- should "false translate 'null' string" do
60
- assert_equal "null", @trans.call( false, :yml )
61
- end
62
- end
63
- context :csv do
64
- setup do
65
- @trans = Flextures::Dumper::TRANSLATER[:date]
66
- end
67
- end
68
- end
69
- context :datetime do
70
- context :yml do
71
- setup do
72
- @trans = Flextures::Dumper::TRANSLATER[:datetime]
73
- end
74
- should "nil translate 'null' string" do
75
- assert_equal "null", @trans.call( nil, :yml )
76
- end
77
- should "empty string translate 'null' string" do
78
- assert_equal "null", @trans.call( "", :yml )
79
- end
80
- should "false translate 'null' string" do
81
- assert_equal "null", @trans.call( false, :yml )
82
- end
83
- end
84
- context :csv do
85
- end
86
- end
87
- context :float do
88
- context :yml do
89
- setup do
90
- @trans = Flextures::Dumper::TRANSLATER[:float]
91
- end
92
- should "integral number don't translate" do
93
- assert_equal 10, @trans.call( 10, :yml )
94
- end
95
- should "floating number don't translate" do
96
- assert_equal 1.5, @trans.call( 1.5, :yml )
97
- end
98
- should "nil translate 'null' string" do
99
- assert_equal "null", @trans.call( nil, :yml )
100
- end
101
- should "0 don't translate" do
102
- assert_equal "null", @trans.call( nil, :yml )
103
- end
104
- should "false don't translate" do
105
- assert_equal "null", @trans.call( nil, :yml )
106
- end
107
- end
108
- context :csv do
109
- end
110
- end
111
- context :integer do
112
- context :yml do
113
- setup do
114
- @trans = Flextures::Dumper::TRANSLATER[:integer]
115
- end
116
- should "integral number don't translate" do
117
- assert_equal 10, @trans.call( 10, :yml )
118
- end
119
- should "float number is floored" do
120
- assert_equal 1, @trans.call( 1.5, :yml )
121
- end
122
- should "nil translate 'null' string" do
123
- assert_equal "null", @trans.call( nil, :yml )
124
- end
125
- should "0 don't translate" do
126
- assert_equal 0, @trans.call( 0, :yml )
127
- end
128
- should "false translate 0" do
129
- assert_equal 0, @trans.call( false, :yml )
130
- end
131
- should "true translate 1" do
132
- assert_equal 1, @trans.call( true, :yml )
133
- end
134
- end
135
- context :csv do
136
- setup do
137
- @trans = Flextures::Dumper::TRANSLATER[:integer]
138
- end
139
- should "integral number don't translate" do
140
- assert_equal 10, @trans.call( 10, :csv )
141
- end
142
- should 'nil translate empty string' do
143
- assert_equal "", @trans.call( nil, :csv )
144
- end
145
- end
146
- end
147
- context :string do
148
- context :yml do
149
- setup do
150
- @trans = Flextures::Dumper::TRANSLATER[:string]
151
- end
152
- should "nil translate 'null' string" do
153
- assert_equal "null", @trans.call( nil, :yml )
154
- end
155
- should "empty string don't translate" do
156
- assert_equal "null", @trans.call( nil, :yml )
157
- end
158
- should "false don't translate" do
159
- assert_equal false, @trans.call( false, :yml )
160
- end
161
- should "true don't translate" do
162
- assert_equal true, @trans.call( true, :yml )
163
- end
164
- end
165
- end
166
- context :null do
167
- context :yml do
168
- setup do
169
- @trans = Flextures::Dumper::TRANSLATER[:null]
170
- end
171
- should "values is 'null' string" do
172
- assert_equal "null", @trans.call( nil, :yml )
173
- end
174
- end
175
- context :csv do
176
- setup do
177
- @trans = Flextures::Dumper::TRANSLATER[:null]
178
- end
179
- should "values is empty string" do
180
- assert_equal "", @trans.call( nil, :csv )
181
- end
182
- end
183
- end
184
- end
185
- end
186
- end
187
-
1
+ # encoding: utf-8
2
+
3
+ class FlexturesDumperTest < Test::Unit::TestCase
4
+ context Flextures::Dumper do
5
+ context "TRANSLATE function rules" do
6
+ context :binary do
7
+ context :yml do
8
+ setup do
9
+ @trans = Flextures::Dumper::TRANSLATER[:binary]
10
+ end
11
+ should "nil translate 'null' string" do
12
+ assert_equal "null", @trans.call( nil, :yml )
13
+ end
14
+ end
15
+ context :csv do
16
+ setup do
17
+ @trans = Flextures::Dumper::TRANSLATER[:binary]
18
+ end
19
+ end
20
+ end
21
+ context :boolean do
22
+ context :yml do
23
+ setup do
24
+ @trans = Flextures::Dumper::TRANSLATER[:boolean]
25
+ end
26
+ should "nil translate 'null' string" do
27
+ assert_equal "null", @trans.call( nil, :yml )
28
+ end
29
+ should "0 translate false" do
30
+ assert_equal false, @trans.call( 0, :yml )
31
+ end
32
+ should "natural number translat true" do
33
+ assert_equal true, @trans.call( 1, :yml )
34
+ end
35
+ should " empty string translate dalse" do
36
+ assert_equal false, @trans.call( "", :yml )
37
+ end
38
+ should "string translate true" do
39
+ assert_equal true, @trans.call( "Hello", :yml )
40
+ end
41
+ end
42
+ context :csv do
43
+ setup do
44
+ @trans = Flextures::Dumper::TRANSLATER[:boolean]
45
+ end
46
+ end
47
+ end
48
+ context :date do
49
+ context :yml do
50
+ setup do
51
+ @trans = Flextures::Dumper::TRANSLATER[:date]
52
+ end
53
+ should "nil translate 'null' string" do
54
+ assert_equal "null", @trans.call( nil, :yml )
55
+ end
56
+ should "empty string translate 'null' string" do
57
+ assert_equal "null", @trans.call( "", :yml )
58
+ end
59
+ should "false translate 'null' string" do
60
+ assert_equal "null", @trans.call( false, :yml )
61
+ end
62
+ end
63
+ context :csv do
64
+ setup do
65
+ @trans = Flextures::Dumper::TRANSLATER[:date]
66
+ end
67
+ end
68
+ end
69
+ context :datetime do
70
+ context :yml do
71
+ setup do
72
+ @trans = Flextures::Dumper::TRANSLATER[:datetime]
73
+ end
74
+ should "nil translate 'null' string" do
75
+ assert_equal "null", @trans.call( nil, :yml )
76
+ end
77
+ should "empty string translate 'null' string" do
78
+ assert_equal "null", @trans.call( "", :yml )
79
+ end
80
+ should "false translate 'null' string" do
81
+ assert_equal "null", @trans.call( false, :yml )
82
+ end
83
+ end
84
+ context :csv do
85
+ end
86
+ end
87
+ context :float do
88
+ context :yml do
89
+ setup do
90
+ @trans = Flextures::Dumper::TRANSLATER[:float]
91
+ end
92
+ should "integral number don't translate" do
93
+ assert_equal 10, @trans.call( 10, :yml )
94
+ end
95
+ should "floating number don't translate" do
96
+ assert_equal 1.5, @trans.call( 1.5, :yml )
97
+ end
98
+ should "nil translate 'null' string" do
99
+ assert_equal "null", @trans.call( nil, :yml )
100
+ end
101
+ should "0 don't translate" do
102
+ assert_equal "null", @trans.call( nil, :yml )
103
+ end
104
+ should "false don't translate" do
105
+ assert_equal "null", @trans.call( nil, :yml )
106
+ end
107
+ end
108
+ context :csv do
109
+ end
110
+ end
111
+ context :integer do
112
+ context :yml do
113
+ setup do
114
+ @trans = Flextures::Dumper::TRANSLATER[:integer]
115
+ end
116
+ should "integral number don't translate" do
117
+ assert_equal 10, @trans.call( 10, :yml )
118
+ end
119
+ should "float number is floored" do
120
+ assert_equal 1, @trans.call( 1.5, :yml )
121
+ end
122
+ should "nil translate 'null' string" do
123
+ assert_equal "null", @trans.call( nil, :yml )
124
+ end
125
+ should "0 don't translate" do
126
+ assert_equal 0, @trans.call( 0, :yml )
127
+ end
128
+ should "false translate 0" do
129
+ assert_equal 0, @trans.call( false, :yml )
130
+ end
131
+ should "true translate 1" do
132
+ assert_equal 1, @trans.call( true, :yml )
133
+ end
134
+ end
135
+ context :csv do
136
+ setup do
137
+ @trans = Flextures::Dumper::TRANSLATER[:integer]
138
+ end
139
+ should "integral number don't translate" do
140
+ assert_equal 10, @trans.call( 10, :csv )
141
+ end
142
+ should 'nil translate empty string' do
143
+ assert_equal "", @trans.call( nil, :csv )
144
+ end
145
+ end
146
+ end
147
+ context :string do
148
+ context :yml do
149
+ setup do
150
+ @trans = Flextures::Dumper::TRANSLATER[:string]
151
+ end
152
+ should "nil translate 'null' string" do
153
+ assert_equal "null", @trans.call( nil, :yml )
154
+ end
155
+ should "empty string don't translate" do
156
+ assert_equal "null", @trans.call( nil, :yml )
157
+ end
158
+ should "false don't translate" do
159
+ assert_equal false, @trans.call( false, :yml )
160
+ end
161
+ should "true don't translate" do
162
+ assert_equal true, @trans.call( true, :yml )
163
+ end
164
+ end
165
+ end
166
+ context :null do
167
+ context :yml do
168
+ setup do
169
+ @trans = Flextures::Dumper::TRANSLATER[:null]
170
+ end
171
+ should "values is 'null' string" do
172
+ assert_equal "null", @trans.call( nil, :yml )
173
+ end
174
+ end
175
+ context :csv do
176
+ setup do
177
+ @trans = Flextures::Dumper::TRANSLATER[:null]
178
+ end
179
+ should "values is empty string" do
180
+ assert_equal "", @trans.call( nil, :csv )
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
187
+
@@ -1,37 +1,37 @@
1
- # encoding: utf-8
2
-
3
- class FlexturesTest < Test::Unit::TestCase
4
- context "Array#to_hash" do
5
- context "when column size is equal data size" do
6
- setup do
7
- @keys = %W[id name hp]
8
- @values = %W[1 hoge 100]
9
- @h = @values.extend(Flextures::Extensions::Array).to_hash(@keys)
10
- end
11
- should "return hash" do
12
- assert_equal @h, { "id"=>"1", "name"=>"hoge", "hp"=>"100" }
13
- end
14
- end
15
- context "when column size is bigger than data size" do
16
- setup do
17
- @keys = %W[id name hp]
18
- @values = %W[1 hoge]
19
- @h = @values.extend(Flextures::Extensions::Array).to_hash(@keys)
20
- end
21
- should "return hash, overflow key is filled 'nil'" do
22
- assert_equal @h, { "id"=>"1", "name"=>"hoge", "hp"=> nil }
23
- end
24
- end
25
- context "when column size is smaller than data size" do
26
- setup do
27
- @keys = %W[id name]
28
- @values = %W[1 hoge 200]
29
- @h = @values.extend(Flextures::Extensions::Array).to_hash(@keys)
30
- end
31
- should "return hash, overflow value is cut offed" do
32
- assert_equal @h, { "id"=>"1", "name"=>"hoge" }
33
- end
34
- end
35
- end
36
- end
37
-
1
+ # encoding: utf-8
2
+
3
+ class FlexturesTest < Test::Unit::TestCase
4
+ context "Array#to_hash" do
5
+ context "when column size is equal data size" do
6
+ setup do
7
+ @keys = %W[id name hp]
8
+ @values = %W[1 hoge 100]
9
+ @h = @values.extend(Flextures::Extensions::Array).to_hash(@keys)
10
+ end
11
+ should "return hash" do
12
+ assert_equal @h, { "id"=>"1", "name"=>"hoge", "hp"=>"100" }
13
+ end
14
+ end
15
+ context "when column size is bigger than data size" do
16
+ setup do
17
+ @keys = %W[id name hp]
18
+ @values = %W[1 hoge]
19
+ @h = @values.extend(Flextures::Extensions::Array).to_hash(@keys)
20
+ end
21
+ should "return hash, overflow key is filled 'nil'" do
22
+ assert_equal @h, { "id"=>"1", "name"=>"hoge", "hp"=> nil }
23
+ end
24
+ end
25
+ context "when column size is smaller than data size" do
26
+ setup do
27
+ @keys = %W[id name]
28
+ @values = %W[1 hoge 200]
29
+ @h = @values.extend(Flextures::Extensions::Array).to_hash(@keys)
30
+ end
31
+ should "return hash, overflow value is cut offed" do
32
+ assert_equal @h, { "id"=>"1", "name"=>"hoge" }
33
+ end
34
+ end
35
+ end
36
+ end
37
+
@@ -1,90 +1,90 @@
1
- # encoding: utf-8
2
-
3
- class FlexturesHookTest < Test::Unit::TestCase
4
- context Flextures::Loader do
5
- context ".parse_flextures_options" do
6
- context "set one table" do
7
- setup do
8
- @list = Flextures::Loader.parse_flextures_options(:users)
9
- end
10
- should "return table is Array" do
11
- assert_equal true, @list.is_a?(Array)
12
- end
13
- should "return table is only one" do
14
- assert_equal 1, @list.size
15
- end
16
- should "return data is content Hash data" do
17
- assert_equal true, @list.first.is_a?(Hash)
18
- end
19
- should "return data is contain loading table infomation" do
20
- h = { table: :users, file: "users", loader: :fun }
21
- assert_equal h, @list.first
22
- end
23
- end
24
- context "if set file name option" do
25
- setup do
26
- @list = Flextures::Loader.parse_flextures_options( :users => :users_another3 )
27
- end
28
- should "returned data size is only one" do
29
- assert_equal 1, @list.size
30
- end
31
- should " 'file' option is changed setted file name" do
32
- assert_equal :users_another3, @list.first[:file]
33
- end
34
- should "returned data include data" do
35
- h = { table: :users, file: :users_another3, loader: :fun }
36
- assert_equal h, @list.first
37
- end
38
- end
39
- context "if set 'cache' option" do
40
- setup do
41
- @list = Flextures::Loader.parse_flextures_options( { cache: true }, :users )
42
- end
43
- should "setted cache option" do
44
- assert_equal true, @list.first[:cache]
45
- end
46
- end
47
- context " if set 'dir' option " do
48
- setup do
49
- @list = Flextures::Loader.parse_flextures_options( { dir: "a/b/c" }, :users )
50
- end
51
- should "setted cache option" do
52
- assert_equal "a/b/c", @list.first[:dir]
53
- end
54
- end
55
- context " if set 'controller' option " do
56
- setup do
57
- @list = Flextures::Loader.parse_flextures_options( { controller: "top" }, :users )
58
- end
59
- should "setted cache option" do
60
- assert_equal "controllers/top", @list.first[:dir]
61
- end
62
- end
63
- context " if set 'controller' and 'action' option " do
64
- setup do
65
- @list = Flextures::Loader.parse_flextures_options( { controller: "top", action:"index" }, :users )
66
- end
67
- should "setted cache option" do
68
- assert_equal "controllers/top/index", @list.first[:dir]
69
- end
70
- end
71
- context " if set 'model' option " do
72
- setup do
73
- @list = Flextures::Loader.parse_flextures_options( { model: "users" }, :users )
74
- end
75
- should "setted cache option" do
76
- assert_equal "models/users", @list.first[:dir]
77
- end
78
- end
79
- context " if set 'model' and 'method' option " do
80
- setup do
81
- @list = Flextures::Loader.parse_flextures_options( { model: "users", method:"login" }, :users )
82
- end
83
- should "setted cache option" do
84
- assert_equal "models/users/login", @list.first[:dir]
85
- end
86
- end
87
- end
88
- end
89
- end
90
-
1
+ # encoding: utf-8
2
+
3
+ class FlexturesHookTest < Test::Unit::TestCase
4
+ context Flextures::Loader do
5
+ context ".parse_flextures_options" do
6
+ context "set one table" do
7
+ setup do
8
+ @list = Flextures::Loader.parse_flextures_options(:users)
9
+ end
10
+ should "return table is Array" do
11
+ assert_equal true, @list.is_a?(Array)
12
+ end
13
+ should "return table is only one" do
14
+ assert_equal 1, @list.size
15
+ end
16
+ should "return data is content Hash data" do
17
+ assert_equal true, @list.first.is_a?(Hash)
18
+ end
19
+ should "return data is contain loading table infomation" do
20
+ h = { table: :users, file: "users", loader: :fun }
21
+ assert_equal h, @list.first
22
+ end
23
+ end
24
+ context "if set file name option" do
25
+ setup do
26
+ @list = Flextures::Loader.parse_flextures_options( :users => :users_another3 )
27
+ end
28
+ should "returned data size is only one" do
29
+ assert_equal 1, @list.size
30
+ end
31
+ should " 'file' option is changed setted file name" do
32
+ assert_equal :users_another3, @list.first[:file]
33
+ end
34
+ should "returned data include data" do
35
+ h = { table: :users, file: :users_another3, loader: :fun }
36
+ assert_equal h, @list.first
37
+ end
38
+ end
39
+ context "if set 'cache' option" do
40
+ setup do
41
+ @list = Flextures::Loader.parse_flextures_options( { cache: true }, :users )
42
+ end
43
+ should "setted cache option" do
44
+ assert_equal true, @list.first[:cache]
45
+ end
46
+ end
47
+ context " if set 'dir' option " do
48
+ setup do
49
+ @list = Flextures::Loader.parse_flextures_options( { dir: "a/b/c" }, :users )
50
+ end
51
+ should "setted cache option" do
52
+ assert_equal "a/b/c", @list.first[:dir]
53
+ end
54
+ end
55
+ context " if set 'controller' option " do
56
+ setup do
57
+ @list = Flextures::Loader.parse_flextures_options( { controller: "top" }, :users )
58
+ end
59
+ should "setted cache option" do
60
+ assert_equal "controllers/top", @list.first[:dir]
61
+ end
62
+ end
63
+ context " if set 'controller' and 'action' option " do
64
+ setup do
65
+ @list = Flextures::Loader.parse_flextures_options( { controller: "top", action:"index" }, :users )
66
+ end
67
+ should "setted cache option" do
68
+ assert_equal "controllers/top/index", @list.first[:dir]
69
+ end
70
+ end
71
+ context " if set 'model' option " do
72
+ setup do
73
+ @list = Flextures::Loader.parse_flextures_options( { model: "users" }, :users )
74
+ end
75
+ should "setted cache option" do
76
+ assert_equal "models/users", @list.first[:dir]
77
+ end
78
+ end
79
+ context " if set 'model' and 'method' option " do
80
+ setup do
81
+ @list = Flextures::Loader.parse_flextures_options( { model: "users", method:"login" }, :users )
82
+ end
83
+ should "setted cache option" do
84
+ assert_equal "models/users/login", @list.first[:dir]
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+
@@ -36,9 +36,15 @@ class FlexturesLoaderTest < Test::Unit::TestCase
36
36
  should "'true' value not changed" do
37
37
  assert_equal true, Flextures::Loader::TRANSLATER[:boolean].call('true')
38
38
  end
39
+ should "'TRUE' value not changed" do
40
+ assert_equal true, Flextures::Loader::TRANSLATER[:boolean].call('TRUE')
41
+ end
39
42
  should "'false' value not changed" do
40
43
  assert_equal false, Flextures::Loader::TRANSLATER[:boolean].call('false')
41
44
  end
45
+ should "'FALSE' value not changed" do
46
+ assert_equal false, Flextures::Loader::TRANSLATER[:boolean].call('FALSE')
47
+ end
42
48
  should "'non-falsy string data' is change to 'true'" do
43
49
  assert_equal true, Flextures::Loader::TRANSLATER[:boolean].call("Hello")
44
50
  end
@@ -238,7 +244,7 @@ class FlexturesLoaderTest < Test::Unit::TestCase
238
244
  end
239
245
  end
240
246
  end
241
-
247
+
242
248
  context ".loading_order" do
243
249
  context "simple test" do
244
250
  setup do
@@ -263,4 +269,3 @@ class FlexturesLoaderTest < Test::Unit::TestCase
263
269
  end
264
270
  end
265
271
  end
266
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flextures
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - baban
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-28 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.2.0.rc.1
99
+ rubygems_version: 2.4.5.1
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: load and dump fixtures.