OSDN Git Service

pass test: Picture.store
[pettanr/pettanr.git] / spec / models / picture_spec.rb
1 # -*- encoding: utf-8 -*-
2 #実素材
3 require 'spec_helper'
4
5 describe Picture do
6   before do
7     Factory :admin
8     @user = Factory( :user_yas)
9     @author = @user.author
10     @artist = Factory :artist_yas, :author_id => @author.id
11     @other_user = Factory( :user_yas)
12     @other_author = @other_user.author
13     @other_artist = Factory :artist_yas, :author_id => @other_author.id
14     @sp = Factory :system_picture
15     @lg = Factory :license_group
16     @license = Factory :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
17     @op = Factory :original_picture, :artist_id => @artist.id
18   end
19   
20   describe '検証に於いて' do
21     before do
22     end
23     
24     it 'オーソドックスなデータなら通る' do
25       @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
26       @p.should be_valid
27     end
28     
29     context 'original_picture_idを検証するとき' do
30       before do
31         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
32       end
33       it 'テストデータの確認' do
34         @p.original_picture_id = @op.id
35         @p.should be_valid
36       end
37       it 'nullなら失敗する' do
38         @p.original_picture_id = nil
39         @p.should_not be_valid
40       end
41       it '数値でなければ失敗する' do
42         @p.original_picture_id = 'a'
43         @p.should_not be_valid
44       end
45       it '存在する原画でなければ失敗する' do
46         @p.original_picture_id = 0
47         @p.should_not be_valid
48       end
49     end
50     context 'revisionを検証するとき' do
51       before do
52         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
53       end
54       it 'テストデータの確認' do
55         @p.revision = 1
56         @p.should be_valid
57       end
58       it 'nullなら失敗する' do
59         @p.revision = nil
60         @p.should_not be_valid
61       end
62       it '数値でなければ失敗する' do
63         @p.revision = 'a'
64         @p.should_not be_valid
65       end
66     end
67     context 'extを検証するとき' do
68       before do
69         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
70       end
71       it 'テストデータの確認' do
72         @p.ext = 'jpeg'
73         @p.should be_valid
74       end
75       it 'nullなら失敗する' do
76         @p.ext = ''
77         @p.should_not be_valid
78       end
79       it '5文字以上なら失敗する' do
80         @p.ext = 'a'*5
81         @p.should_not be_valid
82       end
83       it 'png,gif,jpeg以外なら失敗する' do
84         @p.ext = 'bmp'
85         @p.should_not be_valid
86       end
87     end
88     context 'widthを検証するとき' do
89       before do
90         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
91       end
92       it 'テストデータの確認' do
93         @p.width = 1
94         @p.should be_valid
95       end
96       it 'nullなら失敗する' do
97         @p.width = nil
98         @p.should_not be_valid
99       end
100       it '数値でなければ失敗する' do
101         @p.width = 'a'
102         @p.should_not be_valid
103       end
104       it '0なら失敗する' do
105         @p.width = '0'
106         @p.should_not be_valid
107       end
108       it '負でも失敗する' do
109         @p.width = -1
110         @p.should_not be_valid
111       end
112     end
113     context 'heightを検証するとき' do
114       before do
115         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
116       end
117       it 'テストデータの確認' do
118         @p.height = 1
119         @p.should be_valid
120       end
121       it 'nullなら失敗する' do
122         @p.height = nil
123         @p.should_not be_valid
124       end
125       it '数値でなければ失敗する' do
126         @p.height = 'a'
127         @p.should_not be_valid
128       end
129       it '0なら失敗する' do
130         @p.height = '0'
131         @p.should_not be_valid
132       end
133       it '負でも失敗する' do
134         @p.height = -1
135         @p.should_not be_valid
136       end
137     end
138     context 'filesizeを検証するとき' do
139       before do
140         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
141       end
142       it 'テストデータの確認' do
143         @p.filesize = 1
144         @p.should be_valid
145       end
146       it 'nullなら失敗する' do
147         @p.filesize = nil
148         @p.should_not be_valid
149       end
150       it '数値でなければ失敗する' do
151         @p.filesize = 'a'
152         @p.should_not be_valid
153       end
154       it '負なら失敗する' do
155         @p.filesize = '-1'
156         @p.should_not be_valid
157       end
158       it '2MB以上なら失敗する' do
159         @p.filesize = 2000000+1
160         @p.should_not be_valid
161       end
162     end
163     context 'artist_idを検証するとき' do
164       before do
165         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
166       end
167       it 'テストデータの確認' do
168         @p.artist_id = @artist.id
169         @p.should be_valid
170       end
171       it 'nullなら失敗する' do
172         @p.artist_id = nil
173         @p.should_not be_valid
174       end
175       it '数値でなければ失敗する' do
176         @p.artist_id = 'a'
177         @p.should_not be_valid
178       end
179       it '存在する絵師でなければ失敗する' do
180         @p.artist_id = 0
181         @p.should_not be_valid
182       end
183     end
184     context 'license_idを検証するとき' do
185       before do
186         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
187       end
188       it 'テストデータの確認' do
189         @p.license_id = @license.id
190         @p.should be_valid
191       end
192       it 'nullなら失敗する' do
193         @p.license_id = nil
194         @p.should_not be_valid
195       end
196       it '数値でなければ失敗する' do
197         @p.license_id = 'a'
198         @p.should_not be_valid
199       end
200       it '存在するライセンスグループでなければ失敗する' do
201         @p.license_id = 0
202         @p.should_not be_valid
203       end
204     end
205     context 'artist_nameを検証するとき' do
206       before do
207         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
208       end
209       it 'テストデータの確認' do
210         @p.artist_name = 'a'
211         @p.should be_valid
212       end
213       it 'nullなら失敗する' do
214         @p.artist_name = nil
215         @p.should_not be_valid
216       end
217     end
218     context 'creditを検証するとき' do
219       before do
220         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
221       end
222       it 'テストデータの確認' do
223         @p.credit = 'a'
224         @p.should be_valid
225       end
226     end
227     context 'settingsを検証するとき' do
228       before do
229         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
230       end
231       it 'テストデータの確認' do
232         @p.settings = 'a'
233         @p.should be_valid
234       end
235     end
236   end
237   describe '補充に於いて' do
238   end
239   describe '最新Revision取得に於いて' do
240     context '初めての原画を公開したとき' do
241       before do
242         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
243       end
244       it 'Revisionは1となる' do
245         @p.new_revision.should eq 1
246       end
247     end
248     context 'HEADが1のとき' do
249       before do
250         Factory :picture, :revision => 1, :original_picture_id => @op.id, :license_id => @license.id
251         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
252       end
253       it 'Revisionは2となる' do
254         @p.new_revision.should eq 2
255       end
256     end
257     context 'HEADが5のとき' do
258       before do
259         Factory :picture, :revision => 1, :original_picture_id => @op.id, :license_id => @license.id
260         Factory :picture, :revision => 5, :original_picture_id => @op.id, :license_id => @license.id
261         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
262       end
263       it 'Revisionは6となる' do
264         @p.new_revision.should eq 6
265       end
266     end
267   end
268   describe '作成に於いて' do
269     before do
270       #RMagickのスタブをおいておく
271       class Mgk ; class Image ; end ; end
272       @filesize = 76543
273       Mgk::Image.stub(:from_blob).with(any_args).and_return([Mgk.new])
274       Mgk.any_instance.stub(:format).with(any_args).and_return('png')
275       Mgk.any_instance.stub(:rows).with(any_args).and_return(200)
276       Mgk.any_instance.stub(:columns).with(any_args).and_return(100)
277       Mgk.any_instance.stub(:filesize).with(any_args).and_return(@filesize)
278       Mgk.any_instance.stub(:to_blob).with(any_args).and_return('data')
279       #原画ファイル削除だけは必ず成功するものとしておく
280       PictureIO::LocalPicture.any_instance.stub(:delete).with(any_args).and_return(true)
281     end
282     context '事前チェック' do
283       before do
284         #すべての処理が正常パターンで通過すれば、一番深い分岐まで通る。
285         #それで外部のメソッド呼び出しだけに着目してテストする。
286         Picture.any_instance.stub(:save).with(any_args).and_return(true)\r
287         Picture.any_instance.stub(:store_picture).with(any_args).and_return(true)\r
288         Picture.any_instance.stub(:to_gif?).with(any_args).and_return(true)\r
289         class GifMgk < Mgk ; end  #store_pictureは二回呼び出される。区別をつけるために\r
290         @gifmgk = GifMgk.new      #パラメータを二種類用意する。\r
291         Picture.stub(:png_to_gif).with(any_args).and_return(@gifmgk)
292         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
293       end
294       it '最新Revisionを取得している' do
295         Picture.any_instance.should_receive(:new_revision).with(any_args).exactly(1)
296         res = @p.store(Mgk.new)\r
297       end\r
298       it '自身を保存している' do
299         Picture.any_instance.should_receive(:save).with(any_args).exactly(1)
300         res = @p.store(Mgk.new)\r
301       end\r
302       it '画像ファイルの作成機能で画像を保存している' do\r
303         mgk = Mgk.new   #一回目の本画像保存は与えたオブジェクトを使って保存する。
304         Picture.any_instance.should_receive(:store_picture).with(mgk).exactly(1)
305         res = @p.store(mgk)\r
306       end\r
307       it '自身にgifフォーマット変換対象かを問い合わせている' do
308         Picture.any_instance.should_receive(:to_gif?).with(any_args).exactly(1)
309         res = @p.store(Mgk.new)\r
310       end\r
311       it '自身にGifフォーマット変換を依頼している' do
312         Picture.should_receive(:png_to_gif).with(any_args).exactly(1)
313         res = @p.store(Mgk.new)\r
314       end\r
315       it '画像ファイルの作成機能でgif画像を保存している' do\r
316         #二回目の保存はgif変換の結果を渡す。
317         Picture.any_instance.should_receive(:store_picture).with(@gifmgk).exactly(1)
318         res = @p.store(Mgk.new)\r
319       end\r
320     end
321     context 'つつがなく終わるとき' do
322       before do
323         #すべての処理を正常パターンで通過させ、保存機能をチェックする。
324 #        Picture.any_instance.stub(:save).with(any_args).and_return(true)\r
325         Picture.any_instance.stub(:store_picture).with(any_args).and_return(true)\r
326         Picture.any_instance.stub(:to_gif?).with(any_args).and_return(true)\r
327         class GifMgk < Mgk ; end  #store_pictureは二回呼び出される。区別をつけるために\r
328         @gifmgk = GifMgk.new      #パラメータを二種類用意する。\r
329         Picture.stub(:png_to_gif).with(any_args).and_return(@gifmgk)
330         @p = Factory.build :picture, :revision => nil, :original_picture_id => @op.id, :license_id => @license.id
331       end
332       it 'Trueを返す' do
333         res = @p.store(Mgk.new)\r
334         res.should be_true\r
335       end\r
336       it 'Revisionに最新Revisionセット' do
337         res = @p.store(Mgk.new)\r
338         @p.revision.should eq 1\r
339       end\r
340       it '自身が保存されている' do\r
341         lambda {
342           res = @p.store(Mgk.new)\r
343         }.should change Picture, :count\r
344       end\r
345     end
346     context 'gif変換なしで、つつがなく終わるとき' do
347       before do
348         #すべての処理を正常パターンで通過させ、保存機能をチェックする。
349         Picture.any_instance.stub(:save).with(any_args).and_return(true)\r
350         Picture.any_instance.stub(:store_picture).with(any_args).and_return(true)\r
351         Picture.any_instance.stub(:to_gif?).with(any_args).and_return(false)\r
352         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
353       end
354       it 'Trueを返す' do
355         res = @p.store(Mgk.new)\r
356         res.should be_true\r
357       end\r
358       it 'gif保存は呼ばれていない' do
359         #二回目の画像作成が呼び出されないで1回こっきりならgif保存は呼ばれていないんだろう。\r
360         Picture.any_instance.should_receive(:store_picture).with(any_args).exactly(1)
361         res = @p.store(Mgk.new)\r
362       end\r
363     end
364     #以下から例外ケース。処理先頭から失敗させていく
365     context '自身の保存に失敗したとき' do
366       before do
367         Picture.any_instance.stub(:save).with(any_args).and_return(false)\r
368         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
369       end
370       it 'Falseを返す' do
371         res = @p.store(Mgk.new)\r
372         res.should be_false\r
373       end\r
374       it '更新されていない' do
375         @p.store(Mgk.new)
376         @p.should be_a_new Picture\r
377       end
378     end
379     context '画像の保存に失敗したとき' do
380       before do
381         Picture.any_instance.stub(:save).with(any_args).and_return(true)\r
382         Picture.any_instance.stub(:store_picture).with(any_args).and_return(false)\r
383         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
384       end
385       it 'Falseを返す' do
386         res = @p.store(Mgk.new)\r
387         res.should be_false\r
388       end\r
389       it 'gif変換判定は呼ばれていない' do\r
390         Picture.any_instance.should_not_receive(:to_gif?).with(any_args)
391         res = @p.store(Mgk.new)\r
392       end\r
393     end
394     context 'gif変換に失敗したとき' do
395       before do
396         Picture.any_instance.stub(:save).with(any_args).and_return(true)\r
397         Picture.any_instance.stub(:store_picture).with(any_args).and_return(true)\r
398         Picture.any_instance.stub(:to_gif?).with(any_args).and_return(true)\r
399         Picture.stub(:png_to_gif).with(any_args).and_return(false)
400         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
401       end
402       it 'Falseを返す' do
403         res = @p.store(Mgk.new)\r
404         res.should be_false\r
405       end\r
406       it 'gif画像の保存は呼ばれていない' do\r
407         #本画像の保存があるので、一度は呼ばれる\r
408         Picture.any_instance.should_receive(:store_picture).with(any_args).exactly(1)
409         res = @p.store(Mgk.new)\r
410       end\r
411     end
412     context 'gif画像の保存に失敗したとき' do
413       before do\r
414         @mgk = Mgk.new
415         Picture.any_instance.stub(:save).with(any_args).and_return(true)\r
416         Picture.any_instance.stub(:store_picture).with(@mgk).and_return(true)\r
417         Picture.any_instance.stub(:to_gif?).with(any_args).and_return(true)\r
418         class GifMgk < Mgk ; end  #store_pictureは二回呼び出される。区別をつけるために\r
419         @gifmgk = GifMgk.new      #パラメータを二種類用意する。\r
420         Picture.stub(:png_to_gif).with(any_args).and_return(@gifmgk)
421         Picture.any_instance.stub(:store_picture).with(@gifmgk).and_return(false)\r
422         @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
423       end
424       it 'Falseを返す' do
425         res = @p.store(@mgk)\r
426         res.should be_false\r
427       end\r
428     end
429   end\r
430   
431   describe '反転画像の保存先に於いて' do\r
432     before do
433       @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
434     end
435     context '禁止のとき' do
436       it 'ベースディレクトリだけを返す' do
437         Picture.any_instance.should_receive(:flag_reverse).with(any_args).and_return(-1)
438         r = @p.subdirs
439         r.should have(1).item \r
440       end\r
441       it 'ベースディレクトリだけを返す' do
442         Picture.any_instance.should_receive(:flag_reverse).with(any_args).and_return(-1)
443         r = @p.subdirs
444         r.first.should eq ''\r
445       end\r
446     end\r
447     context '許可のとき' do
448       it 'ベースディレクトリと反転3種を返す' do
449         Picture.any_instance.should_receive(:flag_reverse).with(any_args).and_return(1)
450         r = @p.subdirs
451         r.should have(4).item \r
452       end\r
453       it 'ベースディレクトリと反転3種を返す' do
454         Picture.any_instance.should_receive(:flag_reverse).with(any_args).and_return(1)
455         r = @p.subdirs
456         r.last.should eq 'vh'\r
457       end\r
458     end\r
459   end\r
460   
461   describe '画像ファイルの作成に於いて' do\r
462     #PictureIo経由で画像を保存するための機能。ファイル名に自身のidを使うので事前に自身の保存が必要。\r
463     before do
464       #RMagickのスタブをおいておく
465       class Mgk ; class Image ; end ; end
466       @filesize = 76543
467       Mgk::Image.stub(:from_blob).with(any_args).and_return([Mgk.new])
468       Mgk.any_instance.stub(:format).with(any_args).and_return('png')
469       Mgk.any_instance.stub(:rows).with(any_args).and_return(200)
470       Mgk.any_instance.stub(:columns).with(any_args).and_return(100)
471       Mgk.any_instance.stub(:filesize).with(any_args).and_return(@filesize)
472       Mgk.any_instance.stub(:to_blob).with(any_args).and_return('data')
473       #原画ファイル削除だけは必ず成功するものとしておく
474       PictureIO::LocalPicture.any_instance.stub(:delete).with(any_args).and_return(true)
475       
476       Picture.any_instance.stub(:subdirs).with(any_args).and_return(['', 'v', 'h', 'vh'])\r
477       Picture.any_instance.stub(:h).with(any_args).and_return('data')
478       Picture.any_instance.stub(:v).with(any_args).and_return('data')
479       Picture.any_instance.stub(:vh).with(any_args).and_return('data')
480       @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id
481     end
482     context '事前チェック' do
483       before do
484         #すべての処理を正常パターンで通過させ、保存機能をチェックする。
485         PictureIO.picture_io.stub(:put).with(any_args).and_return(true)
486       end
487       it '画像ファイルの保存が4回呼ばれる' do\r
488         PictureIO.picture_io.should_receive(:put).with(any_args).exactly(4)
489         res = @p.store_picture(Mgk.new)\r
490       end\r
491       it '画像ファイルのベースへの保存が1回呼ばれる' do\r
492         PictureIO.picture_io.should_receive(:put).with('data', @p.filename, '').exactly(1)
493         res = @p.store_picture(Mgk.new)\r
494       end\r
495       it '画像ファイルの垂直反転への保存が1回呼ばれる' do\r
496         PictureIO.picture_io.should_receive(:put).with('data', @p.filename, 'v').exactly(1)
497         res = @p.store_picture(Mgk.new)\r
498       end\r
499       it '画像ファイルの水平反転への保存が1回呼ばれる' do\r
500         PictureIO.picture_io.should_receive(:put).with('data', @p.filename, 'h').exactly(1)
501         res = @p.store_picture(Mgk.new)\r
502       end\r
503       it '画像ファイルの垂直水平反転への保存が1回呼ばれる' do\r
504         PictureIO.picture_io.should_receive(:put).with('data', @p.filename, 'vh').exactly(1)
505         res = @p.store_picture(Mgk.new)\r
506       end\r
507       it '垂直反転が1回呼ばれる' do\r
508         Picture.any_instance.should_receive(:v).with(any_args).exactly(1)
509         res = @p.store_picture(Mgk.new)\r
510       end\r
511       it '水平反転が1回呼ばれる' do\r
512         Picture.any_instance.should_receive(:h).with(any_args).exactly(1)
513         res = @p.store_picture(Mgk.new)\r
514       end\r
515       it '垂直水平反転が1回呼ばれる' do\r
516         Picture.any_instance.should_receive(:vh).with(any_args).exactly(1)
517         res = @p.store_picture(Mgk.new)\r
518       end\r
519     end
520     context 'つつがなく終わるとき' do
521       before do
522         #すべての処理を正常パターンで通過させ、保存機能をチェックする。\r
523         PictureIO.picture_io.stub(:put).with(any_args).and_return(true)
524       end
525       it 'Trueを返す' do
526         res = @p.store_picture(Mgk.new)\r
527         res.should be_true\r
528       end\r
529     end
530     context '例外ケース' do
531       before do
532         PictureIO.picture_io.stub(:put).with(any_args).and_return(false)
533       end
534       it 'Falseを返す' do
535         res = @p.store_picture(Mgk.new)\r
536         res.should be_false\r
537       end\r
538     end
539     
540   end
541   
542   describe 'フラグ展開に於いて' do
543     before do
544       @p = Factory.build :picture, :original_picture_id => @op.id, :license_id => @license.id,
545         :settings => "{\"open\": 1, \"commercial\": 2, \"official\": 3, \"attribution\": 4, \"derive\": 5, \"thumbnail\": 6, \"gif_convert\": 7, \"reverse\": 8, \"resize\": 9, \"sync_vh\": 10, \"overlap\": 11}"
546     end
547     context 'json展開チェック' do
548       it '展開してなければ展開して@flagsに保管する' do
549         @p.flags.should_not be_nil
550       end
551       it '展開できなければnilのまま' do
552         @p.settings += '}'
553         @p.flags.should be_nil
554       end
555     end
556     context 'openについて' do
557       it '@flag_openに保管する' do
558         @p.flag_open.should_not be_nil
559       end
560       it '本当にフラグHashからじゃなく、変数から取得してる?' do
561         @p.flag_open
562         @p.flags = nil
563         @p.flag_open.should_not be_nil
564       end
565       it '1を返す' do
566         @p.flag_open.should eq 1
567       end
568     end
569     context 'commercialについて' do
570       it '@flag_commercialに保管する' do
571         @p.flag_commercial.should_not be_nil
572       end
573       it '本当にフラグHashからじゃなく、変数から取得してる?' do
574         @p.flag_commercial
575         @p.flags = nil
576         @p.flag_commercial.should_not be_nil
577       end
578       it '2を返す' do
579         @p.flag_commercial.should eq 2
580       end
581     end
582     context 'officialについて' do
583       it '@flag_officialに保管する' do
584         @p.flag_official.should_not be_nil
585       end
586       it '本当にフラグHashからじゃなく、変数から取得してる?' do
587         @p.flag_official
588         @p.flags = nil
589         @p.flag_official.should_not be_nil
590       end
591       it 'を返す' do
592         @p.flag_official.should eq 3
593       end
594     end
595     context 'attributionについて' do
596       it '@flag_attributionに保管する' do
597         @p.flag_attribution.should_not be_nil
598       end
599       it '本当にフラグHashからじゃなく、変数から取得してる?' do
600         @p.flag_attribution
601         @p.flags = nil
602         @p.flag_attribution.should_not be_nil
603       end
604       it '4を返す' do
605         @p.flag_attribution.should eq 4
606       end
607     end
608     context 'deriveについて' do
609       it '@flag_deriveに保管する' do
610         @p.flag_derive.should_not be_nil
611       end
612       it '本当にフラグHashからじゃなく、変数から取得してる?' do
613         @p.flag_derive
614         @p.flags = nil
615         @p.flag_derive.should_not be_nil
616       end
617       it '5を返す' do
618         @p.flag_derive.should eq 5
619       end
620     end
621     context 'thumbnailについて' do
622       it '@flag_thumbnailに保管する' do
623         @p.flag_thumbnail.should_not be_nil
624       end
625       it '本当にフラグHashからじゃなく、変数から取得してる?' do
626         @p.flag_thumbnail
627         @p.flags = nil
628         @p.flag_thumbnail.should_not be_nil
629       end
630       it '6を返す' do
631         @p.flag_thumbnail.should eq 6
632       end
633     end
634     context 'gif_convertについて' do
635       it '@flag_gif_convertに保管する' do
636         @p.flag_gif_convert.should_not be_nil
637       end
638       it '本当にフラグHashからじゃなく、変数から取得してる?' do
639         @p.flag_gif_convert
640         @p.flags = nil
641         @p.flag_gif_convert.should_not be_nil
642       end
643       it '7を返す' do
644         @p.flag_gif_convert.should eq 7
645       end
646     end
647     context 'reverseについて' do
648       it '@flag_reverseに保管する' do
649         @p.flag_reverse.should_not be_nil
650       end
651       it '本当にフラグHashからじゃなく、変数から取得してる?' do
652         @p.flag_reverse
653         @p.flags = nil
654         @p.flag_reverse.should_not be_nil
655       end
656       it '8を返す' do
657         @p.flag_reverse.should eq 8
658       end
659     end
660     context 'resizeについて' do
661       it '@flag_resizeに保管する' do
662         @p.flag_resize.should_not be_nil
663       end
664       it '本当にフラグHashからじゃなく、変数から取得してる?' do
665         @p.flag_resize
666         @p.flags = nil
667         @p.flag_resize.should_not be_nil
668       end
669       it '9を返す' do
670         @p.flag_resize.should eq 9
671       end
672     end
673     context 'sync_vhについて' do
674       it '@flag_sync_vhに保管する' do
675         @p.flag_sync_vh.should_not be_nil
676       end
677       it '本当にフラグHashからじゃなく、変数から取得してる?' do
678         @p.flag_sync_vh
679         @p.flags = nil
680         @p.flag_sync_vh.should_not be_nil
681       end
682       it '10を返す' do
683         @p.flag_sync_vh.should eq 10
684       end
685     end
686     context 'overlapについて' do
687       it '@flag_overlapに保管する' do
688         @p.flag_overlap.should_not be_nil
689       end
690       it '本当にフラグHashからじゃなく、変数から取得してる?' do
691         @p.flag_overlap
692         @p.flags = nil
693         @p.flag_overlap.should_not be_nil
694       end
695       it '11を返す' do
696         @p.flag_overlap.should eq 11
697       end
698     end
699   end
700 \r
701 end