OSDN Git Service

rspecのインストール周りが最近なんだかオカシイので現実的な方法に修正
[elecoma/elecoma.git] / spec / controllers / admin / shops_controller_spec.rb
1 # -*- coding: utf-8 -*-
2 require File.dirname(__FILE__) + '/../../spec_helper'
3
4 describe Admin::ShopsController do
5   fixtures :authorities, :functions, :admin_users , :shops, :retailers, :delivery_traders, :delivery_times
6   
7   before(:each) do
8     session[:admin_user] = admin_users(:load_by_admin_user_test_id_1)
9     @controller.class.skip_before_filter @controller.class.before_filter
10     @controller.class.skip_after_filter @controller.class.after_filter
11     @controller.class.before_filter :master_shop_check, :except => [:delivery_index, :delivery_new, :delivery_edit, :delivery_create, :delivery_update, :destroy, :sort]
12   end
13   
14   #Delete this example and add some real ones
15   it "should use Admin::ShopsController" do
16     controller.should be_an_instance_of(Admin::ShopsController)
17   end
18   
19   
20   
21   describe "GET 'index'" do
22     fixtures :shops,:systems
23     it "should be successful" do
24       get 'index'
25       response.should be_success
26       assigns[:shop].should == Shop.find(:first)
27     end
28
29     it "マスターショップ以外はアクセスできない" do
30       session[:admin_user] = admin_users(:admin18_retailer_id_is_another_shop)
31       get 'index'
32       response.should redirect_to(:controller => "home", :action => "index")
33     end
34   end
35   
36   describe "POST 'update'" do
37     fixtures :shops,:systems
38     it "should be successful" do
39       shop = shops :load_by_shop_test_id_1
40       system = systems :load_by_system_test_id_1
41       #system = {:tax=>100,:tax_rule=>1,:free_delivery_rule=>5000}
42       id = shops(:load_by_shop_test_id_1).id
43       post 'update', :id => id, :shop => shop.attributes,:system=>system.attributes
44       response.should redirect_to(:action => 'index')
45       result = Shop.find(id)
46        result.should == shop
47 #      result.name.should == shop.name
48 #      result.prefecture_id.should == shop.prefecture_id
49 #      result.address_city.should == shop.address_city
50 #      result.address_detail.should == shop.address_detail
51 #      result.tel.should == shop.tel
52       system_new = System.find(:first)
53       system_new.should == system
54     end
55   end
56   
57   
58   describe "GET 'get_address'" do
59     fixtures :zips,:shops,:systems
60     it "get_address ok" do
61       get 'get_address', :first => "000", :second => "0000"
62       address = zips(:zip_test_id_1)
63       data = address.prefecture_name + "/" + address.address_city + "/" + address.address_details + "/" + address.prefecture_id.to_s
64       response.should be_success
65       response.body.should == data
66     end
67   end
68   
69   #delivery関係
70   describe "GET 'delivery_list'" do
71     fixtures :delivery_traders,:delivery_times,:delivery_fees
72     it "should be successful" do
73       get 'delivery_index'
74       response.should be_success
75       assigns[:delivery_traders].should == DeliveryTrader.find(:all, :conditions => ["retailer_id = ?", session[:admin_user].retailer_id], :order=>"position")
76     end
77
78     it "他店舗では他店舗用の配送業者のみ表示" do
79       session[:admin_user] = admin_users(:admin18_retailer_id_is_another_shop)
80       get 'delivery_index'
81       response.should be_success
82       assigns[:delivery_traders].should == DeliveryTrader.find(:all, :conditions => ["retailer_id = ?", session[:admin_user].retailer_id], :order=>"position")
83     end
84
85   end
86   
87   describe "GET 'sort'" do
88     fixtures :delivery_traders,:delivery_times,:delivery_fees
89     
90     it "positionを上げる場合" do
91       DeliveryTrader.find(2).position.should == 2
92       get 'up', :model => "delivery_traders", :id => 2, :return_act=>"delivery_list"
93       DeliveryTrader.find(2).position.should == 1
94       response.should redirect_to(:action => "delivery_list")
95       DeliveryTrader.find(3).position.should == 1
96     end
97     
98     it "positionを上げる場合(これ以上あがらない)" do
99       DeliveryTrader.find(1).position.should == 1
100       get 'up', :model => "delivery_traders", :id => 1, :return_act=>"delivery_list"
101       DeliveryTrader.find(1).position.should == 1
102       response.should redirect_to(:action => "delivery_list")
103     end
104     
105     
106     it "positionを下げる場合" do
107       DeliveryTrader.find(1).position.should == 1
108       get 'down', :model => "delivery_traders", :id => 1, :return_act=>"delivery_list"
109       DeliveryTrader.find(1).position.should == 2
110       response.should redirect_to(:action => "delivery_list")
111       DeliveryTrader.find(3).position.should == 1
112     end
113     
114     it "positionを下げる場合(これ以上下がらない)" do
115       DeliveryTrader.find(2).position.should == 2
116       get 'down', :model => "delivery_traders", :id => 2, :return_act=>"delivery_list"
117       DeliveryTrader.find(2).position.should == 2
118       response.should redirect_to(:action => "delivery_list")
119     end
120     
121   end
122   
123   describe "GET 'destroy'" do
124     it "削除に成功する" do
125       get 'destroy', :model => "delivery_traders", :id => 1,:return_act=>"delivery_list"
126       DeliveryTrader.find(:first, :order=>"id").id.should == 2
127       response.should redirect_to(:action => "delivery_list")
128     end
129     it "削除に失敗する場合" do
130       get 'destroy', :model => "delivery_traders", :id => 100 ,:return_act=>"delivery_list"
131     end
132   end
133   
134   describe "GET 'delivery_new'" do
135     it "should be successful" do
136       get 'delivery_new'
137       response.should be_success
138     end
139     
140     it "新しい配送業者" do
141       get 'delivery_new'
142       response.should be_success
143       
144       assigns[:delivery_trader].should_not be_nil
145       assigns[:delivery_time].should_not be_nil
146       assigns[:delivery_fee].should_not be_nil
147     end
148   end
149   
150   describe "GET 'delivery_edit'" do
151     fixtures :delivery_traders,:delivery_times,:delivery_fees
152     before do
153       @delivery_trader = delivery_traders :witch
154       @delivery_time = @delivery_trader.delivery_times
155       @delivery_fee = @delivery_trader.delivery_fees
156     end
157     it "編集" do
158       get 'delivery_edit', :id=>@delivery_trader.id
159       response.should be_success
160       assigns[:delivery_trader].should == @delivery_trader
161       DeliveryTime::MAX_SIZE.times do |index|
162         assigns[:delivery_time][index].should == @delivery_time[index]
163       end
164       DeliveryFee::MAX_SIZE.times do |index|
165         assigns[:delivery_fee][index].should == @delivery_fee[index]
166       end
167     end
168   end
169   
170   describe "GET 'delivery_create'" do
171     fixtures :delivery_traders,:delivery_times,:delivery_fees
172     before do
173       @delivery_trader = {:name=>"追加",:url=>"http://www.hoge.com", :retailer_id => Retailer::DEFAULT_ID}
174       @delivery_time = {}
175       DeliveryTime::MAX_SIZE.times do |i|
176         @delivery_time["#{i}"]={:name=>"午前中なら#{i}"}
177       end
178       @delivery_fee = {}
179       DeliveryFee::MAX_SIZE.times do |i|
180         @delivery_fee["#{i}"]={:price=>"#{i}"}
181       end
182       @delivery_fee["47"][:prefecture_id]=nil
183     end
184     it "新規作成" do
185       get 'delivery_create', :delivery_trader=>@delivery_trader,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee
186       response.should redirect_to(:action=>:delivery_index)
187     end
188     
189     it "新規作成(保存して戻る失敗)" do
190       @delivery_trader[:name] = "a" * 51
191       get 'delivery_create', :delivery_trader=>@delivery_trader,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee
192       response.should render_template("admin/shops/delivery_new.html.erb")
193     end
194     
195     it "テーブルに保存される" do
196       trader_count = DeliveryTrader.count
197       time_count = DeliveryTime.count
198       fee_count = DeliveryFee.count
199       get 'delivery_create', :delivery_trader=>@delivery_trader,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee
200       response.should redirect_to(:action => :delivery_index)
201       DeliveryTrader.count.should == trader_count+1
202       DeliveryTime.count.should == time_count+DeliveryTime::MAX_SIZE
203       DeliveryFee.count.should == fee_count+DeliveryFee::MAX_SIZE
204       DeliveryTrader.find(:first,:order=>"id desc",:limit=>1).delivery_times.size.should == DeliveryTime::MAX_SIZE
205       DeliveryTrader.find(:first,:order=>"id desc",:limit=>1).delivery_fees.size.should == DeliveryFee::MAX_SIZE
206       DeliveryTrader.find(:first,:order=>"id desc",:limit=>1).delivery_fees[47].prefecture_id == nil
207     end
208
209     it "retailer_idが無効なものは登録できない" do
210       delivery_trader = {:name=>"追加",:url=>"http://www.hoge.com", :retailer_id => nil}
211       trader_count = DeliveryTrader.count
212       time_count = DeliveryTime.count
213       fee_count = DeliveryFee.count
214       get 'delivery_create', :delivery_trader=>delivery_trader,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee
215       response.should render_template("admin/shops/delivery_new.html.erb")
216     end
217
218     it "存在しないretailer_idは登録できない" do
219       retailer_max = Retailer.find(:last).id + 100
220       delivery_trader = @delivery_trader.merge({:name => "fail_trader", :retailer_id => retailer_max})
221       get 'delivery_create', :delivery_trader=>delivery_trader,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee
222       response.should render_template("admin/shops/delivery_new.html.erb")
223     end
224
225     it "同じ名前でもretailer_idが異なれば登録できる" do 
226       other_shop = delivery_traders(:other_shop)
227       delivery_trader = @delivery_trader.merge({:name => other_shop.name })
228       get 'delivery_create', :delivery_trader=>delivery_trader,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee
229       response.should redirect_to(:action=>:delivery_index)
230     end
231   end
232   
233   
234   describe "GET 'delivery_update'" do
235     fixtures :delivery_traders
236     before do
237       @delivery_trader = delivery_traders :witch
238       
239       @delivery_trader.url="http://hogehoge.com"
240       @delivery_time = {}
241       DeliveryTime::MAX_SIZE.times do |i|
242         @delivery_time["#{i}"]={:id=>"#{i}",:name=>"午前中なら#{i}",:position=>"#{i+1}",:delivery_trader_id=>"1"}
243       end
244       @delivery_fee = {}
245       DeliveryFee::MAX_SIZE.times do |i|
246         @delivery_fee["#{i}"]={:id=>"#{i}",:price=>"#{i}",:prefecture_id=>"#{i+1}",:delivery_trader_id=>"1"}
247       end
248       @delivery_fee["47"][:prefecture_id]=nil
249     end
250     
251     it "更新" do
252       get 'delivery_update', :delivery_trader=>@delivery_trader.attributes,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee, :id=>@delivery_trader.id
253       response.should redirect_to(:action => :delivery_index, :id => @delivery_trader.id)
254     end
255     
256     it "更新失敗" do
257       @delivery_trader[:name] = "a" * 51
258       get 'delivery_update', :delivery_trader=>@delivery_trader.attributes,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee, :id=>@delivery_trader.id
259       response.should render_template("admin/shops/delivery_edit.html.erb")
260     end
261     
262     it "テーブルに上書きされる" do
263       get 'delivery_update', :delivery_trader=>@delivery_trader.attributes,:delivery_time=>@delivery_time,:delivery_fee=>@delivery_fee, :id=>@delivery_trader.id
264       response.should redirect_to(:action => :delivery_index, :id => @delivery_trader.id)
265       delivery_trader = DeliveryTrader.find(@delivery_trader.id)
266       delivery_trader.should == @delivery_trader
267       
268       DeliveryTime::MAX_SIZE.times do |i|
269         delivery_trader.delivery_times[i].name.should == @delivery_time["#{i}"][:name]
270       end
271       DeliveryFee::MAX_SIZE.times do |i|
272         delivery_trader.delivery_fees[i].price. == @delivery_fee["#{i}"][:price]
273       end
274       delivery_trader.delivery_fees[47].prefecture_id == nil
275     end
276   end
277   
278   #payment関係
279   describe "GET 'payment_index'" do
280     fixtures :payments
281     it "should be successful" do
282       get 'payment_index'
283       response.should be_success
284       assigns[:payments].should == Payment.find(:all,:order=>"position")
285     end
286   end
287   
288   describe "GET 'sort'" do
289     fixtures :payments
290     
291     it "positionを上げる場合" do
292       Payment.find(2).position.should == 2
293       get 'up', :model => "payments", :id => 2, :return_act => "payment_list"
294       Payment.find(2).position.should == 1
295       response.should redirect_to(:action => "payment_list")
296     end
297     
298     it "positionを上げる場合(これ以上あがらない)" do
299       Payment.find(1).position.should == 1
300       get 'up', :model => "payments", :id => 1, :return_act => "payment_list"
301       Payment.find(1).position.should == 1
302       response.should redirect_to(:action => "payment_list")
303     end
304     
305     
306     it "positionを下げる場合" do
307       Payment.find(1).position.should == 1
308       get 'down', :model => "payments", :id => 1, :return_act => "payment_list"
309       Payment.find(1).position.should == 2
310       response.should redirect_to(:action => "payment_list")
311     end
312     
313     it "positionを下げる場合(これ以上下がらない)" do
314       old_position= Payment.find(:first,:order=>"position desc")
315       get 'down', :model => "payments", :id => old_position.id, :return_act => "payment_list"
316       Payment.find(:first,:order=>"position desc").position.should == old_position.position
317       response.should redirect_to(:action => "payment_list")
318     end
319     
320   end
321   
322   describe "GET 'destroy'" do
323     it "削除に成功する" do
324       Payment.find_by_id(1).should_not be_nil
325       get 'destroy', :model => "payments", :id => 1, :return_act=>"payment_list"
326       Payment.find_by_id(1).should be_nil
327       Payment.find_by_id(2).should_not be_nil
328       response.should redirect_to(:action => "payment_list")
329     end
330
331     it "削除に失敗する場合" do
332       get 'destroy', :model => "payments", :id => 100 ,:return_act=>"payment_list"
333     end
334   end
335   
336   describe "GET 'payment_new'" do
337     it "should be successful" do
338       get 'payment_new'
339       response.should be_success
340       assigns[:shop] == Payment.new
341     end
342   end
343   
344   describe "GET 'payment_create'" do
345     before do
346       @record = {:name => "追加", :fee => 1}
347     end
348     
349     it "新規作成" do
350       get 'payment_create', :payment => @record
351       response.should redirect_to(:action=>:payment_index)
352     end
353     
354     it "新規作成(保存して戻る失敗)" do
355       @record[:name] = ""
356       get 'payment_create', :payment => @record
357       response.should render_template("admin/shops/payment_new.html.erb")
358     end
359     
360     it "テーブルに保存される" do
361       payment_count = Payment.count
362       get 'payment_create', :payment => @record
363       response.should redirect_to(:action => :payment_index)
364       Payment.count.should == payment_count+1
365     end
366   end
367   
368   describe "GET 'payment_edit'" do
369     fixtures :payments
370     before do
371       @payment = payments :cash
372     end
373     it "編集" do
374       get 'payment_edit', :id=>@payment.id
375       response.should be_success
376       assigns[:shop] == @payment
377     end
378   end
379   
380   describe "GET 'payment_update'" do
381     fixtures :payments
382     before do
383       @record = payments :cash
384       @record.lower_limit=0
385       @record.upper_limit=1
386     end
387     
388     it "更新" do
389       get 'payment_update', :payment => @record.attributes, :id => @record.id
390       response.should redirect_to(:action => :payment_index)
391     end
392     
393     it "更新失敗" do
394       @record[:name] = ""
395       get 'payment_update', :payment => @record.attributes, :id => @record.id
396       response.should render_template("admin/shops/payment_edit.html.erb")
397     end
398     
399     
400     it "テーブルに上書きされる" do
401       get 'payment_update', :record => @record.attributes, :id => @record.id
402       response.should redirect_to(:action => :payment_index)
403       payment = Payment.find(@record.id)
404       payment.should == @record
405     end
406     
407   end
408   
409  # 特定商取引法
410   describe "GET 'tradelaw_index'" do
411     fixtures :laws
412     it "should be successful" do
413       get 'tradelaw_index'
414       response.should be_success
415       assigns[:law].should == Law.find(:first)
416     end
417   end
418   
419   describe "POST 'tradelaw_update'" do
420     fixtures :laws
421     before do
422       @record = laws :shoutorihiki
423       @record.company="販売店更新"
424       @record.manager="運営責任者更新"
425       @record.zipcode01="012"
426       @record.zipcode02="3456"
427       @record.address_city="市区町村更新"
428       @record.address_detail="番地、建物、マンション名更新"
429       @record.tel01 ="090"
430       @record.tel02 ="0000"
431       @record.tel03 ="1111"
432       @record.fax01 ="080"
433       @record.fax02 ="1111"
434       @record.fax03 ="2222"
435       @record.email="mail@kbmj.com"
436       @record.url="http://www.kbmj.com/index"
437       @record.prefecture_id ="2"
438       @record.necessary_charge="商品代金以外の必要料金更新"
439       @record.order_method="注文方法更新"
440       @record.payment_method="支払方法更新"
441       @record.payment_time_limit="支払期限更新"
442       @record.delivery_time="引き渡し時期更新"
443       @record.return_exchange="返品・交換について更新"
444     end
445     it "should be successful" do
446       
447       post 'tradelaw_update', :shop=>@record.attributes,:id=>@record.id
448       response.should redirect_to(:action => 'tradelaw_index')
449       law = Law.find(@record.id)
450       law.should == @record
451       
452     end
453   end
454   
455   #メール設定
456   describe "GET 'mail_index'" do
457     it "should be successful" do
458       get 'mail_index'
459       response.should be_success
460       assigns[:shop] == MailTemplate.new
461     end
462   end
463   
464   describe "POST 'mail_update'" do
465     fixtures :mail_templates
466     before do
467       @record = mail_templates :template1
468       @record.title="タイトル更新"
469       @record.header="ヘッダー更新"
470       @record.footer="フッター更新"
471     end
472     it "should be successful" do 
473       post 'mail_update', :mail => @record.attributes
474       response.should redirect_to(:action => 'mail_index')
475       mail_template = MailTemplate.find(@record.id)
476       mail_template.should == @record
477     end
478   end
479   
480   describe "POST 'mail_search'" do
481     fixtures :mail_templates
482     before do
483       @record = mail_templates :template1
484     end
485
486     it "with id" do
487       post 'mail_search', :id => @record.id
488       assigns[:mail].should == @record
489       response.should render_template("admin/shops/_mail_form")
490     end
491
492     it "without id" do
493       post 'mail_search'
494       assigns[:mail].id.should be_nil
495       response.should render_template("admin/shops/_mail_form")
496     end
497   end
498
499   #SEO設定
500   describe "GET 'seo_index'" do
501     it "should be successful" do
502       get 'seo_index'
503       response.should be_success
504       assigns[:shop] == Seo.find(:all,:order=>"page_type")
505     end
506   end
507   
508   describe "POST 'seo_update'" do
509     fixtures :seos
510     before do
511       @record = seos :top
512       @record.name=Seo::TYPE_NAMES[@record.page_type]
513       @record.author="author更新"
514       @record.description="description更新"
515       @record.keywords="keywords更新"
516     end
517     it "should be successful" do
518       
519       post 'seo_update', :seo=>@record.attributes
520       response.should redirect_to(:action => 'seo_index')
521       seo = Seo.find_by_page_type(@record.page_type)
522       seo.should == @record
523       
524     end
525   end
526   
527     #会員規約設定
528   describe "GET 'kiyaku_index'" do
529     it "should be successful" do
530       get 'kiyaku_index'
531       response.should be_success
532       assigns[:shops] == Kiyaku.find(:all)
533       assigns[:kiyaku] == Kiyaku.new
534     end
535   end
536   
537   describe "GET 'kiyaku_index' 編集" do
538     fixtures :kiyakus
539     before do
540       @kiyaku = kiyakus :kiyaku1
541     end
542     it "編集" do
543       get 'kiyaku_index', :id=>@kiyaku.id
544       response.should be_success
545        assigns[:shops] == Kiyaku.find(:all)
546       assigns[:kiyaku] == @kiyaku
547     end
548   end
549   describe "GET 'sort'" do
550     
551     it "positionを上げる場合" do
552       Kiyaku.find(2).position.should == 2
553       get 'up', :model => "kiyakus", :id => 2, :return_act => "kiyaku_index"
554       Kiyaku.find(2).position.should == 1
555       response.should redirect_to(:action => "kiyaku_index")
556     end
557     
558     it "positionを上げる場合(これ以上あがらない)" do
559       Kiyaku.find(1).position.should == 1
560       get 'up', :model => "kiyakus", :id => 1, :return_act => "kiyaku_index"
561       Kiyaku.find(1).position.should == 1
562       response.should redirect_to(:action => "kiyaku_index")
563     end
564     
565     
566     it "positionを下げる場合" do
567       Kiyaku.find(1).position.should == 1
568       get 'down', :model => "kiyakus", :id => 1, :return_act => "kiyaku_index"
569       Kiyaku.find(1).position.should == 2
570       response.should redirect_to(:action => "kiyaku_index")
571     end
572     
573     it "positionを下げる場合(これ以上下がらない)" do
574       Kiyaku.find(3).position.should == 3
575       get 'down', :model => "kiyakus", :id => 3, :return_act => "kiyaku_index"
576       Kiyaku.find(3).position.should == 3
577       response.should redirect_to(:action => "kiyaku_index")
578     end
579     
580   end
581   
582   describe "GET 'destroy'" do
583     it "削除に成功する" do
584       get 'destroy', :model => "kiyakus", :id => 1,:return_act=>"kiyaku_index"
585       Kiyaku.find(:first).id.should == 2
586       response.should redirect_to(:action => "kiyaku_index")
587     end
588     it "削除に失敗する場合" do
589       get 'destroy', :model => "kiyakus", :id => 100 ,:return_act=>"kiyaku_index"
590     end
591   end
592   
593   describe "POST 'kiyaku_create'" do
594     before do
595       @record = {:name=>"追加",:content=>"追加追加"}
596     end
597     
598     it "新規作成" do
599       get 'kiyaku_create', :kiyaku => @record
600       response.should redirect_to(:action => :kiyaku_index)
601     end
602     
603     it "新規作成(保存して戻る失敗)" do
604       @record[:name] = ""
605       get 'kiyaku_create', :kiyaku => @record
606       response.should render_template("admin/shops/kiyaku_index.html.erb")
607     end
608     
609     it "テーブルに保存される" do
610       kiyaku_count = Kiyaku.count
611       get 'kiyaku_create', :kiyaku => @record
612       response.should redirect_to(:action=>:kiyaku_index)
613       Kiyaku.count.should == kiyaku_count+1
614     end
615   end
616   describe "POST 'kiyaku_update'" do
617     fixtures :kiyakus
618     before do
619       @record = kiyakus :kiyaku1
620       @record.name="タイトル更新"
621       @record.content="内容更新"
622     end
623
624     it "should be successful" do  
625       post 'kiyaku_update', :kiyaku => @record.attributes
626       response.should redirect_to(:action => 'kiyaku_index')
627       kiyaku = Kiyaku.find(@record.id)
628       kiyaku.should == @record
629     end
630   end
631
632   describe "GET 'point_index'" do
633     it "should be successful" do
634       get 'point_index'
635       response.should be_success
636       assigns[:shop].should == Shop.find(:first)
637     end
638   end
639
640   describe "POST 'point_update'" do
641     before do
642       @shop = {:point_granted_rate => "", :point_at_admission => ""}
643       @id = Shop.find(:first).id
644     end
645
646     it "更新" do
647       post 'point_update', :id => @id, :shop => @shop
648       response.should redirect_to(:action => :point_index)
649     end
650
651     it "idが無い場合" do
652       post 'point_update'
653       response.should render_template("admin/shops/point_index.html.erb")
654     end
655
656     it "更新失敗" do
657       @shop[:point_granted_rate] = "test"
658       post 'point_update', :id => @id, :shop => @shop
659       response.should render_template("admin/shops/point_index.html.erb")
660     end
661   end
662
663   describe "GET 'privacy'" do
664     fixtures :privacies
665     it "should be successful" do
666       privacy = privacies :one
667       get 'privacy'
668       assigns[:privacy].attributes.should == privacy.attributes
669     end
670   end
671
672   describe "POST 'privacy_update'" do
673     before(:each) do
674       @privacy = {:content_collect=>"テスト1",:content_collect_mobile=>"テスト2",:content_privacy=>"テスト3",:content_privacy_mobile=>"テスト4"}
675     end    
676     fixtures :privacies
677     it "更新" do
678       post 'privacy_update', :privacy => @privacy
679       response.should redirect_to(:action => :privacy)
680     end
681
682     it "POSTではなくGETでアクセス" do
683       get 'privacy_update', :privacy => @privacy
684       flash[:notice].should be_nil
685       response.should redirect_to(:action => :privacy)
686     end
687   end
688
689 end