1 # -*- encoding: utf-8 -*-
5 describe SystemController do
9 describe 'システム初期化要請に於いて' do
10 context '要請の必要がないとき' do
12 #要請の必要がない=管理者登録済み かつ ライセンス登録済み
16 it 'リクエスト通りのページを開く' do
18 response.should_not redirect_to 'system/start'
20 context 'userがサインインしているなら' do
22 @user = Factory( :user_yas)
23 @author = @user.author
26 it 'userにサインイン中のアカウントをセットしている' do
28 assigns(:user).should eq @user
30 it 'authorに作家をセットしている' do
32 assigns(:author).should eq @author
34 it 'artistに絵師をセットしている' do
35 @artist = Factory :artist_yas, :author_id => @author.id
37 assigns(:artist).should eq @artist
39 it 'ただし、絵師登録されてなければ新規の絵師をセットしている' do
41 assigns(:artist).should be_a_new(Artist)
44 context 'userがサインインしていないなら' do
46 @user = Factory( :user_yas)
47 @author = @user.author
48 @artist = Factory :artist_yas, :author_id => @author.id
52 assigns(:user).should eq nil
54 it 'authorが空になっている' do
56 assigns(:author).should eq nil
58 it 'artistが空になっている' do
60 assigns(:artist).should eq nil
64 #要請の必要がある=管理者がいない または ライセンスがない
65 context '管理者がいないとき' do
69 context '本機能を開こうとしているなら' do
72 response.should redirect_to '/system/start'
74 it 'ステータスコード302 Foundを返す' do
76 response.status.should eq 302
79 context '初期化要請ページを開こうとしているなら' do
82 response.should_not redirect_to 'system/start'
86 response.status.should eq 200
90 response.should render_template("system/start")
94 context 'ライセンスがないとき' do
98 context '本機能を開こうとしているなら' do
101 response.should redirect_to '/system/start'
103 it 'ステータスコード302 Foundを返す' do
105 response.status.should eq 302
108 context '初期化要請ページを開こうとしているなら' do
111 response.should_not redirect_to 'system/start'
115 response.status.should eq 200
117 it '初期化要請ページを描画する' do
119 response.should render_template("system/start")