describe ComicsController do
before do
- Factory :admin
- @sp = Factory :system_picture
- @lg = Factory :license_group
- @license = Factory :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
- @user = Factory :user_yas\r
+ FactoryGirl.create :admin
+ @sp = FactoryGirl.create :system_picture
+ @lg = FactoryGirl.create :license_group
+ @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+ @user = FactoryGirl.create :user_yas\r
@author = @user.author #ユーザ作成時に連動して作成される\r
end\r
\r
describe '一覧表示に於いて' do\r
before do\r
- @comic = Factory :comic, :author_id => @user.author.id\r
+ @comic = FactoryGirl.create :comic, :author_id => @user.author.id\r
Comic.stub(:list).and_return([@comic, @comic, @comic])\r
sign_in @user\r
end\r
\r
describe '単体表示に於いて' do\r
before do\r
- @comic = Factory :comic, :author_id => @user.author.id, :title => 'normal'\r
+ @comic = FactoryGirl.create :comic, :author_id => @user.author.id, :title => 'normal'\r
Comic.stub(:show).and_return(@comic)\r
sign_in @user\r
end\r
context 'html形式' do\r
it '例外403 forbiddenを返す' do\r
Comic.any_instance.stub(:visible?).with(any_args()).and_return(false)\r
- hidden = Factory :hidden_comic, :author_id => @author.id\r
+ hidden = FactoryGirl.create :hidden_comic, :author_id => @author.id\r
lambda{\r
get :show, :id => hidden\r
}.should raise_error(ActiveRecord::Forbidden)\r
context 'json形式' do\r
it '例外403 forbiddenを返す' do\r
Comic.any_instance.stub(:visible?).with(any_args()).and_return(false)\r
- hidden = Factory :hidden_comic, :author_id => @author.id\r
+ hidden = FactoryGirl.create :hidden_comic, :author_id => @author.id\r
lambda{\r
get :show, :id => hidden, :format => :json\r
}.should raise_error(ActiveRecord::Forbidden)\r
describe '新規作成に於いて' do\r
before do\r
sign_in @user\r
- @attr = Factory.attributes_for(:comic, :author_id => @author.id, :title => 'normal')\r
+ @attr = FactoryGirl.attributes_for(:comic, :author_id => @author.id, :title => 'normal')\r
end\r
context 'つつがなく終わるとき' do\r
it 'モデルに保存依頼する' do\r
\r
describe '編集フォーム表示に於いて' do\r
before do\r
- @comic = Factory :comic, :author_id => @user.author.id\r
+ @comic = FactoryGirl.create :comic, :author_id => @user.author.id\r
sign_in @user\r
Comic.stub(:show).and_return(@comic)\r
end\r
\r
describe '更新に於いて' do\r
before do\r
- @comic = Factory :comic, :author => @author\r
- @attr = Factory.attributes_for(:comic, :author_id => @author.id, :title => 'updated title', :visible => 0)\r
+ @comic = FactoryGirl.create :comic, :author => @author\r
+ @attr = FactoryGirl.attributes_for(:comic, :author_id => @author.id, :title => 'updated title', :visible => 0)\r
sign_in @user\r
end\r
context '事前チェックしておく' do\r