OSDN Git Service

speach rename to speech
[pettanr/pettanr.git] / spec / controllers / open / comics_controller_spec.rb
1 # -*- encoding: utf-8 -*-\r
2 require 'spec_helper'
3
4 describe ComicsController do
5   # This should return the minimal set of attributes required to create a valid
6   # Comic. As you add validations to Comic, be sure to
7   # update the return value of this method accordingly.
8   def valid_attributes
9     {:title => 'test comic', :width => 100, :height => 50, :visible => 0, :editable => 0}
10   end
11
12   describe '一覧表示に於いて' do
13     before do
14       Factory :admin
15       @user = Factory( :user_yas)
16         Factory :normal_comic, :author_id => 1
17         Factory :visible_comic, :author_id => 1
18         Factory:editable_comic, :author_id => 1
19         Factory :hidden_comic, :author_id => 1
20       sign_in @user
21     end
22     context '作家権限がないとき' do
23       context 'ただし、公開型のときだけは' do
24         it 'ステータスコード200 OKを返す' do
25           sign_out @user
26           Const.run_mode = 0
27           get :index
28           response.should be_success 
29         end
30       end
31     end
32   end
33   
34   describe '単体表示に於いて' do
35     before do
36       Factory :admin
37       @user = Factory( :user_yas)
38       @comic = Factory :normal_comic, :author_id => 1
39         Factory :visible_comic, :author_id => 1
40         Factory:editable_comic, :author_id => 1
41       @hidden = Factory :hidden_comic, :author_id => 1
42       sign_in @user
43     end
44     context '作家権限がないとき' do
45       context 'ただし、公開型のときだけは' do
46         it 'ステータスコード200 OKを返す' do
47           sign_out @user
48           get :show, :id => @comic.id
49           response.should be_success 
50         end
51       end
52     end
53   end
54
55
56 end