@op = Factory :original_picture, :artist_id => @artist.id
@p = Factory :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
@rp = Factory :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
- @panel = Factory :panel, :author_id => @author.id, :comic_id => @comic.id
- @attr = {:resource_picture_id => @rp.id, :panel_id => @panel}
+ @panel = Factory :panel, :author_id => @author.id
+ @attr = {:resource_picture_id => @rp.id, :panel_id => @panel.id}
end
describe '一覧表示に於いて' do
end
end
- describe 'クレジット表示に於いて' do
- before do
- @pp = Factory :panel_picture, @attr
- sign_in @user
- Picture.stub(:show).and_return(@pp)
- end
- context 'つつがなく終わるとき' do
- it 'ステータスコード200 OKを返す' do
- get :show, :id => @pp.id
- response.should be_success
- end
- it '素材モデルに単体取得を問い合わせている' do
- ResourcePicture.should_receive(:show).exactly(1)
- get :show
- end
- it '@resource_pictureにアレを取得している' do
- get :show, :id => @pic.id
- assigns(:resource_picture).id.should eq(@pic.id)
- end
- context 'html形式' do
- it 'showテンプレートを描画する' do
- get :show, :id => @pic.id
- response.should render_template("show")
- end
- end
- context 'json形式' do
- it 'jsonデータを返す' do
- get :show, :id => @pic.id, :format => :json
- lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
- end
- it 'データがアレになっている' do
- get :show, :id => @pic.id, :format => :json
- json = JSON.parse response.body
- json["ext"].should match(/png/)
- end
- end
- end
- context '作家権限がないとき' do
- before do
- sign_out @user
- end
- context 'html形式' do
- it 'ステータスコード302 Foundを返す' do
- get :show, :id => @pic.id
- response.status.should eq 302
- end
- it 'サインインページへ遷移する' do
- get :show, :id => @pic.id
- response.body.should redirect_to '/users/sign_in'
- end
- end
- context 'json形式' do
- it 'ステータスコード401 Unauthorizedを返す' do
- get :show, :id => @pic.id, :format => :json
- response.status.should eq 401
- end
- it '応答メッセージにUnauthorizedを返す' do
- get :show, :id => @pic.id, :format => :json
- response.message.should match(/Unauthorized/)
- end
- end
- end
-=begin
- context '対象素材がないとき' do
- before do
- ResourcePicture.unstub(:show)
- end
- context 'html形式' do
- it '例外404 not_foundを返す' do
- lambda{
- get :show, :id => 0
- }.should raise_error(ActiveRecord::RecordNotFound)
- end
- end
- context 'json形式' do
- it '例外404 not_foundを返す' do
- lambda{
- get :show, :id => 0, :format => :json
- }.should raise_error(ActiveRecord::RecordNotFound)
- end
- end
- end
-=end
- end
-
end