flextures 2.0.1 → 2.0.2
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.
- data/Gemfile +6 -2
- data/Gemfile.lock +12 -0
- data/VERSION +1 -1
- data/flextures.gemspec +9 -4
- data/lib/flextures/flextures_loader.rb +2 -2
- data/lib/flextures/version.rb +4 -0
- data/test/test_helper.rb +12 -0
- data/test/unit/test_flextures.rb +8 -0
- data/test/unit/test_flextures_dumper.rb +171 -0
- data/test/unit/test_simple.rb +8 -0
- metadata +9 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
+
activesupport (3.2.8)
|
|
5
|
+
i18n (~> 0.6)
|
|
6
|
+
multi_json (~> 1.0)
|
|
4
7
|
git (1.2.5)
|
|
8
|
+
i18n (0.6.0)
|
|
5
9
|
jeweler (1.8.3)
|
|
6
10
|
bundler (~> 1.0)
|
|
7
11
|
git (>= 1.2.5)
|
|
8
12
|
rake
|
|
9
13
|
rdoc
|
|
10
14
|
json (1.6.6)
|
|
15
|
+
multi_json (1.3.6)
|
|
11
16
|
rake (0.9.2.2)
|
|
12
17
|
rdoc (3.12)
|
|
13
18
|
json (~> 1.4)
|
|
19
|
+
shoulda (3.1.1)
|
|
20
|
+
shoulda-context (~> 1.0)
|
|
21
|
+
shoulda-matchers (~> 1.2)
|
|
22
|
+
shoulda-context (1.0.0)
|
|
23
|
+
shoulda-matchers (1.2.0)
|
|
24
|
+
activesupport (>= 3.0.0)
|
|
14
25
|
|
|
15
26
|
PLATFORMS
|
|
16
27
|
ruby
|
|
@@ -18,3 +29,4 @@ PLATFORMS
|
|
|
18
29
|
DEPENDENCIES
|
|
19
30
|
bundler (= 1.1.3)
|
|
20
31
|
jeweler (= 1.8.3)
|
|
32
|
+
shoulda
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.
|
|
1
|
+
2.0.2
|
data/flextures.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "flextures"
|
|
8
|
-
s.version = "2.0.
|
|
8
|
+
s.version = "2.0.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["baban"]
|
|
12
|
-
s.date = "2012-
|
|
12
|
+
s.date = "2012-09-20"
|
|
13
13
|
s.description = "load and dump fixtures"
|
|
14
14
|
s.email = "babanba.n@gmail.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -40,12 +40,17 @@ Gem::Specification.new do |s|
|
|
|
40
40
|
"lib/flextures/flextures_loader.rb",
|
|
41
41
|
"lib/flextures/flextures_railtie.rb",
|
|
42
42
|
"lib/flextures/rspec_flextures_support.rb",
|
|
43
|
-
"lib/flextures/testunit_flextures_support.rb"
|
|
43
|
+
"lib/flextures/testunit_flextures_support.rb",
|
|
44
|
+
"lib/flextures/version.rb",
|
|
45
|
+
"test/test_helper.rb",
|
|
46
|
+
"test/unit/test_flextures.rb",
|
|
47
|
+
"test/unit/test_flextures_dumper.rb",
|
|
48
|
+
"test/unit/test_simple.rb"
|
|
44
49
|
]
|
|
45
50
|
s.homepage = "http://github.com/baban/flextures"
|
|
46
51
|
s.licenses = ["MIT"]
|
|
47
52
|
s.require_paths = ["lib"]
|
|
48
|
-
s.rubygems_version = "1.8.
|
|
53
|
+
s.rubygems_version = "1.8.24"
|
|
49
54
|
s.summary = "load and dump fixtures"
|
|
50
55
|
|
|
51
56
|
if s.respond_to? :specification_version then
|
|
@@ -158,7 +158,7 @@ module Flextures
|
|
|
158
158
|
csv.each do |values|
|
|
159
159
|
h = values.extend(Extensions::Array).to_hash(keys)
|
|
160
160
|
o = filter.call h
|
|
161
|
-
o.save
|
|
161
|
+
o.save( validate: false )
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
"#{file_name}.csv"
|
|
@@ -187,7 +187,7 @@ module Flextures
|
|
|
187
187
|
yaml.each do |k,h|
|
|
188
188
|
warning "YAML", attributes, h.keys
|
|
189
189
|
o = filter.call h
|
|
190
|
-
o.save
|
|
190
|
+
o.save( validate: false )
|
|
191
191
|
end
|
|
192
192
|
"#{file_name}.yml"
|
|
193
193
|
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
# ruby -I"lib:lib:test" -I"/Users/matsubaramasanao/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib" "/Users/matsubaramasanao/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" test/**/test_*.rb
|
|
4
|
+
# ruby -I"lib:lib:test" "/Users/matsubaramasanao/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" test/**/test_*.rb
|
|
5
|
+
|
|
6
|
+
class FlexturesDumperTest < Test::Unit::TestCase
|
|
7
|
+
context Flextures::Dumper do
|
|
8
|
+
should "データの型が一致" do
|
|
9
|
+
assert_equal Module, Flextures::Dumper.class
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context "データ型を以下のフォーマットに変換" do
|
|
13
|
+
context :binary do
|
|
14
|
+
context :yml do
|
|
15
|
+
setup do
|
|
16
|
+
@trans = Flextures::Dumper::TRANSLATER[:binary]
|
|
17
|
+
end
|
|
18
|
+
should "「nil」は文字列「'null'」" do
|
|
19
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
context :csv do
|
|
23
|
+
setup do
|
|
24
|
+
@trans = Flextures::Dumper::TRANSLATER[:binary]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
context :boolean do
|
|
29
|
+
context :yml do
|
|
30
|
+
setup do
|
|
31
|
+
@trans = Flextures::Dumper::TRANSLATER[:boolean]
|
|
32
|
+
end
|
|
33
|
+
should "「nil」は文字列「'null'」" do
|
|
34
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
35
|
+
end
|
|
36
|
+
should "「0」は「false」" do
|
|
37
|
+
assert_equal false, @trans.call( 0, :yml )
|
|
38
|
+
end
|
|
39
|
+
should "「0以外の数」は「true」" do
|
|
40
|
+
assert_equal true, @trans.call( 1, :yml )
|
|
41
|
+
end
|
|
42
|
+
should "「空文字」は「false」" do
|
|
43
|
+
assert_equal false, @trans.call( "", :yml )
|
|
44
|
+
end
|
|
45
|
+
should "「文字列」は「true」" do
|
|
46
|
+
assert_equal true, @trans.call( "Hello", :yml )
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
context :csv do
|
|
50
|
+
setup do
|
|
51
|
+
@trans = Flextures::Dumper::TRANSLATER[:boolean]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
context :date do
|
|
56
|
+
context :yml do
|
|
57
|
+
setup do
|
|
58
|
+
@trans = Flextures::Dumper::TRANSLATER[:date]
|
|
59
|
+
end
|
|
60
|
+
should "「nil」は文字列「'null'」" do
|
|
61
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
62
|
+
end
|
|
63
|
+
should "「空文字」は文字列「'null'」" do
|
|
64
|
+
assert_equal "null", @trans.call( "", :yml )
|
|
65
|
+
end
|
|
66
|
+
should "「false」は文字列「'null'」" do
|
|
67
|
+
assert_equal "null", @trans.call( false, :yml )
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
context :csv do
|
|
71
|
+
setup do
|
|
72
|
+
@trans = Flextures::Dumper::TRANSLATER[:date]
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
context :datetime do
|
|
77
|
+
context :yml do
|
|
78
|
+
setup do
|
|
79
|
+
@trans = Flextures::Dumper::TRANSLATER[:datetime]
|
|
80
|
+
end
|
|
81
|
+
should "「nil」は文字列「'null'」" do
|
|
82
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
83
|
+
end
|
|
84
|
+
should "「空文字」は文字列「'null'」" do
|
|
85
|
+
assert_equal "null", @trans.call( "", :yml )
|
|
86
|
+
end
|
|
87
|
+
should "「false」は文字列「'null'」" do
|
|
88
|
+
assert_equal "null", @trans.call( false, :yml )
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
context :csv do
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
context :float do
|
|
95
|
+
context :yml do
|
|
96
|
+
setup do
|
|
97
|
+
@trans = Flextures::Dumper::TRANSLATER[:float]
|
|
98
|
+
end
|
|
99
|
+
should "「integer」はそのまま" do
|
|
100
|
+
assert_equal 10, @trans.call( 10, :yml )
|
|
101
|
+
end
|
|
102
|
+
should "「float」はそのまま" do
|
|
103
|
+
assert_equal 1.5, @trans.call( 1.5, :yml )
|
|
104
|
+
end
|
|
105
|
+
should "「nil」は文字列「'null'」" do
|
|
106
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
107
|
+
end
|
|
108
|
+
should "「0」は数字「0」" do
|
|
109
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
110
|
+
end
|
|
111
|
+
should "「false」は「false」のまま" do
|
|
112
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
context :csv do
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
context :integer do
|
|
119
|
+
context :yml do
|
|
120
|
+
setup do
|
|
121
|
+
@trans = Flextures::Dumper::TRANSLATER[:integer]
|
|
122
|
+
end
|
|
123
|
+
should "「integer」はそのまま" do
|
|
124
|
+
assert_equal 10, @trans.call( 10, :yml )
|
|
125
|
+
end
|
|
126
|
+
should "「float」は切り捨て" do
|
|
127
|
+
assert_equal 1, @trans.call( 1.5, :yml )
|
|
128
|
+
end
|
|
129
|
+
should "「nil」は文字列 「'null'」" do
|
|
130
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
131
|
+
end
|
|
132
|
+
should "「0」は「0」" do
|
|
133
|
+
assert_equal 0, @trans.call( 0, :yml )
|
|
134
|
+
end
|
|
135
|
+
should "「false」は「0」" do
|
|
136
|
+
assert_equal 0, @trans.call( false, :yml )
|
|
137
|
+
end
|
|
138
|
+
should "「true」は「1」" do
|
|
139
|
+
assert_equal 1, @trans.call( true, :yml )
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
context :csv do
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
context :string do
|
|
146
|
+
context :yml do
|
|
147
|
+
setup do
|
|
148
|
+
@trans = Flextures::Dumper::TRANSLATER[:string]
|
|
149
|
+
end
|
|
150
|
+
should "「nil」は文字列「'null'」" do
|
|
151
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
152
|
+
end
|
|
153
|
+
should "「空文字」は空文字を返す「''」" do
|
|
154
|
+
assert_equal "null", @trans.call( nil, :yml )
|
|
155
|
+
end
|
|
156
|
+
should "「false」は「false」" do
|
|
157
|
+
assert_equal false, @trans.call( false, :yml )
|
|
158
|
+
end
|
|
159
|
+
should "「true」は「true」" do
|
|
160
|
+
assert_equal false, @trans.call( false, :yml )
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
context :csv do
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
context :text do
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flextures
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -75,6 +75,11 @@ files:
|
|
|
75
75
|
- lib/flextures/flextures_railtie.rb
|
|
76
76
|
- lib/flextures/rspec_flextures_support.rb
|
|
77
77
|
- lib/flextures/testunit_flextures_support.rb
|
|
78
|
+
- lib/flextures/version.rb
|
|
79
|
+
- test/test_helper.rb
|
|
80
|
+
- test/unit/test_flextures.rb
|
|
81
|
+
- test/unit/test_flextures_dumper.rb
|
|
82
|
+
- test/unit/test_simple.rb
|
|
78
83
|
homepage: http://github.com/baban/flextures
|
|
79
84
|
licenses:
|
|
80
85
|
- MIT
|
|
@@ -90,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
90
95
|
version: '0'
|
|
91
96
|
segments:
|
|
92
97
|
- 0
|
|
93
|
-
hash: -
|
|
98
|
+
hash: -729505073
|
|
94
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
100
|
none: false
|
|
96
101
|
requirements:
|
|
@@ -99,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
99
104
|
version: '0'
|
|
100
105
|
requirements: []
|
|
101
106
|
rubyforge_project:
|
|
102
|
-
rubygems_version: 1.8.
|
|
107
|
+
rubygems_version: 1.8.24
|
|
103
108
|
signing_key:
|
|
104
109
|
specification_version: 3
|
|
105
110
|
summary: load and dump fixtures
|