OSDN Git Service

MobileDevice, MobileCarrierを使わないよう修正
[elecoma/elecoma.git] / spec / controllers / features_controller_spec.rb
1 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
3 describe FeaturesController do
4   fixtures :features
5
6   before do
7     @controller.class.skip_before_filter :start_transaction
8     @controller.class.skip_after_filter :end_transaction
9   end
10   #Delete this example and add some real ones
11   it "should use FeaturesController" do
12     controller.should be_an_instance_of(FeaturesController)
13   end
14
15   describe "GET 'show'" do
16     it "404 error(PC)" do
17       get 'show', :dir_name => features(:not_permit).dir_name
18       assigns[:feature].should be_blank
19       response.should render_template("public/404.html")
20     end
21
22     it "404 error(mobile)" do
23       request.user_agent = "SoftBank/1.0/940SH/SHJ001/SN000000000000000 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1"
24       get 'show', :dir_name => features(:not_permit).dir_name
25       assigns[:feature].should be_blank
26       response.should render_template("public/404_mobile.html")
27     end
28
29     it "特殊商品を持っている" do
30       get 'show', :dir_name => features(:permit).dir_name
31       assigns[:feature].should_not be_blank
32       assigns[:products].should_not be_nil
33       response.should render_template("features/show.html.erb")
34     end
35
36     it "特集商品を持っていない" do
37       get 'show', :dir_name => features(:free).dir_name
38       assigns[:feature].should_not be_blank
39       assigns[:products].should be_nil
40       response.should render_template("features/show.html.erb")
41     end
42   end
43
44 end