describe PicturesController do
before do
@admin = FactoryGirl.create :admin
+ @demand_user = FactoryGirl.create :demand_user
@sp = FactoryGirl.create :system_picture
@lg = FactoryGirl.create :license_group
@license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
@p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
sign_in @user
Picture.stub(:show).with(@p.id.to_s, @author).and_return(@p)
+ Picture.stub(:show).with(@p.id.to_s, nil).and_return(@p)
end
context 'つつがなく終わるとき as json' do
it 'ステータスコード200 OKを返す' do
end
end
end
+ context '作家権限はないが管理者権限があるとき' do
+ before do
+ sign_out @user
+ sign_in @admin
+ end
+ it 'ステータスコード200 OKを返す' do
+ get :show, :id => @p.id
+ response.should be_success
+ end
+ end
+ context '作家権限はないが借手権限があるとき' do
+ before do
+ sign_out @user
+ sign_in @demand_user
+ end
+ it 'ステータスコード200 OKを返す' do
+ get :show, :id => @p.id
+ response.should be_success
+ end
+ end
=begin
context '対象素材がないとき' do
before do
@p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
sign_in @user
Picture.stub(:show).with(@p.id.to_s, @author).and_return(@p)
+ Picture.stub(:show).with(@p.id.to_s, nil).and_return(@p)
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
end
end
end
+ context '作家権限はないが管理者権限があるとき' do
+ before do
+ sign_out @user
+ sign_in @admin
+ end
+ it 'ステータスコード200 OKを返す' do
+ get :credit, :id => @p.id
+ response.should be_success
+ end
+ end
+ context '作家権限はないが借手権限があるとき' do
+ before do
+ sign_out @user
+ sign_in @demand_user
+ end
+ it 'ステータスコード200 OKを返す' do
+ get :credit, :id => @p.id
+ response.should be_success
+ end
+ end
=begin
context '対象素材がないとき' do
before do
end
end
end
+ context '作家権限はないが管理者権限があるとき' do
+ before do
+ sign_out @user
+ sign_in @admin
+ end
+ it 'ステータスコード200 OKを返す' do
+ get :search, :md5 => 'a'*32
+ response.should be_success
+ end
+ end
+ context '作家権限はないが借手権限があるとき' do
+ before do
+ sign_out @user
+ sign_in @demand_user
+ end
+ it 'ステータスコード200 OKを返す' do
+ get :search, :md5 => 'a'*32
+ response.should be_success
+ end
+ end
end
else