--- /dev/null
+<!DOCTYPE html>\r
+<html>\r
+<head>\r
+ <title>Pettanr</title>\r
+ <%= stylesheet_link_tag "application" %>\r
+ <%= javascript_include_tag "application" %>\r
+ <%= csrf_meta_tags %>\r
+</head>\r
+<body>\r
+\r
+<div>\r
+<% if user_signed_in? %>\r
+ <%= link_to "my home", :controller => '/home' %>\r
+ <%= link_to "sign out", destroy_user_session_path, :method => :delete %>\r
+<% else %>\r
+ <%= link_to "sign in", new_user_session_path %>\r
+<% end %>\r
+</div>\r
+<div>\r
+<% if admin_signed_in? %>\r
+ <%= link_to "system", :controller => '/system' %>\r
+ <%= link_to "sign out", destroy_admin_session_path, :method => :delete %>\r
+<% else %>\r
+ <%= link_to "sign in", new_admin_session_path %>\r
+<% end %>\r
+</div>\r
+<div>\r
+ <p class="notice"><%= notice %></p>\r
+ <p class="alert"><%= alert %></p>\r
+<%= link_to 'comics', comics_path %>\r
+<%= link_to 'panels', panels_path %>\r
+<%= link_to 'original_pictures', original_pictures_path %>\r
+<%= link_to 'resource_pictures', resource_pictures_path %>\r
+<%= link_to 'panel_pictures', panel_pictures_path %>\r
+<%= link_to 'balloons', balloons_path %>\r
+<%= link_to 'speaches', speaches_path %>\r
+ : \r
+<%= link_to 'speach_balloons', speach_balloons_path %>\r
+<%= link_to 'balloon_templates', balloon_templates_path %>\r
+<%= link_to 'speach_templates', speach_templates_path %>\r
+ : \r
+<%= link_to 'artists', artists_path %>\r
+<%= link_to 'system_pictures', system_pictures_path %>\r
+</div>\r
+<%= yield %>\r
+\r
+</body>\r
+</html>\r
+# -*- encoding: utf-8 -*-\r
require 'spec_helper'
-# This spec was generated by rspec-rails when you ran the scaffold generator.
-# It demonstrates how one might use RSpec to specify the controller code that
-# was generated by Rails when you ran the scaffold generator.
-#
-# It assumes that the implementation code is generated by the rails scaffold
-# generator. If you are using any extension libraries to generate different
-# controller code, this generated spec may or may not pass.
-#
-# It only uses APIs available in rails and/or rspec-rails. There are a number
-# of tools you can use to make these specs even more expressive, but we're
-# sticking to rails and rspec-rails APIs to keep things simple and stable.
-#
-# Compared to earlier versions of this generator, there is very limited use of
-# stubs and message expectations in this spec. Stubs are only used when there
-# is no simpler way to get a handle on the object needed for the example.
-# Message expectations are only used when there is no simpler way to specify
-# that an instance is receiving a specific message.
-
describe PanelsController do
-
- # This should return the minimal set of attributes required to create a valid
- # Panel. As you add validations to Panel, be sure to
- # update the return value of this method accordingly.
- def valid_attributes
- {}
- end
-
- describe "GET index" do
- it "assigns all panels as @panels" do
- panel = Panel.create! valid_attributes
- get :index
- assigns(:panels).should eq([panel])
- end
- end
-
- describe "GET show" do
- it "assigns the requested panel as @panel" do
- panel = Panel.create! valid_attributes
- get :show, :id => panel.id
- assigns(:panel).should eq(panel)
- end
- end
-
- describe "GET new" do
- it "assigns a new panel as @panel" do
- get :new
- assigns(:panel).should be_a_new(Panel)
- end
- end
-
- describe "GET edit" do
- it "assigns the requested panel as @panel" do
- panel = Panel.create! valid_attributes
- get :edit, :id => panel.id
- assigns(:panel).should eq(panel)
- end
- end
-
- describe "POST create" do
- describe "with valid params" do
- it "creates a new Panel" do
- expect {
- post :create, :panel => valid_attributes
- }.to change(Panel, :count).by(1)
+ before do
+ Factory :admin
+ @user = Factory :user_yas\r
+ @author = @user.author #ユーザ作成時に連動して作成される
+ end
+
+ describe '新規作成に於いて' do
+ before do
+ @comic = Factory :normal_comic, :author_id => @user.author.id
+ sign_in @user
+ end
+ context '事前チェックする' do
+ before do
+ controller
+ Panel.stub(:count).and_return(10)
+ end
+ it 'panelがパラメータにあれば、展開する' do
+ post :create, :panel => Factory.attributes_for(:panel, :comic_id => @comic.id)
+ assigns(:prm)['border'].to_i.should eq 1
+ end
+ it 'jsonがパラメータにあれば、展開する' do
+ post :create, :json => Factory.attributes_for(:panel, :comic_id => @comic.id, :border => 4).to_s
+ assigns(:prm)['border'].to_i.should eq 4
+ end
+ it 'panel・json両パラメータがあれば、panelを優先して展開する' do
+ post :create, {
+ :panel => Factory.attributes_for(:panel, :comic_id => @comic.id),
+ :json => Factory.attributes_for(:panel, :comic_id => @comic.id, :border => 4).to_s
+ }
+ assigns(:prm)['border'].to_i.should eq 1
end
-
- it "assigns a newly created panel as @panel" do
- post :create, :panel => valid_attributes
- assigns(:panel).should be_a(Panel)
- assigns(:panel).should be_persisted
- end
-
- it "redirects to the created panel" do
- post :create, :panel => valid_attributes
- response.should redirect_to(Panel.last)
- end
- end
-
- describe "with invalid params" do
- it "assigns a newly created but unsaved panel as @panel" do
- # Trigger the behavior that occurs when invalid params are submitted
- Panel.any_instance.stub(:save).and_return(false)
- post :create, :panel => {}
- assigns(:panel).should be_a_new(Panel)
- end
-
- it "re-renders the 'new' template" do
- # Trigger the behavior that occurs when invalid params are submitted
- Panel.any_instance.stub(:save).and_return(false)
- post :create, :panel => {}
- response.should render_template("new")
- end
- end
- end
-
- describe "PUT update" do
- describe "with valid params" do
- it "updates the requested panel" do
- panel = Panel.create! valid_attributes
- # Assuming there are no other panels in the database, this
- # specifies that the Panel created on the previous line
- # receives the :update_attributes message with whatever params are
- # submitted in the request.
- Panel.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
- put :update, :id => panel.id, :panel => {'these' => 'params'}
- end
-
- it "assigns the requested panel as @panel" do
- panel = Panel.create! valid_attributes
- put :update, :id => panel.id, :panel => valid_attributes
- assigns(:panel).should eq(panel)
- end
-
- it "redirects to the panel" do
- panel = Panel.create! valid_attributes
- put :update, :id => panel.id, :panel => valid_attributes
- response.should redirect_to(panel)
- end
- end
-
- describe "with invalid params" do
- it "assigns the panel as @panel" do
- panel = Panel.create! valid_attributes
- # Trigger the behavior that occurs when invalid params are submitted
- Panel.any_instance.stub(:save).and_return(false)
- put :update, :id => panel.id, :panel => {}
- assigns(:panel).should eq(panel)
- end
-
- it "re-renders the 'edit' template" do
- panel = Panel.create! valid_attributes
- # Trigger the behavior that occurs when invalid params are submitted
- Panel.any_instance.stub(:save).and_return(false)
- put :update, :id => panel.id, :panel => {}
- response.should render_template("edit")
- end
- end
- end
-
- describe "DELETE destroy" do
- it "destroys the requested panel" do
- panel = Panel.create! valid_attributes
- expect {
- delete :destroy, :id => panel.id
- }.to change(Panel, :count).by(-1)
- end
-
- it "redirects to the panels list" do
- panel = Panel.create! valid_attributes
- delete :destroy, :id => panel.id
- response.should redirect_to(panels_url)
end
end