- @scroll = FactoryGirl.create :scroll, :author => @author
- @attr = FactoryGirl.attributes_for(:scroll, :author_id => @author.id, :title => 'updated title', :visible => 0)
- sign_in @user
- end
- context '事前チェックしておく' do
- it 'スクロールモデルに編集取得を問い合わせている' do
- Scroll.stub(:edit).with(any_args()).and_return @scroll
- Scroll.should_receive(:edit).exactly(1)
- put :update, :id => @scroll.id, :scroll => @attr
- end
- it 'スクロールモデルにカラム値復元を依頼している' do
- Scroll.any_instance.should_receive(:attributes=).exactly(1)
- put :update, :id => @scroll.id, :scroll => @attr
- end
- it 'スクロールモデルに上書き補充を依頼している' do
- Scroll.any_instance.should_receive(:overwrite).exactly(1)
- put :update, :id => @scroll.id, :scroll => @attr
- end
- it 'モデルに更新を依頼する' do
- Scroll.any_instance.stub(:save).with(any_args).and_return true
- Scroll.any_instance.should_receive(:save).exactly(1)
- put :update, :id => @scroll.id, :scroll => @attr
- end
- it '@scrollにアレを取得している' do
- put :update, :id => @scroll.id, :scroll => @attr
- assigns(:scroll).id.should eq(@scroll.id)
- end
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ @item_id = @item.id
+ @attributes = FactoryGirl.attributes_for(:scroll_hidden, author_id: @author_yas.id)
+ @attr = {:id => @item_id, :scroll => @attributes}
+ @attr_format_json = @attr.merge(:format => :json)