OSDN Git Service

t#31326:drop color
authoryasushiito <yas@pen-chan.jp>
Wed, 29 May 2013 08:16:46 +0000 (17:16 +0900)
committeryasushiito <yas@pen-chan.jp>
Wed, 29 May 2013 08:16:46 +0000 (17:16 +0900)
41 files changed:
app/controllers/colors_controller.rb [deleted file]
app/controllers/home_controller.rb
app/controllers/panel_colors_controller.rb [deleted file]
app/helpers/colors_helper.rb [deleted file]
app/helpers/panel_colors_helper.rb [deleted file]
app/models/color.rb [deleted file]
app/models/ground_color.rb
app/models/panel.rb
app/models/panel_color.rb [deleted file]
app/views/authors/ground_colors.html.erb
app/views/authors/panel_colors.html.erb [deleted file]
app/views/authors/show.html.erb
app/views/colors/index.html.erb [deleted file]
app/views/colors/list.html.erb [deleted file]
app/views/colors/show.html.erb [deleted file]
app/views/comics/top.html.erb
app/views/ground_colors/_list_item.html.erb
app/views/ground_colors/index.html.erb
app/views/home/ground_colors.html.erb
app/views/home/index.html.erb
app/views/home/panel_colors.html.erb [deleted file]
app/views/panel_colors/_list_item.html.erb [deleted file]
app/views/panel_colors/index.html.erb [deleted file]
app/views/panel_colors/show.html.erb [deleted file]
config/locales/pettanr.ja.yml
config/routes.rb
db/colors.json [deleted file]
db/migrate/20130528082732_merge_color.rb [new file with mode: 0644]
spec/controllers/authors_controller_spec.rb
spec/controllers/colors_controller_spec.rb [deleted file]
spec/controllers/ground_colors_controller_spec.rb
spec/controllers/home_controller_spec.rb
spec/controllers/panel_colors_controller_spec.rb [deleted file]
spec/factories.rb
spec/helpers/colors_helper_spec.rb [deleted file]
spec/helpers/panel_colors_helper_spec.rb [deleted file]
spec/models/color_spec.rb [deleted file]
spec/models/ground_color_spec.rb
spec/models/panel_color_spec.rb [deleted file]
spec/models/panel_spec.rb
spec/models/story_spec.rb

diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rb
deleted file mode 100644 (file)
index 82a2b2a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-class ColorsController < ApplicationController
-  layout 'test' if MagicNumber['test_layout']
-  before_filter :authenticate_admin!, :only => [:list]
-  
-  # GET /colors
-  # GET /colors.json
-  def index
-    @page = Color.page params[:page]
-    @page_size = Color.page_size params[:page_size]
-    @colors = Color.list(@page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @colors.to_json(Color.list_json_opt) }
-    end
-  end
-  
-  def show
-    @color = Color.show(params[:id], @author)
-    respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @color.to_json(Color.show_json_opt) }
-    end
-  end
-
-  def list
-    @colors = Color.all
-
-    respond_to do |format|
-      format.html { render layout: 'system' }# index.html.erb
-      format.json { render json: @colors }
-    end
-  end
-end
index ddc7327..f91a23e 100644 (file)
@@ -84,17 +84,6 @@ class HomeController < ApplicationController
     end
   end
   
-  def panel_colors
-    @page = Author.page params[:page]
-    @page_size = Author.panel_color_page_size params[:page_size]
-    @panel_colors = PanelColor.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @panel_colors.to_json(PanelColor.list_json_opt) }
-    end
-  end
-  
   def ground_pictures
     @page = Author.page params[:page]
     @page_size = Author.ground_picture_page_size params[:page_size]
diff --git a/app/controllers/panel_colors_controller.rb b/app/controllers/panel_colors_controller.rb
deleted file mode 100644 (file)
index eaaf34d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-class PanelColorsController < ApplicationController
-  layout 'test' if MagicNumber['test_layout']
-  if MagicNumber['run_mode'] == 0
-    before_filter :authenticate_user, :only => []
-    before_filter :authenticate_author, :only => []
-  else
-    before_filter :authenticate_reader, :only => [:index, :show]
-    before_filter :authenticate_user, :only => []
-    before_filter :authenticate_author, :only => []
-  end
-
-  # GET /ground_pictures
-  # GET /ground_pictures.json
-  def index
-    @page = PanelColor.page params[:page]
-    @page_size = PanelColor.page_size params[:page_size]
-    @panel_colors = PanelColor.list( @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render :json => @panel_colors.to_json(PanelColor.list_json_opt) }
-    end
-  end
-  
-  def show
-    @panel_color = PanelColor.show(params[:id], [@user, @admin])
-    respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @panel_color.to_json(PanelColor.show_json_opt) }
-    end
-  end
-
-end
diff --git a/app/helpers/colors_helper.rb b/app/helpers/colors_helper.rb
deleted file mode 100644 (file)
index f74a8a7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-module ColorsHelper
-end
diff --git a/app/helpers/panel_colors_helper.rb b/app/helpers/panel_colors_helper.rb
deleted file mode 100644 (file)
index f554e63..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-module PanelColorsHelper
-end
diff --git a/app/models/color.rb b/app/models/color.rb
deleted file mode 100644 (file)
index e06d68b..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-class Color < ActiveRecord::Base
-  belongs_to :ground_color
-
-  validates :name, :presence => true, :length => {:maximum => 50}, :uniqueness => true
-  validates :code, :presence => true, :numericality => {:greater_than_or_equal_to => 0, :less_than => 0x1000000}
-  validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
-  
-  before_validation :valid_encode
-  
-  def valid_encode
-    ['name'].each do |a|
-      next if attributes[a] == nil
-      raise Pettanr::BadRequest unless attributes[a].valid_encoding?
-    end
-  end
-  
-  def supply_default
-    self.name = 'no name' if self.name.blank?
-  end
-  
-  def overwrite 
-  end
-  
-  def visible? author
-    true
-  end
-  
-  def self.default_page_size
-    25
-  end
-  
-  def self.max_page_size
-    100
-  end
-  
-  def self.default_panel_size
-    30
-  end
-  
-  def self.page prm = nil
-    page = prm.to_i
-    page = 1 if page < 1
-    page
-  end
-  
-  def self.page_size prm = self.default_page_size
-    page_size = prm.to_i
-    page_size = self.max_page_size if page_size > self.max_page_size
-    page_size = self.default_page_size if page_size < 1
-    page_size
-  end
-  
-  def self.list page = 1, page_size = self.default_page_size
-    opt = {}
-    opt.merge!(Color.list_opt)
-    opt.merge!({:limit => page_size, :offset => (page -1) * page_size}) if page_size > 0
-    opt.merge!({:order => 'colors.t'})
-    Color.find(:all, opt)
-  end
-  
-  def self.list_opt
-    {}
-  end
-  
-  def self.list_json_opt
-    {}
-  end
-  
-  def self.show cid, au
-    opt = {}
-    opt.merge!(Color.show_opt)
-    res = Color.find(cid, opt)
-    raise ActiveRecord::Forbidden unless res.visible?(au)
-    res
-  end
-  
-  def self.show_opt
-    {}
-  end
-  
-  def self.show_json_opt
-    {}
-  end
-  
-  def self.import filename
-    Color.import_file(filename) {|name, attr| Color.store(name, attr)}
-  end
-  
-  def self.store name, attr
-    r = Color.modify_object name, attr
-    r.save
-    r
-  end
-  
-end
index de02c7b..98de711 100644 (file)
@@ -3,7 +3,7 @@ class GroundColor < ActiveRecord::Base
   belongs_to :color
   
   validates :panel_id, :numericality => {:allow_blank => true}
-  validates :color_id, :numericality => true, :existence => {:both => false}
+  validates :code, :presence => true, :numericality => {:greater_than_or_equal_to => 0, :less_than => 0x1000000}
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   
   def supply_default
@@ -68,11 +68,11 @@ class GroundColor < ActiveRecord::Base
   end
   
   def self.list_opt
-    {:include => {:panel => {:author => {}}, :color => {} }}
+    {:include => {:panel => {:author => {}} }}
   end
   
   def self.list_json_opt
-    {:include => {:panel => {:include => {:author => {}}}, :color => {} }}
+    {:include => {:panel => {:include => {:author => {}}} }}
   end
   
   def self.show cid, roles
@@ -84,11 +84,11 @@ class GroundColor < ActiveRecord::Base
   end
   
   def self.show_opt
-    {:include => {:panel => {:author => {}}, :color => {} }}
+    {:include => {:panel => {:author => {}} }}
   end
   
   def self.show_json_opt
-    {:include => {:panel => {:include => {:author => {}}}, :color => {} }}
+    {:include => {:panel => {:include => {:author => {}}} }}
   end
   
   def scenario
index 86d3ebe..84a6685 100644 (file)
@@ -7,12 +7,10 @@ class Panel < ActiveRecord::Base
   has_many :speech_balloons, :dependent => :destroy
   has_many :ground_pictures, :dependent => :destroy
   has_many :ground_colors, :dependent => :destroy
-  has_many :panel_colors, :dependent => :destroy
   accepts_nested_attributes_for :panel_pictures, :allow_destroy => true
   accepts_nested_attributes_for :speech_balloons, :allow_destroy => true
   accepts_nested_attributes_for :ground_pictures, :allow_destroy => true
   accepts_nested_attributes_for :ground_colors, :allow_destroy => true
-  accepts_nested_attributes_for :panel_colors, :allow_destroy => true
 
   validates :width, :presence => true, :numericality => true, :natural_number => true
   validates :height, :presence => true, :numericality => true, :natural_number => true
@@ -121,9 +119,6 @@ class Panel < ActiveRecord::Base
         :picture => {:artist => {}, :license => {}}
       }, 
       :ground_colors => {
-        :color => {}
-      }, 
-      :panel_colors => {
       }, 
       :author => {}
     }}
@@ -155,9 +150,6 @@ class Panel < ActiveRecord::Base
         :picture => {:artist => {}, :license => {}}
       }, 
       :ground_colors => {
-        :color => {}
-      }, 
-      :panel_colors => {
       }, 
       :author => {}
     }}
@@ -176,7 +168,7 @@ class Panel < ActiveRecord::Base
   end
   
   def grounds
-    ((self.ground_colors || []) + (self.ground_pictures || []) + (self.panel_colors || [])).compact
+    ((self.ground_colors || []) + (self.ground_pictures || [])).compact
   end
   
   def panel_elements
@@ -192,10 +184,7 @@ class Panel < ActiveRecord::Base
       :picture => {:artist => {}, :license => {}}
     }, 
     'GroundColor' => {
-      :color => {}
     }, 
-    'PanelColor' => {
-    } 
   }
   
   def self.elm_json_opt e
diff --git a/app/models/panel_color.rb b/app/models/panel_color.rb
deleted file mode 100644 (file)
index 10882f3..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-class PanelColor < ActiveRecord::Base
-  belongs_to :panel
-  
-  validates :panel_id, :numericality => {:allow_blank => true}
-  validates :z, :presence => true, :numericality => {:greater_than => 0}
-  validates :code, :presence => true, :numericality => {:greater_than_or_equal_to => 0, :less_than => 0x1000000}
-  
-  def supply_default
-  end
-  
-  def overwrite
-  end
-  
-  def visible? roles
-    if MagicNumber['run_mode'] == 0
-      return false unless guest_role_check(roles)
-    else
-      return false unless reader_role_check(roles)
-    end
-    return true if self.panel.own?(roles)
-    self.panel.visible? roles
-  end
-  
-  def self.default_page_size
-    25
-  end
-  
-  def self.max_page_size
-    100
-  end
-  
-  def self.page prm = nil
-    page = prm.to_i
-    page = 1 if page < 1
-    page
-  end
-  
-  def self.page_size prm = self.default_page_size
-    page_size = prm.to_i
-    page_size = self.max_page_size if page_size > self.max_page_size
-    page_size = self.default_page_size if page_size < 1
-    page_size
-  end
-  
-  def self.list page = 1, page_size = self.default_page_size
-    opt = {}
-    opt.merge!(PanelColor.list_opt)
-    opt.merge!({:limit => page_size, :offset => (page -1) * page_size}) if page_size > 0
-    opt.merge!({:conditions => 'panels.publish > 0', :order => 'panel_colors.updated_at desc'})
-    PanelColor.find(:all, opt)
-  end
-  
-  def self.mylist au, page = 1, page_size = Author.default_panel_color_page_size
-    opt = {}
-    opt.merge!(PanelColor.list_opt)
-    opt.merge!({:limit => page_size, :offset => (page -1) * page_size}) if page_size > 0
-    opt.merge!({:conditions => ['panels.author_id = ?', au.id], :order => 'panel_colors.updated_at desc'})
-    PanelColor.find(:all, opt)
-  end
-  
-  def self.himlist au, page = 1, page_size = Author.default_panel_color_page_size
-    opt = {}
-    opt.merge!(self.list_opt)
-    opt.merge!({:limit => page_size, :offset => (page -1) * page_size}) if page_size > 0
-    opt.merge!({:conditions => ['panels.author_id = ? and panels.publish > 0', au.id], :order => 'panel_colors.updated_at desc'})
-    PanelColor.find(:all, opt)
-  end
-  
-  def self.list_opt
-    {:include => {:panel => {:author => {}} }}
-  end
-  
-  def self.list_json_opt
-    {:include => {:panel => {:include => {:author => {}}} }}
-  end
-  
-  def self.show cid, roles
-    opt = {}
-    opt.merge!(PanelColor.show_opt)
-    res = PanelColor.find(cid, opt)
-    raise ActiveRecord::Forbidden unless res.visible?(roles)
-    res
-  end
-  
-  def self.show_opt
-    {:include => {:panel => {:author => {}} }}
-  end
-  
-  def self.show_json_opt
-    {:include => {:panel => {:include => {:author => {}}} }}
-  end
-  
-  def scenario
-    ''
-  end
-  
-end
index 9684ca8..4395ceb 100644 (file)
@@ -3,19 +3,12 @@
 <table>
   <tr>
     <th><%= t_m 'GroundColor.panel_id' -%></th>
-    <th><%= t_m 'GroundColor.color_id' -%></th>
+    <th><%= t_m 'GroundColor.code' -%></th>
     <th><%= t_m 'GroundColor.z' -%></th>
-    <th><%= t_m 'GroundColor.created_at' -%></th>
     <th><%= t_m 'GroundColor.updated_at' -%></th>
   </tr>
 
   <% @ground_colors.each do |ground_color| %>
-    <tr>
-      <td><%= link_to gc.panel_id, panel_path(gc.panel_id) %></td>
-      <td style="color: #<%= format("%06x", gc.color.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", gc.color.code) -%>;"><%= h gc.color.name %></td>
-      <td><%= gc.z %></td>
-      <td><%= distance_of_time_in_words_to_now gc.created_at %></td>
-      <td><%= distance_of_time_in_words_to_now gc.updated_at %></td>
-    </tr>
+    <%= render 'ground_colors/list_item', :ground_color => ground_color, :author => @author %>
   <% end -%>
 </table>
diff --git a/app/views/authors/panel_colors.html.erb b/app/views/authors/panel_colors.html.erb
deleted file mode 100644 (file)
index db1c472..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<h1><%= t '.title' -%></h1>
-
-<table>
-  <tr>
-    <th><%= t_m 'PanelColor.panel_id' -%></th>
-    <th><%= t_m 'PanelColor.code' -%></th>
-    <th><%= t_m 'PanelColor.z' -%></th>
-    <th><%= t_m 'PanelColor.created_at' -%></th>
-    <th><%= t_m 'PanelColor.updated_at' -%></th>
-  </tr>
-
-  <% @panel_colors.each do |panel_color| %>
-    <tr>
-      <td><%= link_to panel_color.panel_id, panel_path(panel_color.panel_id) %></td>
-      <td style="color: #<%= format("%06x", panel_color.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", panel_color.code) -%>;"><%= format("%06x", panel_color.code ^ 0xffffff) %></td>
-      <td><%= panel_color.z %></td>
-      <td><%= distance_of_time_in_words_to_now panel_color.created_at %></td>
-      <td><%= distance_of_time_in_words_to_now panel_color.updated_at %></td>
-    </tr>
-  <% end %>
-</table>
index aca158b..47f4c65 100644 (file)
   <%= link_to t('authors.show.to_ground_colors'), ground_colors_author_path(@au) %>
 </p>
 
-<p>
-  <%= link_to t('authors.show.to_panel_colors'), panel_colors_author_path(@au) %>
-</p>
-
 <% if @au.own?(@author) %>
   <%= link_to t('link.edit'), edit_author_path(@au) %>
 <% end %>
diff --git a/app/views/colors/index.html.erb b/app/views/colors/index.html.erb
deleted file mode 100644 (file)
index 839ef4f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<h1><%= t '.title' -%></h1>
-
-<table>
-<% @colors.each do |c| %>
-  <tr>
-    <td style="color: #<%= format("%06x", c.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", c.code) -%>;"><%= link_to h(c.name), color_path(c) %></td>
-  </tr>
-<% end -%>
-</table>
diff --git a/app/views/colors/list.html.erb b/app/views/colors/list.html.erb
deleted file mode 100644 (file)
index ca7f67e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<h1><%= t '.title' -%></h1>
-
-<table>
-  <tr>
-    <th><%= t_m 'Color.id' -%></th>
-    <th><%= t_m 'Color.name' -%></th>
-    <th><%= t_m 'Color.code' -%></th>
-    <th><%= t_m 'Color.code' -%></th>
-    <th><%= t_m 'Color.t' -%></th>
-    <th><%= t_m 'Color.created_at' -%></th>
-    <th><%= t_m 'Color.updated_at' -%></th>
-  </tr>
-
-<% @colors.each do |c| %>
-  <tr>
-    <td><%= c.id %></td>
-    <td><%= h c.name %></td>
-    <td><%= c.code %></td>
-    <td style="background-color: #<%= format("%06x", c.code) -%>;"></td>
-    <td><%= c.t %></td>
-    <td><%= l c.created_at %></td>
-    <td><%= l c.updated_at %></td>
-  </tr>
-<% end -%>
-</table>
diff --git a/app/views/colors/show.html.erb b/app/views/colors/show.html.erb
deleted file mode 100644 (file)
index b749fbf..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<h1><%= t('.title') %></h1>
-<p id="notice"><%= notice %></p>
-
-<p>
-  <b><%= t_m 'Color.name' -%>:</b>
-  <%= h(@color.name) %>
-</p>
-
-<p>
-  <b><%= t_m 'Color.t' -%>:</b>
-  <%= @color.t %>
-</p>
-
-<p>
-  <b><%= t_m 'Color.code' -%>:</b>
-  <%= format("%06x", @color.code) %>
-</p>
-
-<p>
-  <b><%= t_m 'Color.created_at' -%>:</b>
-  <%= l @color.created_at %>
-</p>
-
-<p>
-  <b><%= t_m 'Color.updated_at' -%>:</b>
-  <%= l @color.updated_at %>
-</p>
-
index 219f459..cadc31d 100644 (file)
@@ -28,7 +28,6 @@
       <%= link_to t_m('GroundColor'), main_app.ground_colors_path %>\r
     </td>\r
     <td width="200px" align="center" valign="middle">\r
-      <%= link_to t_m('PanelColor'), main_app.panel_colors_path %>\r
     </td>\r
   </tr>\r
 </table>\r
       <%= link_to t_m('License'), main_app.licenses_path %>\r
     </td>\r
     <td width="200px" align="center" valign="middle">\r
-      <%= link_to t_m('Color'), main_app.colors_path %>\r
-    </td>\r
-  </tr>\r
-  <tr height="100px">\r
-    <td width="200px" align="center" valign="middle">\r
       <%= link_to t_m('SystemPicture'), main_app.system_pictures_path %>\r
     </td>\r
-    <td width="200px" align="center" valign="middle">\r
-    </td>\r
-    <td width="200px" align="center" valign="middle">\r
-    </td>\r
-    <td width="200px" align="center" valign="middle">\r
-    </td>\r
   </tr>\r
 </table>\r
index 337ea40..101c4c9 100644 (file)
@@ -1,10 +1,8 @@
 <tr>
-  <td style="color: #<%= format("%06x", ground_color.color.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", ground_color.color.code) -%>;">
-    <%= h ground_color.color.name %>
-  </td>
   <td>
     <%= link_to ground_color.panel_id, panel_path(ground_color.panel) %>
   </td>
+  <td style="color: #<%= format("%06x", ground_color.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", ground_color.code) -%>;"><%= format("%06x", ground_color.code ^ 0xffffff) %></td>
   <td>
     <%= ground_color.z %>
   </td>
index a8c3e54..29c99e5 100644 (file)
@@ -3,19 +3,13 @@
 <table>
   <tr>
     <th><%= t_m 'GroundColor.panel_id' -%></th>
-    <th><%= t_m 'GroundColor.color_id' -%></th>
+    <th><%= t_m 'GroundColor.code' -%></th>
     <th><%= t_m 'GroundColor.z' -%></th>
     <th><%= t_m 'GroundColor.created_at' -%></th>
     <th><%= t_m 'GroundColor.updated_at' -%></th>
   </tr>
 
   <% @ground_colors.each do |gc| %>
-    <tr>
-      <td><%= link_to gc.panel_id, panel_path(gc.panel_id) %></td>
-      <td style="color: #<%= format("%06x", gc.color.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", gc.color.code) -%>;"><%= h gc.color.name %></td>
-      <td><%= gc.z %></td>
-      <td><%= distance_of_time_in_words_to_now gc.created_at %></td>
-      <td><%= distance_of_time_in_words_to_now gc.updated_at %></td>
-    </tr>
+    <%= render 'list_item', :ground_color => gc %>
   <% end -%>
 </table>
index 962807e..bc07f67 100644 (file)
@@ -3,7 +3,7 @@
 <table>
   <tr>
     <th><%= t_m 'GroundColor.color_id' -%></th>
-    <th><%= t_m 'GroundColor.panel_id' -%></th>
+    <th><%= t_m 'GroundColor.code' -%></th>
     <th><%= t_m 'GroundColor.z' -%></th>
     <th><%= t_m 'GroundColor.updated_at' -%></th>
   </tr>
index 690e4c3..cd86cac 100644 (file)
@@ -30,7 +30,6 @@
       <%= link_to t_m('GroundColor'), '/home/ground_colors' %>
     </td>
     <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('PanelColor'), '/home/panel_colors' %>
     </td>
   </tr>
 </table>
diff --git a/app/views/home/panel_colors.html.erb b/app/views/home/panel_colors.html.erb
deleted file mode 100644 (file)
index 1af79fc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<h1><%= t '.title' -%></h1>
-
-<table>
-  <tr>
-    <th><%= t_m 'PanelColor.panel_id' -%></th>
-    <th><%= t_m 'PanelColor.code' -%></th>
-    <th><%= t_m 'PanelColor.z' -%></th>
-    <th><%= t_m 'PanelColor.created_at' -%></th>
-    <th><%= t_m 'PanelColor.updated_at' -%></th>
-  </tr>
-
-  <% @panel_colors.each do |pc| %>
-    <%= render 'list_item', :panel_color => pc %>
-  <% end -%>
-</table>
diff --git a/app/views/panel_colors/_list_item.html.erb b/app/views/panel_colors/_list_item.html.erb
deleted file mode 100644 (file)
index f7c0a2e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<tr>
-  <td><%= link_to panel_color.panel_id, panel_path(panel_color.panel_id) %></td>
-  <td style="color: #<%= format("%06x", panel_color.code ^ 0xffffff) -%>; background-color: #<%= format("%06x", panel_color.code) -%>;"><%= format("%06x", panel_color.code ^ 0xffffff) %></td>
-  <td><%= panel_color.z %></td>
-  <td><%= distance_of_time_in_words_to_now panel_color.created_at %></td>
-  <td><%= distance_of_time_in_words_to_now panel_color.updated_at %></td>
-</tr>
diff --git a/app/views/panel_colors/index.html.erb b/app/views/panel_colors/index.html.erb
deleted file mode 100644 (file)
index 1af79fc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<h1><%= t '.title' -%></h1>
-
-<table>
-  <tr>
-    <th><%= t_m 'PanelColor.panel_id' -%></th>
-    <th><%= t_m 'PanelColor.code' -%></th>
-    <th><%= t_m 'PanelColor.z' -%></th>
-    <th><%= t_m 'PanelColor.created_at' -%></th>
-    <th><%= t_m 'PanelColor.updated_at' -%></th>
-  </tr>
-
-  <% @panel_colors.each do |pc| %>
-    <%= render 'list_item', :panel_color => pc %>
-  <% end -%>
-</table>
diff --git a/app/views/panel_colors/show.html.erb b/app/views/panel_colors/show.html.erb
deleted file mode 100644 (file)
index 51e0115..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<h1><%= t('.title') %></h1>
-<p id="notice"><%= notice %></p>
-
index aefb384..278604f 100644 (file)
@@ -26,8 +26,7 @@ ja:
       speech: セリフ
       balloon: フキダシ枠
       ground_picture: 絵地
-      ground_color: 選択色地
-      panel_color: 指定色地
+      ground_color: 色地
       original_picture: 原画
       picture: 実素材
       resource_picture: 素材
@@ -37,7 +36,6 @@ ja:
       author: 作家
       artist: 絵師
       system_picture: システム画像
-      color: 色
       provider: 貸手
       provider_status: 借受状況
       demander: 借手
@@ -146,12 +144,6 @@ ja:
         updated_at: 更新
       ground_color:
         panel_id: コマ
-        color_id: 色
-        z: 重なり
-        created_at: 作成
-        updated_at: 更新
-      panel_color:
-        panel_id: コマ
         code: カラーコード
         z: 重なり
         created_at: 作成
@@ -247,12 +239,6 @@ ja:
         md5: MD5
         created_at: 作成
         updated_at: 更新
-      color:
-        name: 色名
-        code: カラーコード
-        t: 並び順
-        created_at: 作成
-        updated_at: 更新
       provider:
         provider_status_id: 借受状況
         name: 管理名
@@ -399,9 +385,7 @@ ja:
     ground_picture:
       title: 最近使った絵地
     ground_color:
-      title: 最近選択した色地
-    panel_color:
-      title: 最近指定した色地
+      title: 最近使った色地
     configure:
       title: 設定
       caption: アカウント%{email}の設定
@@ -544,22 +528,13 @@ ja:
       title: 絵地 生単票
   ground_colors:
     index:
-      title: 選択色地一覧
+      title: 色地一覧
     show:
-      title: 選択色地詳細
+      title: 色地詳細
     list:
-      title: 選択色地 生一覧
+      title: 色地 生一覧
     browse:
-      title: 選択色地 生単票
-  panel_colors:
-    index:
-      title: 指定色地一覧
-    show:
-      title: 指定色地詳細
-    list:
-      title: 指定色地 生一覧
-    browse:
-      title: 指定色地 生単票
+      title: 色地 生単票
   original_pictures:
     index:
       title: 原画一覧
@@ -680,8 +655,7 @@ ja:
       to_panels: 最近更新したコマ
       to_panel_pictures: 最近コマで使ったコマ絵
       to_ground_pictures: 最近コマで使った絵地
-      to_ground_colors: 最近コマで使った選択色地
-      to_panel_colors: 最近コマで使った指定色地
+      to_ground_colors: 最近コマで使った色地
     comics:
       title: 最近更新したコミック
     stories:
@@ -693,9 +667,7 @@ ja:
     ground_pictures:
       title: 最近更新した絵地
     ground_colors:
-      title: 最近更新した選択色地
-    panel_colors:
-      title: 最近更新した指定色地
+      title: 最近更新した色地
     new:
       title: 作家登録
       announce: 作家登録してください
@@ -742,15 +714,6 @@ ja:
       title: システム画像 生一覧
     browse:
       title: システム画像 生単票
-  colors:
-    index:
-      title: 色一覧
-    show:
-      title: 色詳細
-    list:
-      title: 色 生一覧
-    browse:
-      title: 色 生単票
   provider_sources:
     index:
       title: 貸手文献一覧
index 4bdb1a5..08ac97b 100644 (file)
@@ -142,15 +142,6 @@ Pettanr::Application.routes.draw do
       get :browse
     end
   end
-  resources :panel_colors do
-    collection do
-      get :index
-      get :show
-    end
-    member do
-      get :browse
-    end
-  end
   resources :ground_colors do
     collection do
       get :index
@@ -255,16 +246,6 @@ Pettanr::Application.routes.draw do
       post :create
     end
   end
-  resources :colors do
-    collection do
-      get :index
-      get :show
-      get :list
-    end
-    member do
-      get :browse
-    end
-  end
   resources :system_pictures do
     collection do
       get :index
diff --git a/db/colors.json b/db/colors.json
deleted file mode 100644 (file)
index fba582f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-{\r
-  "white": {\r
-    "code": 255,\r
-    "t": 0\r
-  },\r
-  "black": {\r
-    "code": 0,\r
-    "t": 1\r
-  }\r
-}\r
diff --git a/db/migrate/20130528082732_merge_color.rb b/db/migrate/20130528082732_merge_color.rb
new file mode 100644 (file)
index 0000000..a4948b2
--- /dev/null
@@ -0,0 +1,26 @@
+class MergeColor < ActiveRecord::Migration
+  def up
+    add_column :ground_colors, :code, :integer, :null => false, :default => 0
+    remove_column :ground_colors, :color_id
+    drop_table :panel_colors
+    drop_table :colors
+  end
+
+  def down
+    remove_column :ground_colors, :code
+    create_table :panel_colors do |t|
+      t.integer :panel_id, :null => false, :default => 0
+      t.integer :z, :null => false, :default => 0
+      t.integer :code, :null => false, :default => 0
+
+      t.timestamps
+    end
+    create_table :colors do |t|
+      t.string :name, :null => false, :limit => 50, :default => 'no name'
+      t.integer :code, :null => false, :default => 0
+      t.integer :t, :null => false, :default => 0
+
+      t.timestamps
+    end
+  end
+end
index 1522b75..0ad1f83 100644 (file)
@@ -880,13 +880,12 @@ if MagicNumber['run_mode'] == 1
     end
   end
   
-  describe '対象作家の選択色地一覧表示に於いて' do
+  describe '対象作家の色地一覧表示に於いて' do
     before do
       @other_user = FactoryGirl.create( :user_yas)
       @other_author = FactoryGirl.create :author, :user_id => @other_user.id
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @color = FactoryGirl.create :color
-      @gc = FactoryGirl.create :ground_color, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       GroundColor.stub(:himlist).and_return([@gc, @gc, @gc])
       sign_in @user
@@ -926,7 +925,7 @@ if MagicNumber['run_mode'] == 1
         Author.should_receive(:show).exactly(1)
         get :ground_colors, :id => @other_author.id
       end
-      it '選択色地モデルに他作家の選択色地一覧を問い合わせている' do
+      it '色地モデルに他作家の色地一覧を問い合わせている' do
         GroundColor.should_receive(:himlist).exactly(1)
         get :ground_colors, :id => @other_author.id
       end
@@ -945,7 +944,7 @@ if MagicNumber['run_mode'] == 1
           get :ground_colors, :id => @other_author.id, :format => :json
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
         end
-        it '選択色地モデルにjson一覧出力オプションを問い合わせている' do
+        it '色地モデルにjson一覧出力オプションを問い合わせている' do
           GroundColor.should_receive(:list_json_opt).exactly(1)
           get :ground_colors, :id => @other_author.id, :format => :json
         end
@@ -954,11 +953,11 @@ if MagicNumber['run_mode'] == 1
           json = JSON.parse response.body
           json.should have_at_least(3).items
         end
-        it 'リストの先頭くらいは選択色地っぽいものであって欲しい' do
+        it 'リストの先頭くらいは色地っぽいものであって欲しい' do
           get :ground_colors, :id => @other_author.id, :format => :json
           json = JSON.parse response.body
           json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("color_id").should be_true
+          json.first.has_key?("code").should be_true
           json.first.has_key?("z").should be_true
         end
       end
@@ -1009,134 +1008,6 @@ if MagicNumber['run_mode'] == 1
     end
   end
   
-  describe '対象作家の指定色地一覧表示に於いて' do
-    before do
-      @other_user = FactoryGirl.create( :user_yas)
-      @other_author = FactoryGirl.create :author, :user_id => @other_user.id
-      @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:himlist).and_return([@pc, @pc, @pc])
-      sign_in @user
-    end
-    context 'パラメータpageについて' do
-      it '@pageに値が入る' do
-        get :panel_colors, :id => @other_author.id, :page => 5
-        assigns(:page).should eq 5
-      end
-      it '省略されると@pageに1値が入る' do
-        get :panel_colors, :id => @other_author.id
-        assigns(:page).should eq 1
-      end
-      it '与えられたpage_sizeがセットされている' do
-        get :panel_colors, :id => @other_author.id, :page_size => 15
-        assigns(:page_size).should eq 15
-      end
-      it '省略されると@page_sizeにデフォルト値が入る' do
-        get :panel_colors, :id => @other_author.id
-        assigns(:page_size).should eq Author.default_panel_color_page_size
-      end
-      it '最大を超えると@page_sizeにデフォルト最大値が入る' do
-        get :panel_colors, :id => @other_author.id, :page_size => 1500
-        assigns(:page_size).should eq Author.panel_color_max_page_size
-      end
-      it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
-        get :panel_colors, :id => @other_author.id, :page_size => 0
-        assigns(:page_size).should eq Author.panel_color_page_size
-      end
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-      it '作家モデルに単体取得を問い合わせている' do
-        Author.should_receive(:show).exactly(1)
-        get :panel_colors, :id => @other_author.id
-      end
-      it '指定色地モデルに他作家の指定色地一覧を問い合わせている' do
-        PanelColor.should_receive(:himlist).exactly(1)
-        get :panel_colors, :id => @other_author.id
-      end
-      it '@panel_colorsにリストを取得している' do
-        get :panel_colors, :id => @other_author.id
-        assigns(:panel_colors).should have_at_least(3).items
-      end
-      context 'html形式' do
-        it 'panel_colorsテンプレートを描画する' do
-          get :panel_colors, :id => @other_author.id
-          response.should render_template("panel_colors")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it '指定色地モデルにjson一覧出力オプションを問い合わせている' do
-          PanelColor.should_receive(:list_json_opt).exactly(1)
-          get :panel_colors, :id => @other_author.id, :format => :json
-        end
-        it 'データがリスト構造になっている' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          json = JSON.parse response.body
-          json.should have_at_least(3).items
-        end
-        it 'リストの先頭くらいは指定色地っぽいものであって欲しい' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          json = JSON.parse response.body
-          json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("code").should be_true
-          json.first.has_key?("z").should be_true
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :panel_colors, :id => @other_author.id
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          get :panel_colors, :id => @other_author.id
-          response.should redirect_to '/users/sign_in'
-        end
-      end
-      context 'json形式' do
-        it 'ステータスコード401 Unauthorizedを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-    context 'ユーザ権限はないが管理者権限があるとき' do
-      before do
-        sign_out @user
-        sign_in @admin
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-    end
-    context 'ユーザだが作家登録していないとき' do
-      before do
-        @author.destroy
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-    end
-  end
-  
   describe '作家数取得に於いて' do
     before do
       Author.should_receive(:visible_count).and_return(3)
@@ -1983,13 +1854,12 @@ else
     end
   end
   
-  describe '対象作家の選択色地一覧表示に於いて' do
+  describe '対象作家の色地一覧表示に於いて' do
     before do
       @other_user = FactoryGirl.create( :user_yas)
       @other_author = FactoryGirl.create :author, :user_id => @other_user.id
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @color = FactoryGirl.create :color
-      @gc = FactoryGirl.create :ground_color, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       GroundColor.stub(:himlist).and_return([@gc, @gc, @gc])
       sign_in @user
@@ -2031,53 +1901,6 @@ else
     end
   end
   
-  describe '対象作家の指定色地一覧表示に於いて' do
-    before do
-      @other_user = FactoryGirl.create( :user_yas)
-      @other_author = FactoryGirl.create :author, :user_id => @other_user.id
-      @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:himlist).and_return([@pc, @pc, @pc])
-      sign_in @user
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-      context 'html形式' do
-        it 'panel_colorsテンプレートを描画する' do
-          get :panel_colors, :id => @other_author.id
-          response.should render_template("panel_colors")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'panel_colorsテンプレートを描画する' do
-          get :panel_colors, :id => @other_author.id
-          response.should render_template("panel_colors")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-  end
-  
   describe '作家数取得に於いて' do
     before do
       Author.should_receive(:visible_count).and_return(3)
diff --git a/spec/controllers/colors_controller_spec.rb b/spec/controllers/colors_controller_spec.rb
deleted file mode 100644 (file)
index 78fc896..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-# -*- encoding: utf-8 -*-
-require 'spec_helper'
-#色
-
-describe ColorsController do
-  before do
-    @admin = FactoryGirl.create :admin
-    @user = FactoryGirl.create( :user_yas)
-    @author = FactoryGirl.create :author, :user_id => @user.id
-    @sp = FactoryGirl.create :system_picture
-    @lg = FactoryGirl.create :license_group, :name => 'peta'
-    @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
-  end
-
-if MagicNumber['run_mode'] == 1
-  describe '一覧表示に於いて' do
-    before do
-      sign_in @user
-      @color = FactoryGirl.create :color
-      Color.stub(:list).and_return([@color, @color, @color])
-    end
-    context 'パラメータpageについて' do
-      it '@pageに値が入る' do
-        get :index, :page => 5
-        assigns(:page).should eq 5
-      end
-      it '省略されると@pageに1値が入る' do
-        get :index
-        assigns(:page).should eq 1
-      end
-      it '与えられたpage_sizeがセットされている' do
-        get :index, :page_size => 15
-        assigns(:page_size).should eq 15
-      end
-      it '省略されると@page_sizeにデフォルト値が入る' do
-        get :index
-        assigns(:page_size).should eq Color.default_page_size
-      end
-      it '最大を超えると@page_sizeにデフォルト最大値が入る' do
-        get :index, :page_size => 1500
-        assigns(:page_size).should eq Color.max_page_size
-      end
-      it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
-        get :index, :page_size => 0
-        assigns(:page_size).should eq Color.default_page_size
-      end
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-      it '色モデルに一覧を問い合わせている' do
-        Color.should_receive(:list).exactly(1)
-        get :index
-      end
-      it '@colorsにリストを取得している' do
-        get :index
-        assigns(:colors).should have_at_least(3).items
-      end
-      context 'html形式' do
-        it 'indexテンプレートを描画する' do
-          get :index
-          response.should render_template("index")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :index, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it '色モデルにjson一覧出力オプションを問い合わせている' do
-          Color.should_receive(:list_json_opt).exactly(1)
-          get :index, :format => :json
-        end
-        it 'データがリスト構造になっている' do
-          get :index, :format => :json
-          json = JSON.parse response.body
-          json.should have_at_least(3).items
-        end
-        it 'リストの先頭くらいは色っぽいものであって欲しい' do
-          get :index, :format => :json
-          json = JSON.parse response.body
-          json.first.has_key?("name").should be_true
-          json.first.has_key?("code").should be_true
-          json.first.has_key?("t").should be_true
-        end
-      end
-    end
-    context '作家権限がないとき' do
-      before do
-        sign_out @user
-      end
-      it 'ステータスコード200 okを返す' do
-        get :index
-        response.status.should eq 200
-      end
-    end
-  end
-  
-  describe '単体表示に於いて' do
-    before do
-      sign_in @user
-      @color = FactoryGirl.create :color
-      Color.stub(:show).and_return(@color)
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @color.id
-        response.should be_success
-      end
-      it '色モデルに単体取得を問い合わせている' do
-        Color.should_receive(:show).exactly(1)
-        get :show
-      end
-      it '@colorにアレを取得している' do
-        get :show, :id => @color.id
-        assigns(:color).id.should eq(@color.id)
-      end
-      context 'html形式' do
-        it 'showテンプレートを描画する' do
-          get :show, :id => @color.id
-          response.should render_template("show")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :show, :id => @color.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it '色モデルにjson単体出力オプションを問い合わせている' do
-          Color.should_receive(:show_json_opt).exactly(1)
-          get :show, :id => @color.id, :format => :json
-        end
-        it 'データがアレになっている' do
-          get :show, :id => @color.id, :format => :json
-          json = JSON.parse response.body
-          json["name"].should_not be_nil
-          json["code"].should_not be_nil
-          json["t"].should_not be_nil
-        end
-      end
-    end
-    context '作家権限がないとき' do
-      before do
-        sign_out @user
-      end
-      it 'ステータスコード200 okを返す' do
-        get :show, :id => @color.id
-        response.status.should eq 200
-      end
-    end
-  end
-  
-else
-  describe '一覧表示に於いて' do
-    before do
-      sign_in @user
-      @color = FactoryGirl.create :color
-      Color.stub(:list).and_return([@color, @color, @color])
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-      context 'html形式' do
-        it 'indexテンプレートを描画する' do
-          get :index
-          response.should render_template("index")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :index, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context '作家権限がないとき' do
-      before do
-        sign_out @user
-      end
-      it 'ステータスコード200 okを返す' do
-        get :index
-        response.status.should eq 200
-      end
-      context 'html形式' do
-        it 'indexテンプレートを描画する' do
-          get :index
-          response.should render_template("index")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :index, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-  end
-  
-  describe '単体表示に於いて' do
-    before do
-      sign_in @user
-      @color = FactoryGirl.create :color
-      Color.stub(:show).and_return(@color)
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @color.id
-        response.should be_success
-      end
-      context 'html形式' do
-        it 'showテンプレートを描画する' do
-          get :show, :id => @color.id
-          response.should render_template("show")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :show, :id => @color.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context '作家権限がないとき' do
-      before do
-        sign_out @user
-      end
-      it 'ステータスコード200 okを返す' do
-        get :show, :id => @color.id
-        response.status.should eq 200
-      end
-      context 'html形式' do
-        it 'showテンプレートを描画する' do
-          get :show, :id => @color.id
-          response.should render_template("show")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :show, :id => @color.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-  end
-  
-end
-end
index be48636..b82c6a7 100644 (file)
@@ -1,6 +1,6 @@
 # -*- encoding: utf-8 -*-
 require 'spec_helper'
-#選択色地
+#色地
 
 describe GroundColorsController do
   before do
@@ -12,7 +12,6 @@ describe GroundColorsController do
     @author = FactoryGirl.create :author, :user_id => @user.id
     @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
     @panel = FactoryGirl.create :panel, :author_id => @author.id
-    @color = FactoryGirl.create :color
   end
 
 if MagicNumber['run_mode'] == 1
@@ -53,7 +52,7 @@ if MagicNumber['run_mode'] == 1
         get :index
         response.should be_success 
       end
-      it '選択色地モデルに一覧を問い合わせている' do
+      it '色地モデルに一覧を問い合わせている' do
         GroundColor.should_receive(:list).exactly(1)
         get :index
       end
@@ -72,7 +71,7 @@ if MagicNumber['run_mode'] == 1
           get :index, :format => :json
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
         end
-        it '選択色地モデルにjson一覧出力オプションを問い合わせている' do
+        it '色地モデルにjson一覧出力オプションを問い合わせている' do
           GroundColor.should_receive(:list_json_opt).exactly(1)
           get :index, :format => :json
         end
@@ -81,11 +80,11 @@ if MagicNumber['run_mode'] == 1
           json = JSON.parse response.body
           json.should have_at_least(3).items
         end
-        it 'リストの先頭くらいは選択色地っぽいものであって欲しい' do
+        it 'リストの先頭くらいは色地っぽいものであって欲しい' do
           get :index, :format => :json
           json = JSON.parse response.body
           json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("color_id").should be_true
+          json.first.has_key?("code").should be_true
           json.first.has_key?("z").should be_true
         end
       end
@@ -147,7 +146,7 @@ if MagicNumber['run_mode'] == 1
         get :show, :id => @gc.id
         response.should be_success
       end
-      it '選択色地モデルに単体取得を問い合わせている' do
+      it '色地モデルに単体取得を問い合わせている' do
         GroundColor.should_receive(:show).exactly(1)
         get :show
       end
@@ -166,7 +165,7 @@ if MagicNumber['run_mode'] == 1
           get :show, :id => @gc.id, :format => :json
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
         end
-        it '選択色地モデルにjson単体出力オプションを問い合わせている' do
+        it '色地モデルにjson単体出力オプションを問い合わせている' do
           GroundColor.should_receive(:show_json_opt).exactly(1)
           get :show, :id => @gc.id, :format => :json
         end
@@ -175,7 +174,7 @@ if MagicNumber['run_mode'] == 1
           json = JSON.parse response.body
           json["panel_id"].should_not be_nil
           json["z"].should_not be_nil
-          json["color_id"].should_not be_nil
+          json["code"].should_not be_nil
         end
       end
     end
index 102c43a..bf701bc 100644 (file)
@@ -11,7 +11,6 @@ describe HomeController do
     @user = FactoryGirl.create( :user_yas)
     @author = FactoryGirl.create :author, :user_id => @user.id
     @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
-    @color = FactoryGirl.create :color
     @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
     @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
     @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
@@ -65,9 +64,9 @@ if MagicNumber['run_mode'] == 1
         assigns(:comics).should have_at_least(3).items
       end
       context 'html形式' do
-        it 'comicテンプレートを描画する' do
+        it 'comicsテンプレートを描画する' do
           get :comics
-          response.should render_template("comic")
+          response.should render_template("comics")
         end
       end
       context 'json形式' do
@@ -165,9 +164,9 @@ if MagicNumber['run_mode'] == 1
           get :panels
           response.should be_success 
         end
-        it 'panelテンプレートを描画する' do
+        it 'panelsテンプレートを描画する' do
           get :panels
-          response.should render_template("panel")
+          response.should render_template("panels")
         end
       end
       context 'json形式' do
@@ -269,9 +268,9 @@ if MagicNumber['run_mode'] == 1
         assigns(:panel_pictures).should have_at_least(3).items
       end
       context 'html形式' do
-        it 'panel_pictureテンプレートを描画する' do
+        it 'panel_picturesテンプレートを描画する' do
           get :panel_pictures
-          response.should render_template("panel_picture")
+          response.should render_template("panel_pictures")
         end
       end
       context 'json形式' do
@@ -324,108 +323,7 @@ if MagicNumber['run_mode'] == 1
     end
   end
   
-  describe '自分のコマの色背景一覧表示に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      sign_in @user
-      PanelColor.stub(:mylist).and_return([@pc, @pc, @pc])
-    end
-    context 'パラメータpageについて' do
-      it '@pageに値が入る' do
-        get :panel_colors, :page => 5
-        assigns(:page).should eq 5
-      end
-      it '省略されると@pageに1値が入る' do
-        get :panel_colors
-        assigns(:page).should eq 1
-      end
-      it '与えられたpage_sizeがセットされている' do
-        get :panel_colors, :page_size => 15
-        assigns(:page_size).should eq 15
-      end
-      it '省略されると@page_sizeにデフォルト値が入る' do
-        get :panel_colors
-        assigns(:page_size).should eq Author.default_panel_color_page_size
-      end
-      it '最大を超えると@page_sizeにデフォルト最大値が入る' do
-        get :panel_colors, :page_size => 1500
-        assigns(:page_size).should eq Author.panel_color_max_page_size
-      end
-      it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
-        get :panel_colors, :page_size => 0
-        assigns(:page_size).should eq Author.default_panel_color_page_size
-      end
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors
-        response.should be_success 
-      end
-      it 'コマの色背景モデルに一覧を問い合わせている' do
-        PanelColor.should_receive(:mylist).exactly(1)
-        get :panel_colors
-      end
-      it '@panel_colorsにリストを取得している' do
-        get :panel_colors
-        assigns(:panel_colors).should have_at_least(3).items
-      end
-      context 'html形式' do
-        it 'panel_colorテンプレートを描画する' do
-          get :panel_colors
-          response.should render_template("panel_color")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it 'コマの色背景モデルにjson一覧出力オプションを問い合わせている' do
-          PanelColor.should_receive(:list_json_opt).exactly(1)
-          get :panel_colors, :format => :json
-        end
-        it 'データがリスト構造になっている' do
-          get :panel_colors, :format => :json
-          json = JSON.parse response.body
-          json.should have_at_least(3).items
-        end
-        it 'リストの先頭くらいはコマの色背景っぽいものであって欲しい' do
-          get :panel_colors, :format => :json
-          json = JSON.parse response.body
-          json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("code").should be_true
-          json.first.has_key?("z").should be_true
-        end
-      end
-    end
-    context '作家権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :panel_colors
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          get :panel_colors
-          response.should redirect_to '/users/sign_in'
-        end
-      end
-      context 'json形式' do
-        it 'ステータスコード401 Unauthorizedを返す' do
-          get :panel_colors, :format => :json
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          get :panel_colors, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-  end
-  
-  describe '自分のコマの画像背景一覧表示に於いて' do
+  describe '自分のコマの絵地一覧表示に於いて' do
     before do
       @gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
       sign_in @user
@@ -462,7 +360,7 @@ if MagicNumber['run_mode'] == 1
         get :ground_pictures
         response.should be_success 
       end
-      it 'コマの画像背景モデルに一覧を問い合わせている' do
+      it '絵地モデルに一覧を問い合わせている' do
         GroundPicture.should_receive(:mylist).exactly(1)
         get :ground_pictures
       end
@@ -471,9 +369,9 @@ if MagicNumber['run_mode'] == 1
         assigns(:ground_pictures).should have_at_least(3).items
       end
       context 'html形式' do
-        it 'ground_pictureテンプレートを描画する' do
+        it 'ground_picturesテンプレートを描画する' do
           get :ground_pictures
-          response.should render_template("ground_picture")
+          response.should render_template("ground_pictures")
         end
       end
       context 'json形式' do
@@ -481,7 +379,7 @@ if MagicNumber['run_mode'] == 1
           get :ground_pictures, :format => :json
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
         end
-        it 'コマの画像背景モデルにjson一覧出力オプションを問い合わせている' do
+        it '絵地モデルにjson一覧出力オプションを問い合わせている' do
           GroundPicture.should_receive(:list_json_opt).exactly(1)
           get :ground_pictures, :format => :json
         end
@@ -490,7 +388,7 @@ if MagicNumber['run_mode'] == 1
           json = JSON.parse response.body
           json.should have_at_least(3).items
         end
-        it 'リストの先頭くらいはコマの画像背景っぽいものであって欲しい' do
+        it 'リストの先頭くらいは絵地っぽいものであって欲しい' do
           get :ground_pictures, :format => :json
           json = JSON.parse response.body
           json.first.has_key?("panel_id").should be_true
@@ -526,7 +424,7 @@ if MagicNumber['run_mode'] == 1
     end
   end
   
-  describe '自分の間接背景一覧表示に於いて' do
+  describe '自分の色地一覧表示に於いて' do
     before do
       @gc = FactoryGirl.create :ground_color
       sign_in @user
@@ -563,7 +461,7 @@ if MagicNumber['run_mode'] == 1
         get :ground_colors
         response.should be_success 
       end
-      it '間接背景モデルに一覧を問い合わせている' do
+      it '色地モデルに一覧を問い合わせている' do
         GroundColor.should_receive(:mylist).exactly(1)
         get :ground_colors
       end
@@ -572,9 +470,9 @@ if MagicNumber['run_mode'] == 1
         assigns(:ground_colors).should have_at_least(3).items
       end
       context 'html形式' do
-        it 'ground_colorテンプレートを描画する' do
+        it 'ground_colorsテンプレートを描画する' do
           get :ground_colors
-          response.should render_template("ground_color")
+          response.should render_template("ground_colors")
         end
       end
       context 'json形式' do
@@ -582,7 +480,7 @@ if MagicNumber['run_mode'] == 1
           get :ground_colors, :format => :json
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
         end
-        it '間接背景モデルにjson一覧出力オプションを問い合わせている' do
+          it '色地モデルにjson一覧出力オプションを問い合わせている' do
           GroundColor.should_receive(:list_json_opt).exactly(1)
           get :ground_colors, :format => :json
         end
@@ -591,11 +489,11 @@ if MagicNumber['run_mode'] == 1
           json = JSON.parse response.body
           json.should have_at_least(3).items
         end
-        it 'リストの先頭くらいは間接背景っぽいものであって欲しい' do
+        it 'リストの先頭くらいは色地っぽいものであって欲しい' do
           get :ground_colors, :format => :json
           json = JSON.parse response.body
           json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("color_id").should be_true
+          json.first.has_key?("code").should be_true
           json.first.has_key?("z").should be_true
         end
       end
@@ -675,9 +573,9 @@ if MagicNumber['run_mode'] == 1
         assigns(:resource_pictures).should have_at_least(3).items
       end
       context 'html形式' do
-        it 'resource_pictureテンプレートを描画する' do
+        it 'resource_picturesテンプレートを描画する' do
           get :resource_pictures
-          response.should render_template("resource_picture")
+          response.should render_template("resource_pictures")
         end
       end
       context 'json形式' do
@@ -764,9 +662,9 @@ else
         response.should be_success 
       end
       context 'html形式' do
-        it 'comicテンプレートを描画する' do
+        it 'comicsテンプレートを描画する' do
           get :comics
-          response.should render_template("comic")
+          response.should render_template("comics")
         end
       end
       context 'json形式' do
@@ -815,9 +713,9 @@ else
           get :panels
           response.should be_success 
         end
-        it 'panelテンプレートを描画する' do
+        it 'panelsテンプレートを描画する' do
           get :panels
-          response.should render_template("panel")
+          response.should render_template("panels")
         end
       end
       context 'json形式' do
@@ -871,9 +769,9 @@ else
         response.should be_success 
       end
       context 'html形式' do
-        it 'panel_pictureテンプレートを描画する' do
+        it 'panel_picturesテンプレートを描画する' do
           get :panel_pictures
-          response.should render_template("panel_picture")
+          response.should render_template("panel_pictures")
         end
       end
       context 'json形式' do
@@ -910,58 +808,8 @@ else
     end
   end
   
-  describe '自分のコマの色背景一覧表示に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      sign_in @user
-      PanelColor.stub(:mylist).and_return([@pc, @pc, @pc])
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors
-        response.should be_success 
-      end
-      context 'html形式' do
-        it 'panel_colorテンプレートを描画する' do
-          get :panel_colors
-          response.should render_template("panel_color")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context '作家権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :panel_colors
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          get :panel_colors
-          response.should redirect_to '/users/sign_in'
-        end
-      end
-      context 'json形式' do
-        it 'ステータスコード401 Unauthorizedを返す' do
-          get :panel_colors, :format => :json
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          get :panel_colors, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-  end
   
-  describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®ç\94»å\83\8fè\83\8cæ\99¯一覧表示に於いて' do
+  describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®çµµå\9c°一覧表示に於いて' do
     before do
       @gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
       sign_in @user
@@ -973,9 +821,9 @@ else
         response.should be_success 
       end
       context 'html形式' do
-        it 'ground_pictureテンプレートを描画する' do
+        it 'ground_picturesテンプレートを描画する' do
           get :ground_pictures
-          response.should render_template("ground_picture")
+          response.should render_template("ground_pictures")
         end
       end
       context 'json形式' do
@@ -1012,7 +860,7 @@ else
     end
   end
   
-  describe '自分の間接背景一覧表示に於いて' do
+  describe '自分の色地一覧表示に於いて' do
     before do
       @gc = FactoryGirl.create :ground_color
       sign_in @user
@@ -1024,9 +872,9 @@ else
         response.should be_success 
       end
       context 'html形式' do
-        it 'ground_colorテンプレートを描画する' do
+        it 'ground_colorsテンプレートを描画する' do
           get :ground_colors
-          response.should render_template("ground_color")
+          response.should render_template("ground_colors")
         end
       end
       context 'json形式' do
@@ -1077,9 +925,9 @@ else
         response.should be_success 
       end
       context 'html形式' do
-        it 'resource_pictureテンプレートを描画する' do
+        it 'resource_picturesテンプレートを描画する' do
           get :resource_pictures
-          response.should render_template("resource_picture")
+          response.should render_template("resource_pictures")
         end
       end
       context 'json形式' do
diff --git a/spec/controllers/panel_colors_controller_spec.rb b/spec/controllers/panel_colors_controller_spec.rb
deleted file mode 100644 (file)
index d13900d..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-# -*- encoding: utf-8 -*-
-require 'spec_helper'
-#指定色地
-
-describe PanelColorsController do
-  before do
-    @admin = FactoryGirl.create :admin
-    @user = FactoryGirl.create( :user_yas)
-    @sp = FactoryGirl.create :system_picture
-    @lg = FactoryGirl.create :license_group, :name => 'peta'
-    @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
-    @author = FactoryGirl.create :author, :user_id => @user.id
-    @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
-    @panel = FactoryGirl.create :panel, :author_id => @author.id
-  end
-
-if MagicNumber['run_mode'] == 1
-  describe '一覧表示に於いて' do
-    before do
-      sign_in @user
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:list).and_return([@pc, @pc, @pc])
-    end
-    context 'パラメータpageについて' do
-      it '@pageに値が入る' do
-        get :index, :page => 5
-        assigns(:page).should eq 5
-      end
-      it '省略されると@pageに1値が入る' do
-        get :index
-        assigns(:page).should eq 1
-      end
-      it '与えられたpage_sizeがセットされている' do
-        get :index, :page_size => 15
-        assigns(:page_size).should eq 15
-      end
-      it '省略されると@page_sizeにデフォルト値が入る' do
-        get :index
-        assigns(:page_size).should eq PanelColor.default_page_size
-      end
-      it '最大を超えると@page_sizeにデフォルト最大値が入る' do
-        get :index, :page_size => 1500
-        assigns(:page_size).should eq PanelColor.max_page_size
-      end
-      it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
-        get :index, :page_size => 0
-        assigns(:page_size).should eq PanelColor.default_page_size
-      end
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-      it '指定色地モデルに一覧を問い合わせている' do
-        PanelColor.should_receive(:list).exactly(1)
-        get :index
-      end
-      it '@panel_colorsにリストを取得している' do
-        get :index
-        assigns(:panel_colors).should have_at_least(3).items
-      end
-      context 'html形式' do
-        it 'indexテンプレートを描画する' do
-          get :index
-          response.should render_template("index")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :index, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it '指定色地モデルにjson一覧出力オプションを問い合わせている' do
-          PanelColor.should_receive(:list_json_opt).exactly(1)
-          get :index, :format => :json
-        end
-        it 'データがリスト構造になっている' do
-          get :index, :format => :json
-          json = JSON.parse response.body
-          json.should have_at_least(3).items
-        end
-        it 'リストの先頭くらいは指定色地っぽいものであって欲しい' do
-          get :index, :format => :json
-          json = JSON.parse response.body
-          json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("code").should be_true
-          json.first.has_key?("z").should be_true
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :index
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          get :index
-          response.should redirect_to '/users/sign_in'
-        end
-      end
-      context 'json形式' do
-        it 'ステータスコード401 Unauthorizedを返す' do
-          get :index, :format => :json
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          get :index, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-    context 'ユーザ権限はないが管理者権限があるとき' do
-      before do
-        sign_out @user
-        sign_in @admin
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-    end
-    context 'ユーザだが作家登録していないとき' do
-      before do
-        @author.destroy
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-    end
-  end
-  
-  describe '単体表示に於いて' do
-    before do
-      sign_in @user
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:show).and_return(@pc)
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @pc.id
-        response.should be_success
-      end
-      it '指定色地モデルに単体取得を問い合わせている' do
-        PanelColor.should_receive(:show).exactly(1)
-        get :show
-      end
-      it '@panel_colorにアレを取得している' do
-        get :show, :id => @pc.id
-        assigns(:panel_color).should eq(@pc)
-      end
-      context 'html形式' do
-        it 'showテンプレートを描画する' do
-          get :show, :id => @pc.id
-          response.should render_template("show")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :show, :id => @pc.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it '指定色地モデルにjson単体出力オプションを問い合わせている' do
-          PanelColor.should_receive(:show_json_opt).exactly(1)
-          get :show, :id => @pc.id, :format => :json
-        end
-        it 'データがアレになっている' do
-          get :show, :id => @pc.id, :format => :json
-          json = JSON.parse response.body
-          json["panel_id"].should_not be_nil
-          json["z"].should_not be_nil
-          json["code"].should_not be_nil
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :show, :id => @pc.id
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          get :show, :id => @pc.id
-          response.body.should redirect_to '/users/sign_in'
-        end
-      end
-      context 'json形式' do
-        it 'ステータスコード401 Unauthorizedを返す' do
-          get :show, :id => @pc.id, :format => :json
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          get :show, :id => @pc.id, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-    context 'ユーザ権限はないが管理者権限があるとき' do
-      before do
-        sign_out @user
-        sign_in @admin
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @pc.id
-        response.should be_success 
-      end
-    end
-    context 'ユーザだが作家登録していないとき' do
-      before do
-        @author.destroy
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @pc.id
-        response.should be_success 
-      end
-    end
-  end
-  
-else
-  describe '一覧表示に於いて' do
-    before do
-      sign_in @user
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:list).and_return([@pc, @pc, @pc])
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-      context 'html形式' do
-        it 'indexテンプレートを描画する' do
-          get :index
-          response.should render_template("index")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :index, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :index
-        response.should be_success 
-      end
-      context 'html形式' do
-        it 'indexテンプレートを描画する' do
-          get :index
-          response.should render_template("index")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :index, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-  end
-  
-  describe '単体表示に於いて' do
-    before do
-      sign_in @user
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:show).and_return(@pc)
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @pc.id
-        response.should be_success
-      end
-      context 'html形式' do
-        it 'showテンプレートを描画する' do
-          get :show, :id => @pc.id
-          response.should render_template("show")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :show, :id => @pc.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :show, :id => @pc.id
-        response.should be_success
-      end
-      context 'html形式' do
-        it 'showテンプレートを描画する' do
-          get :show, :id => @pc.id
-          response.should render_template("show")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :show, :id => @pc.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-  end
-  
-end
-end
index e5967d7..c6e81f1 100644 (file)
@@ -61,12 +61,6 @@ FactoryGirl.define do
     license.system_picture_id 1
   end
 
-  factory :color, :class => Color do |color|
-    color.name 'black'
-    color.code 0
-    color.t 0
-  end
-
   factory :comic, :class => Comic do |comic|
     comic.title "comic"
     comic.description 'comic description'
@@ -175,15 +169,9 @@ FactoryGirl.define do
     pp.height 300
   end
 
-  factory :panel_color, :class => PanelColor do |pc|
-    pc.panel_id 1
-    pc.z 1
-    pc.code 1
-  end
-
   factory :ground_color, :class => GroundColor do |gc|
     gc.panel_id 1
-    gc.color_id 1
+    gc.code 1
     gc.z 1
   end
 
diff --git a/spec/helpers/colors_helper_spec.rb b/spec/helpers/colors_helper_spec.rb
deleted file mode 100644 (file)
index 9e0d6e5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding: utf-8 -*-
-# 
-require 'spec_helper'
-
-# Specs in this file have access to a helper object that includes
-# the ColorsHelper. For example:
-#
-# describe ColorsHelper do
-#   describe "string concat" do
-#     it "concats two strings with spaces" do
-#       helper.concat_strings("this","that").should == "this that"
-#     end
-#   end
-# end
-describe ColorsHelper do
-end
diff --git a/spec/helpers/panel_colors_helper_spec.rb b/spec/helpers/panel_colors_helper_spec.rb
deleted file mode 100644 (file)
index 2f2d817..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- encoding: utf-8 -*-
-# 
-require 'spec_helper'
-
-# Specs in this file have access to a helper object that includes
-# the PanelColorsHelper. For example:
-#
-# describe PanelColorsHelper do
-#   describe "string concat" do
-#     it "concats two strings with spaces" do
-#       helper.concat_strings("this","that").should == "this that"
-#     end
-#   end
-# end
-describe PanelColorsHelper do
-end
diff --git a/spec/models/color_spec.rb b/spec/models/color_spec.rb
deleted file mode 100644 (file)
index 9702574..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-# -*- encoding: utf-8 -*-
-require 'spec_helper'
-#色マスター
-
-describe Color do
-  before do
-    @f = Rails.root + 'spec/json/color.json'
-    @fs = Rails.root + 'spec/json/colors.json'
-    @admin = FactoryGirl.create :admin
-    @user = FactoryGirl.create( :user_yas)
-    @author = FactoryGirl.create :author, :user_id => @user.id
-    @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
-    @other_user = FactoryGirl.create( :user_yas)
-    @other_author = FactoryGirl.create :author, :user_id => @other_user.id
-    @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-    @sp = FactoryGirl.create :system_picture
-    @lg = FactoryGirl.create :license_group
-    @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
-  end
-  
-  describe '検証に於いて' do
-    before do
-      @c = FactoryGirl.build :color
-    end
-    
-    context 'オーソドックスなデータのとき' do
-      it '下限データが通る' do
-        @c.name = 'a'
-        @c.code = 0
-        @c.t = 0
-        @c.should be_valid
-      end
-      it '上限データが通る' do
-        @author.name = 'a'*30
-        @c.code = 0xffffff
-        @c.t = 99999
-        @c.should be_valid
-      end
-    end
-    
-    context 'nameを検証するとき' do
-      it 'nullなら失敗する' do
-        @c.name = ''
-        @c.should_not be_valid
-      end
-      it '51文字以上なら失敗する' do
-        @c.name = 'a'*51
-        @c.should_not be_valid
-      end
-      it '重複していたら失敗する' do
-        l = FactoryGirl.create :color
-        @c.should_not be_valid
-      end
-    end
-    context 'codeを検証するとき' do
-      it 'nullなら失敗する' do
-        @c.code = nil
-        @c.should_not be_valid
-      end
-      it '数値でなければ失敗する' do
-        @c.code = 'a'
-        @c.should_not be_valid
-      end
-      it '負なら失敗する' do
-        @c.code = -1
-        @c.should_not be_valid
-      end
-      it '24bit colorでなければ失敗する' do
-        @c.code = 0x1000000
-        @c.should_not be_valid
-      end
-    end
-    context 'tを検証するとき' do
-      it '数値でなければ失敗する' do
-        @c.t = 'a'
-        @c.should_not be_valid
-      end
-      it '0なら通る' do
-        @c.t = '0'
-        @c.should be_valid
-      end
-      it '負なら失敗する' do
-        @c.t = -1
-        @c.should_not be_valid
-      end
-    end
-  end
-  
-  describe '文字コード検証に於いて' do
-    before do
-      @c = FactoryGirl.build :color
-    end
-    
-    context 'nameを検証するとき' do
-      it 'Shift JISなら失敗する' do
-        @c.name = "\x83G\x83r\x83]\x83D"
-        lambda{
-          @c.valid_encode
-        }.should raise_error(Pettanr::BadRequest)
-      end
-    end
-    
-  end
-  
-  describe 'デフォルト値補充に於いて' do
-    it '名前がno nameになっている' do
-      @c = FactoryGirl.build :color, :name => nil
-      @c.supply_default
-      @c.name.should eq 'no name'
-    end
-  end
-  
-  describe '上書き補充に於いて' do
-    it 'defined' do
-      @c = FactoryGirl.build :color
-      @c.overwrite
-    end
-  end
-  
-  describe '上書き補充に於いて' do
-  end
-  
-  describe '閲覧許可に於いて' do
-    before do
-      @c = FactoryGirl.build :color
-    end
-    it '許可する' do
-      @c.visible?(@author).should == true
-    end
-  end
-  
-  describe '一覧取得に於いて' do
-    before do
-      @c = FactoryGirl.create :color
-    end
-    context 'page補正について' do
-      it '文字列から数値に変換される' do
-        Color.page('8').should eq 8
-      end
-      it 'nilの場合は1になる' do
-        Color.page().should eq 1
-      end
-      it '0以下の場合は1になる' do
-        Color.page('0').should eq 1
-      end
-    end
-    context 'page_size補正について' do
-      it '文字列から数値に変換される' do
-        Color.page_size('7').should eq 7
-      end
-      it 'nilの場合はColor.default_page_sizeになる' do
-        Color.page_size().should eq Color.default_page_size
-      end
-      it '0以下の場合はColor.default_page_sizeになる' do
-        Color.page_size('0').should eq Color.default_page_size
-      end
-      it 'Color.max_page_sizeを超えた場合はColor.max_page_sizeになる' do
-        Color.page_size('1000').should eq Color.max_page_size
-      end
-    end
-    context 'つつがなく終わるとき' do
-      it '一覧取得オプションを利用している' do
-        Color.stub(:list_opt).with(any_args).and_return({})
-        Color.should_receive(:list_opt).with(any_args).exactly(1)
-        r = Color.list
-      end
-    end
-    it 'リストを返す' do
-      r = Color.list
-      r.should eq [@c]
-    end
-    it 'tで並んでいる' do
-      n = FactoryGirl.create :color, :name => 'new color', :t => 1
-      l = Color.list
-      l.should eq [@c, n]
-    end
-    context 'DBに5件あって1ページの件数を2件に変えたとして' do
-      before do
-        @color2 = FactoryGirl.create :color, :name => 'new color a', :t => 1
-        @color3 = FactoryGirl.create :color, :name => 'new color b', :t => 2
-        @color4 = FactoryGirl.create :color, :name => 'new color c', :t => 3
-        @color5 = FactoryGirl.create :color, :name => 'new color d', :t => 4
-        Color.stub(:default_page_size).and_return(2)
-      end
-      it '通常は2件を返す' do
-        r = Color.list
-        r.should have(2).items 
-      end
-      it 'page=1なら末尾2件を返す' do
-        #時系列で並んでいる
-        r = Color.list(1)
-        r.should eq [@c, @color2]
-      end
-      it 'page=2なら中間2件を返す' do
-        r = Color.list(2)
-        r.should eq [@color3, @color4]
-      end
-      it 'page=3なら先頭1件を返す' do
-        r = Color.list(3)
-        r.should eq [@color5]
-      end
-    end
-    context 'DBに5件あって1ページの件数を0件に変えたとして' do
-      before do
-        @color2 = FactoryGirl.create :color, :name => 'new color a', :t => 1
-        @color3 = FactoryGirl.create :color, :name => 'new color b', :t => 2
-        @color4 = FactoryGirl.create :color, :name => 'new color c', :t => 3
-        @color5 = FactoryGirl.create :color, :name => 'new color d', :t => 4
-        Color.stub(:default_page_size).and_return(2)
-      end
-      it '通常は全件(5件)を返す' do
-        r = Color.list 5, 0
-        r.should have(5).items 
-      end
-    end
-  end
-  describe '一覧取得オプションに於いて' do
-    it '空のHashを返す' do
-      r = Color.list_opt
-      r.is_a?(Hash).should be_true
-      r.should be_empty
-    end
-  end
-  describe 'json一覧出力オプションに於いて' do
-    it '空のHashを返す' do
-      r = Color.list_json_opt
-      r.is_a?(Hash).should be_true
-      r.should be_empty
-    end
-  end
-  
-  describe '単体取得に於いて' do
-    before do
-      @c = FactoryGirl.create :color
-    end
-    context 'つつがなく終わるとき' do
-      it '単体取得オプションを利用している' do
-        Color.stub(:show_opt).with(any_args).and_return({})
-        Color.should_receive(:show_opt).with(any_args).exactly(1)
-        r = Color.show @c.id, @author
-      end
-      it '閲覧許可を問い合わせている' do
-        Color.any_instance.stub(:visible?).with(any_args).and_return(true)
-        Color.any_instance.should_receive(:visible?).with(any_args).exactly(1)
-        r = Color.show @c.id, @author
-      end
-    end
-    it '指定の色を返す' do
-      r = Color.show @author.id, @author
-      r.should eq @c
-    end
-    context '閲覧許可が出なかったとき' do
-      it '403Forbidden例外を返す' do
-        Color.any_instance.stub(:visible?).and_return(false)
-        lambda{
-          Color.show @c.id, @author
-        }.should raise_error(ActiveRecord::Forbidden)
-      end
-    end
-    context '存在しない色を開こうとしたとき' do
-      it '404RecordNotFound例外を返す' do
-        lambda{
-          Color.show 110, @author
-        }.should raise_error(ActiveRecord::RecordNotFound)
-      end
-    end
-  end
-  
-  describe '単体取得オプションに於いて' do
-    it '空のHashを返す' do
-      r = Color.show_opt
-      r.is_a?(Hash).should be_true
-      r.should be_empty
-    end
-  end
-  describe 'json単体出力オプションに於いて' do
-    it '空のHashを返す' do
-      r = Color.show_json_opt
-      r.is_a?(Hash).should be_true
-      r.should be_empty
-    end
-  end
-  
-  describe 'インポートに於いて' do
-    before do
-    end
-    context 'つつがなく終わるとき' do
-      it 'ファイルインポートを依頼する' do
-        Color.should_receive(:import_file).with(any_args).exactly(1)
-        Color.stub(:import_file).with(any_args).and_return([])
-        Color.import(@f)
-      end
-      it '色更新を一回依頼する' do
-        Color.stub(:store).with(any_args).and_return(Color.new)
-        Color.should_receive(:store).with(any_args).exactly(1)
-        Color.import(@f)
-      end
-      it '色が追加される' do
-        lambda {
-          Color.import(@f)
-        }.should change Color, :count
-      end
-      it '[]を返す' do
-        r = Color.import(@f)
-        r.should eq []
-      end
-    end
-    context '複数データがつつがなく終わるとき' do
-      it '色更新を二回依頼する' do
-        Color.stub(:store).with(any_args).and_return(Color.new)
-        Color.should_receive(:store).with(any_args).exactly(2)
-        Color.import(@fs)
-      end
-      it '色が二個追加される' do
-        lambda {
-          r = Color.import(@fs)
-        }.should change(Color, :count).by 2
-      end
-      it '[]を返す' do
-        r = Color.import(@fs)
-        r.should eq []
-      end
-    end
-  end
-  
-end
index 9ca2979..44a778c 100644 (file)
@@ -1,6 +1,6 @@
 # -*- encoding: utf-8 -*-
 require 'spec_helper'
-#選択色地
+#色地
 
 describe GroundColor do
   before do
@@ -18,20 +18,21 @@ describe GroundColor do
     @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
     @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
     @panel = FactoryGirl.create :panel, :author_id => @author.id
-    @color = FactoryGirl.create :color
   end
   
   describe '検証に於いて' do
     before do
-      @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id
     end
     
     context 'オーソドックスなデータのとき' do
       it '下限データが通る' do
+        @gc.code = 0
         @gc.z = 1
         @gc.should be_valid
       end
       it '上限データが通る' do
+        @gc.code = 99999
         @gc.z = 99999
         @gc.should be_valid
       end
@@ -44,17 +45,25 @@ describe GroundColor do
         @gc.should_not be_valid
       end
     end
-    context 'color_idを検証するとき' do
+    context 'codeを検証するとき' do
+      it 'テストデータの確認' do
+        @gc.code = 0xffffff
+        @gc.should be_valid
+      end
       it 'nullなら失敗する' do
-        @gc.color_id = nil
+        @gc.code = nil
         @gc.should_not be_valid
       end
       it '数値でなければ失敗する' do
-        @gc.color_id = 'a'
+        @gc.code = 'a'
+        @gc.should_not be_valid
+      end
+      it '負なら失敗する' do
+        @gc.code = -1
         @gc.should_not be_valid
       end
-      it '存在する色でなければ失敗する' do
-        @gc.color_id = 0
+      it '24bit colorでなければ失敗する' do
+        @gc.code = 0x1000000
         @gc.should_not be_valid
       end
     end
@@ -80,21 +89,21 @@ describe GroundColor do
   
   describe 'デフォルト値補充に於いて' do
     it 'defined' do
-      @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id
       @gc.supply_default
     end
   end
   
   describe '上書き補充に於いて' do
     it 'defined' do
-      @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id
       @gc.overwrite
     end
   end
   
   describe '閲覧許可に於いて' do
     before do
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
     end
     context 'オープンモードのとき' do
       before do
@@ -148,19 +157,19 @@ describe GroundColor do
         MagicNumber['run_mode'] = 1
         Panel.any_instance.stub(:reader_role_check).and_return(true)
       end
-      it '自分のコマの選択色地なら許可する' do
+      it '自分のコマの色地なら許可する' do
         Panel.any_instance.stub(:own?).and_return(true)
         Panel.any_instance.stub(:visible?).and_return(false)
         r = @gc.visible?([@author])
         r.should be_true
       end
-      it '他人の非公開コマの選択色地なら許可しない' do
+      it '他人の非公開コマの色地なら許可しない' do
         Panel.any_instance.stub(:own?).and_return(false)
         Panel.any_instance.stub(:visible?).and_return(false)
         r = @gc.visible?([@author])
         r.should be_false
       end
-      it '他人のコマの選択色地でも公開なら許可する' do
+      it '他人のコマの色地でも公開なら許可する' do
         Panel.any_instance.stub(:own?).and_return(false)
         Panel.any_instance.stub(:visible?).and_return(true)
         r = @gc.visible?([@author])
@@ -171,7 +180,7 @@ describe GroundColor do
   
   describe '一覧取得に於いて' do
     before do
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
     end
     context 'page補正について' do
       it '文字列から数値に変換される' do
@@ -212,22 +221,22 @@ describe GroundColor do
     it '時系列で並んでいる' do
       #公開コマなら(他人のコマであっても)含んでいる
       opl = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1
-      npl = FactoryGirl.create :ground_color, :panel_id => opl.id, :color_id => @color.id, :updated_at => Time.now + 100
+      npl = FactoryGirl.create :ground_color, :panel_id => opl.id, :updated_at => Time.now + 100
       pl = GroundColor.list
       pl.should eq [npl, @gc]
     end
-    it '非公開のコマの選択色地は含まない' do
+    it '非公開のコマの色地は含まない' do
       hpl = FactoryGirl.create :panel, :author_id => @author.id, :publish => 0
-      npl = FactoryGirl.create :ground_color, :panel_id => hpl.id, :color_id => @color.id, :updated_at => Time.now + 100
+      npl = FactoryGirl.create :ground_color, :panel_id => hpl.id, :updated_at => Time.now + 100
       pl = GroundColor.list
       pl.should eq [@gc]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
-        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :color_id => @color.id, :updated_at => Time.now + 100
-        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200
-        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300
-        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400
+        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
+        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
+        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
+        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
         GroundColor.stub(:default_page_size).and_return(2)
       end
       it '通常は2件を返す' do
@@ -250,10 +259,10 @@ describe GroundColor do
     end
     context 'DBに5件あって1ページの件数を0件に変えたとして' do
       before do
-        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :color_id => @color.id, :updated_at => Time.now + 100
-        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200
-        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300
-        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400
+        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
+        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
+        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
+        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
         GroundColor.stub(:default_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
@@ -263,9 +272,9 @@ describe GroundColor do
     end
   end
   
-  describe '自分のコマで使った選択色地一覧取得に於いて' do
+  describe '自分のコマで使った色地一覧取得に於いて' do
     before do
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
     end
     context 'つつがなく終わるとき' do
       it '一覧取得オプションを利用している' do
@@ -279,28 +288,28 @@ describe GroundColor do
       pl.should eq [@gc]
     end
     it '時系列で並んでいる' do
-      npl = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id, :z => 2, :updated_at => Time.now + 100
+      npl = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 100
       pl = GroundColor.mylist @author
       pl.should eq [npl, @gc]
     end
-    it '他人のコマの選択色地は公開でも含まない' do
+    it '他人のコマの色地は公開でも含まない' do
       hpl = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1
-      npl = FactoryGirl.create :ground_color, :panel_id => hpl.id, :color_id => @color.id
+      npl = FactoryGirl.create :ground_color, :panel_id => hpl.id
       pl = GroundColor.mylist @author
       pl.should eq [@gc]
     end
-    it '自分のコマの選択色地は非公開でも含んでいる' do
+    it '自分のコマの色地は非公開でも含んでいる' do
       hpl = FactoryGirl.create :panel, :author_id => @author.id, :publish => 0
-      npl = FactoryGirl.create :ground_color, :panel_id => hpl.id, :color_id => @color.id, :z => 2, :updated_at => Time.now + 100
+      npl = FactoryGirl.create :ground_color, :panel_id => hpl.id, :z => 2, :updated_at => Time.now + 100
       pl = GroundColor.mylist @author
       pl.should eq [npl, @gc]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
-        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :color_id => @color.id, :updated_at => Time.now + 100
-        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200
-        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300
-        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400
+        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
+        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
+        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
+        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
       end
       it '通常は2件を返す' do
         c = GroundColor.mylist @author, 1, 2
@@ -322,10 +331,10 @@ describe GroundColor do
     end
     context 'DBに5件あって1ページの件数を0件に変えたとして' do
       before do
-        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :color_id => @color.id, :updated_at => Time.now + 100
-        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200
-        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300
-        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400
+        @gc2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
+        @gc3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
+        @gc4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
+        @gc5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
         Author.stub(:default_ground_color_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
@@ -335,11 +344,11 @@ describe GroundColor do
     end
   end
   
-  describe '他作家の選択色地一覧取得に於いて' do
+  describe '他作家の色地一覧取得に於いて' do
     before do
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
       @other_panel = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1
-      @other_gc = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id
+      @other_gc = FactoryGirl.create :ground_color, :panel_id => @other_panel.id
     end
     it 'リストを返す' do
       r = GroundColor.himlist @other_author
@@ -347,22 +356,22 @@ describe GroundColor do
     end
     it '時系列で並んでいる' do
       new_panel = FactoryGirl.create :panel, :author_id => @other_author.id, :updated_at => Time.now + 100
-      new_gc = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 100
+      new_gc = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 100
       r = GroundColor.himlist @other_author
       r.should eq [new_gc, @other_gc]
     end
     it '公開コマに限る' do
       hidden_panel = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 0
-      hidden_gc = FactoryGirl.create :ground_color, :panel_id => hidden_panel.id, :color_id => @color.id
+      hidden_gc = FactoryGirl.create :ground_color, :panel_id => hidden_panel.id
       r = GroundColor.himlist @other_author
       r.should eq [@other_gc]
     end
     context 'DBに5件あって1ページの件数を2件に変えたとして' do
       before do
-        @other_gc2 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 100
-        @other_gc3 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 200
-        @other_gc4 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 300
-        @other_gc5 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 400
+        @other_gc2 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 100
+        @other_gc3 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 200
+        @other_gc4 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 300
+        @other_gc5 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 400
       end
       it '通常は2件を返す' do
         pl = GroundColor.himlist @other_author, 1, 2
@@ -384,10 +393,10 @@ describe GroundColor do
     end
     context 'DBに5件あって1ページの件数を0件に変えたとして' do
       before do
-        @other_gc2 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 100
-        @other_gc3 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 200
-        @other_gc4 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 300
-        @other_gc5 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :color_id => @color.id, :updated_at => Time.now + 400
+        @other_gc2 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 100
+        @other_gc3 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 200
+        @other_gc4 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 300
+        @other_gc5 = FactoryGirl.create :ground_color, :panel_id => @other_panel.id, :updated_at => Time.now + 400
         Author.stub(:default_ground_color_page_size).and_return(2)
       end
       it '通常は全件(5件)を返す' do
@@ -402,9 +411,9 @@ describe GroundColor do
       r = GroundColor.list_opt
       r.has_key?(:include).should be_true
     end
-    it '2つの項目を含んでいる' do
+    it '1つの項目を含んでいる' do
       r = GroundColor.list_opt[:include]
-      r.should have(2).items
+      r.should have(1).items
     end
     it 'コマを含んでいる' do
       r = GroundColor.list_opt[:include]
@@ -414,10 +423,6 @@ describe GroundColor do
         r = GroundColor.list_opt[:include]
         r[:panel].has_key?(:author).should be_true
       end
-    it '色を含んでいる' do
-      r = GroundColor.list_opt[:include]
-      r.has_key?(:color).should be_true
-    end
   end
   describe 'json一覧出力オプションに於いて' do
     before do
@@ -428,7 +433,7 @@ describe GroundColor do
       @comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
       @panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
       @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
     end
     it 'コマを含んでいる' do
       r = GroundColor.list.to_json GroundColor.list_json_opt
@@ -443,17 +448,11 @@ describe GroundColor do
         s = i['panel']
         s.has_key?('author').should be_true
       end
-    it '色を含んでいる' do
-      r = GroundColor.list.to_json GroundColor.list_json_opt
-      j = JSON.parse r
-      i = j.first
-      i.has_key?('color').should be_true
-    end
   end
   
   describe '単体取得に於いて' do
     before do
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
     end
     context 'つつがなく終わるとき' do
       it '単体取得オプションを利用している' do
@@ -467,7 +466,7 @@ describe GroundColor do
         r = GroundColor.show @gc.id, @author
       end
     end
-    it '指定の選択色地を返す' do
+    it '指定の色地を返す' do
       GroundColor.any_instance.stub(:visible?).and_return(true)
       pl = GroundColor.show @gc.id, @author
       pl.should eq @gc
@@ -480,7 +479,7 @@ describe GroundColor do
         }.should raise_error(ActiveRecord::Forbidden)
       end
     end
-    context '存在しない選択色地を開こうとしたとき' do
+    context '存在しない色地を開こうとしたとき' do
       it '404RecordNotFound例外を返す' do
         lambda{
           GroundColor.show 110, @author
@@ -493,9 +492,9 @@ describe GroundColor do
       r = GroundColor.show_opt
       r.has_key?(:include).should be_true
     end
-    it '2つの項目を含んでいる' do
+    it '1つの項目を含んでいる' do
       r = GroundColor.show_opt[:include]
-      r.should have(2).items
+      r.should have(1).items
     end
     it 'コマを含んでいる' do
       r = GroundColor.show_opt[:include]
@@ -505,14 +504,10 @@ describe GroundColor do
         r = GroundColor.show_opt[:include]
         r[:panel].has_key?(:author).should be_true
       end
-    it '色を含んでいる' do
-      r = GroundColor.show_opt[:include]
-      r.has_key?(:color).should be_true
-    end
   end
   describe 'json単体出力オプションに於いて' do
     before do
-      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id
     end
     it 'コマを含んでいる' do
       r = GroundColor.show(@gc.id, @author).to_json GroundColor.show_json_opt
@@ -527,12 +522,6 @@ describe GroundColor do
         s = i['panel']
         s.has_key?('author').should be_true
       end
-    it '色を含んでいる' do
-      r = GroundColor.show(@gc.id, @author).to_json GroundColor.show_json_opt
-      j = JSON.parse r
-      i = j
-      i.has_key?('color').should be_true
-    end
   end
   
 end
diff --git a/spec/models/panel_color_spec.rb b/spec/models/panel_color_spec.rb
deleted file mode 100644 (file)
index 13969aa..0000000
+++ /dev/null
@@ -1,529 +0,0 @@
-# -*- encoding: utf-8 -*-
-require 'spec_helper'
-#指定色地
-
-describe PanelColor do
-  before do
-    @admin = FactoryGirl.create :admin
-    @user = FactoryGirl.create( :user_yas)
-    @author = FactoryGirl.create :author, :user_id => @user.id
-    @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
-    @other_user = FactoryGirl.create( :user_yas)
-    @other_author = FactoryGirl.create :author, :user_id => @other_user.id
-    @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-    @sp = FactoryGirl.create :system_picture
-    @lg = FactoryGirl.create :license_group
-    @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
-    @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
-    @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
-    @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
-    @panel = FactoryGirl.create :panel, :author_id => @author.id
-  end
-  
-  describe '検証に於いて' do
-    before do
-      @pc = FactoryGirl.build :panel_color, :panel_id => @panel.id
-    end
-    
-    context 'オーソドックスなデータのとき' do
-      it '下限データが通る' do
-        @pc.z = 1
-        @pc.code = 0
-        @pc.should be_valid
-      end
-      it '上限データが通る' do
-        @pc.z = 99999
-        @pc.code = 0xffffff
-        @pc.should be_valid
-      end
-    end
-    
-    
-    context 'panel_idを検証するとき' do
-      #ネストの保存はnilを許可しなければならないので数値チェックだけ
-      it 'テストデータの確認' do
-        @pc.panel_id = @panel.id
-        @pc.should be_valid
-      end
-      it '数値でなければ失敗する' do
-        @pc.panel_id = 'a'
-        @pc.should_not be_valid
-      end
-    end
-    context 'codeを検証するとき' do
-      it 'テストデータの確認' do
-        @pc.code = 0xffffff
-        @pc.should be_valid
-      end
-      it 'nullなら失敗する' do
-        @pc.code = nil
-        @pc.should_not be_valid
-      end
-      it '数値でなければ失敗する' do
-        @pc.code = 'a'
-        @pc.should_not be_valid
-      end
-      it '負なら失敗する' do
-        @pc.code = -1
-        @pc.should_not be_valid
-      end
-      it '24bit colorでなければ失敗する' do
-        @pc.code = 0x1000000
-        @pc.should_not be_valid
-      end
-    end
-    context 'zを検証するとき' do
-      it 'テストデータの確認' do
-        @pc.z = 1
-        @pc.should be_valid
-      end
-      it 'nullなら失敗する' do
-        @pc.z = nil
-        @pc.should_not be_valid
-      end
-      it '数値でなければ失敗する' do
-        @pc.z = 'a'
-        @pc.should_not be_valid
-      end
-      it '負なら失敗する' do
-        @pc.z = -1
-        @pc.should_not be_valid
-      end
-      it '負なら失敗する' do
-        @pc.z = 0
-        @pc.should_not be_valid
-      end
-    end
-  end
-  
-  describe 'デフォルト値補充に於いて' do
-    it 'defined' do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      @pc.supply_default
-    end
-  end
-  
-  describe '上書き補充に於いて' do
-    it 'defined' do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      @pc.overwrite
-    end
-  end
-  
-  describe '閲覧許可に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-    end
-    context 'オープンモードのとき' do
-      before do
-        MagicNumber['run_mode'] = 0
-      end
-      it '自身にゲスト用ロールチェックを問い合わせしている' do
-        PanelColor.any_instance.stub(:guest_role_check).and_return(true)
-        PanelColor.any_instance.should_receive(:guest_role_check).with(any_args).exactly(1)
-        r = @pc.visible?([@author])
-      end
-      it 'ゲスト用ロールチェックが失敗したとき、falseを返す' do
-        PanelColor.any_instance.stub(:guest_role_check).and_return(false)
-        r = @pc.visible?([@author])
-        r.should be_false
-      end
-    end
-    context 'クローズドモードのとき' do
-      before do
-        MagicNumber['run_mode'] = 1
-      end
-      it '自身に読者用ロールチェックを問い合わせしている' do
-        PanelColor.any_instance.stub(:reader_role_check).and_return(true)
-        PanelColor.any_instance.should_receive(:reader_role_check).with(any_args).exactly(1)
-        r = @pc.visible?([@author])
-      end
-      it '読者用ロールチェックが失敗したとき、falseを返す' do
-        PanelColor.any_instance.stub(:reader_role_check).and_return(false)
-        r = @pc.visible?([@author])
-        r.should be_false
-      end
-    end
-    context '事前チェックする' do
-      before do
-        MagicNumber['run_mode'] = 1
-        PanelColor.any_instance.stub(:reader_role_check).and_return(true)
-      end
-      it '自身のコマに所持判定を問い合わせしている' do
-        Panel.any_instance.stub(:own?).and_return(true)
-        Panel.any_instance.should_receive(:own?).with(any_args).exactly(1)
-        r = @pc.visible?([@author])
-      end
-      it '自身のコマに閲覧許可を問い合わせしている' do
-        Panel.any_instance.stub(:own?).and_return(false)
-        Panel.any_instance.stub(:visible?).and_return(true)
-        Panel.any_instance.should_receive(:visible?).with(any_args).exactly(1)
-        r = @pc.visible?([@author])
-      end
-    end
-    context 'つつがなく終わるとき' do
-      before do
-        MagicNumber['run_mode'] = 1
-        Panel.any_instance.stub(:reader_role_check).and_return(true)
-      end
-      it '自分のコマの指定色地なら許可する' do
-        Panel.any_instance.stub(:own?).and_return(true)
-        Panel.any_instance.stub(:visible?).and_return(false)
-        r = @pc.visible?([@author])
-        r.should be_true
-      end
-      it '他人の非公開コマの指定色地なら許可しない' do
-        Panel.any_instance.stub(:own?).and_return(false)
-        Panel.any_instance.stub(:visible?).and_return(false)
-        r = @pc.visible?([@author])
-        r.should be_false
-      end
-      it '他人のコマの指定色地でも公開なら許可する' do
-        Panel.any_instance.stub(:own?).and_return(false)
-        Panel.any_instance.stub(:visible?).and_return(true)
-        r = @pc.visible?([@author])
-        r.should be_true
-      end
-    end
-  end
-  
-  describe '一覧取得に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-    end
-    context 'page補正について' do
-      it '文字列から数値に変換される' do
-        PanelColor.page('8').should eq 8
-      end
-      it 'nilの場合は1になる' do
-        PanelColor.page().should eq 1
-      end
-      it '0以下の場合は1になる' do
-        PanelColor.page('0').should eq 1
-      end
-    end
-    context 'page_size補正について' do
-      it '文字列から数値に変換される' do
-        PanelColor.page_size('7').should eq 7
-      end
-      it 'nilの場合はPanelColor.default_page_sizeになる' do
-        PanelColor.page_size().should eq PanelColor.default_page_size
-      end
-      it '0以下の場合はPanelColor.default_page_sizeになる' do
-        PanelColor.page_size('0').should eq PanelColor.default_page_size
-      end
-      it 'PanelColor.max_page_sizeを超えた場合はPanelColor.max_page_sizeになる' do
-        PanelColor.page_size('1000').should eq PanelColor.max_page_size
-      end
-    end
-    it 'リストを返す' do
-      pl = PanelColor.list
-      pl.should eq [@pc]
-    end
-    it '時系列で並んでいる' do
-      #公開コマなら(他人のコマであっても)含んでいる
-      opl = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1
-      npl = FactoryGirl.create :panel_color, :panel_id => opl.id, :z => 2, :updated_at => Time.now + 100
-      pl = PanelColor.list
-      pl.should eq [npl, @pc]
-    end
-    it '非公開のコマの指定色地は含まない' do
-      hpl = FactoryGirl.create :panel, :author_id => @author.id, :publish => 0
-      npl = FactoryGirl.create :panel_color, :panel_id => hpl.id, :updated_at => Time.now + 100
-      pl = PanelColor.list
-      pl.should eq [@pc]
-    end
-    context 'DBに5件あって1ページの件数を2件に変えたとして' do
-      before do
-        @pc2 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
-        @pc3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
-        @pc4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
-        @pc5 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
-        PanelColor.stub(:default_page_size).and_return(2)
-      end
-      it '通常は2件を返す' do
-        pl = PanelColor.list
-        pl.should have(2).items 
-      end
-      it 'page=1なら末尾2件を返す' do
-        #時系列で並んでいる
-        pl = PanelColor.list(1)
-        pl.should eq [@pc5, @pc4]
-      end
-      it 'page=2なら中間2件を返す' do
-        pl = PanelColor.list(2)
-        pl.should eq [@pc3, @pc2]
-      end
-      it 'page=3なら先頭1件を返す' do
-        pl = PanelColor.list(3)
-        pl.should eq [@pc]
-      end
-    end
-    context 'DBに5件あって1ページの件数を0件に変えたとして' do
-      before do
-        @pc2 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
-        @pc3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
-        @pc4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
-        @pc5 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
-        PanelColor.stub(:default_page_size).and_return(2)
-      end
-      it '通常は全件(5件)を返す' do
-        r = PanelColor.list 5, 0
-        r.should have(5).items 
-      end
-    end
-  end
-  
-  describe '自分のコマで使った指定色地一覧取得に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-    end
-    context 'つつがなく終わるとき' do
-      it '一覧取得オプションを利用している' do
-        PanelColor.stub(:list_opt).with(any_args).and_return({:include => :panel})
-        PanelColor.should_receive(:list_opt).with(any_args).exactly(1)
-        r = PanelColor.mylist @author
-      end
-    end
-    it 'リストを返す' do
-      pl = PanelColor.mylist @author
-      pl.should eq [@pc]
-    end
-    it '時系列で並んでいる' do
-      npl = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 100
-      pl = PanelColor.mylist @author
-      pl.should eq [npl, @pc]
-    end
-    it '他人のコマの指定色地は公開でも含まない' do
-      hpl = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1
-      npl = FactoryGirl.create :panel_color, :panel_id => hpl.id
-      pl = PanelColor.mylist @author
-      pl.should eq [@pc]
-    end
-    it '自分のコマの指定色地は非公開でも含んでいる' do
-      hpl = FactoryGirl.create :panel, :author_id => @author.id, :publish => 0
-      npl = FactoryGirl.create :panel_color, :panel_id => hpl.id, :z => 2, :updated_at => Time.now + 100
-      pl = PanelColor.mylist @author
-      pl.should eq [npl, @pc]
-    end
-    context 'DBに5件あって1ページの件数を2件に変えたとして' do
-      before do
-        @pc2 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
-        @pc3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
-        @pc4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
-        @pc5 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
-      end
-      it '通常は2件を返す' do
-        c = PanelColor.mylist @author, 1, 2
-        c.should have(2).items 
-      end
-      it 'page=1なら末尾2件を返す' do
-        #時系列で並んでいる
-        c = PanelColor.mylist(@author, 1, 2)
-        c.should eq [@pc5, @pc4]
-      end
-      it 'page=2なら中間2件を返す' do
-        c = PanelColor.mylist(@author, 2, 2)
-        c.should eq [@pc3, @pc2]
-      end
-      it 'page=3なら先頭1件を返す' do
-        c = PanelColor.mylist(@author, 3, 2)
-        c.should eq [@pc]
-      end
-    end
-    context 'DBに5件あって1ページの件数を0件に変えたとして' do
-      before do
-        @pc2 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100
-        @pc3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200
-        @pc4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300
-        @pc5 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 4, :updated_at => Time.now + 400
-        Author.stub(:default_panel_color_page_size).and_return(2)
-      end
-      it '通常は全件(5件)を返す' do
-        r = PanelColor.mylist @author, 5, 0
-        r.should have(5).items 
-      end
-    end
-  end
-  
-  describe '他作家の指定色地一覧取得に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      @other_panel = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1
-      @other_pc = FactoryGirl.create :panel_color, :panel_id => @other_panel.id
-    end
-    it 'リストを返す' do
-      r = PanelColor.himlist @other_author
-      r.should eq [@other_pc]
-    end
-    it '時系列で並んでいる' do
-      new_panel = FactoryGirl.create :panel, :author_id => @other_author.id, :updated_at => Time.now + 100
-      new_pc = FactoryGirl.create :panel_color, :panel_id => new_panel.id, :updated_at => Time.now + 100
-      r = PanelColor.himlist @other_author
-      r.should eq [new_pc, @other_pc]
-    end
-    it '公開コマに限る' do
-      hidden_panel = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 0
-      hidden_pc = FactoryGirl.create :panel_color, :panel_id => hidden_panel.id
-      r = PanelColor.himlist @other_author
-      r.should eq [@other_pc]
-    end
-    context 'DBに5件あって1ページの件数を2件に変えたとして' do
-      before do
-        @other_pc2 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 100
-        @other_pc3 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 200
-        @other_pc4 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 300
-        @other_pc5 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 400
-      end
-      it '通常は2件を返す' do
-        pl = PanelColor.himlist @other_author, 1, 2
-        pl.should have(2).items 
-      end
-      it 'page=1なら末尾2件を返す' do
-        #時系列で並んでいる
-        pl = PanelColor.himlist @other_author, 1, 2
-        pl.should eq [@other_pc5, @other_pc4]
-      end
-      it 'page=2なら中間2件を返す' do
-        pl = PanelColor.himlist @other_author, 2, 2
-        pl.should eq [@other_pc3, @other_pc2]
-      end
-      it 'page=3なら先頭1件を返す' do
-        pl = PanelColor.himlist @other_author, 3, 2
-        pl.should eq [@other_pc]
-      end
-    end
-    context 'DBに5件あって1ページの件数を0件に変えたとして' do
-      before do
-        @other_pc2 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 100
-        @other_pc3 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 200
-        @other_pc4 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 300
-        @other_pc5 = FactoryGirl.create :panel_color, :panel_id => @other_panel.id, :updated_at => Time.now + 400
-        Author.stub(:default_panel_color_page_size).and_return(2)
-      end
-      it '通常は全件(5件)を返す' do
-        r = PanelColor.himlist @other_author, 5, 0
-        r.should have(5).items 
-      end
-    end
-  end
-  
-  describe '一覧取得オプションに於いて' do
-    it 'includeキーを含んでいる' do
-      r = PanelColor.list_opt
-      r.has_key?(:include).should be_true
-    end
-    it '1つの項目を含んでいる' do
-      r = PanelColor.list_opt[:include]
-      r.should have(1).items
-    end
-    it 'コマを含んでいる' do
-      r = PanelColor.list_opt[:include]
-      r.has_key?(:panel).should be_true
-    end
-      it 'コマは作家を含んでいる' do
-        r = PanelColor.list_opt[:include]
-        r[:panel].has_key?(:author).should be_true
-      end
-  end
-  describe 'json一覧出力オプションに於いて' do
-    before do
-      @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
-      @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
-      @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
-      @sbt = FactoryGirl.create :speech_balloon_template
-      @comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
-      @panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id
-    end
-    it 'コマを含んでいる' do
-      r = PanelColor.list.to_json PanelColor.list_json_opt
-      j = JSON.parse r
-      i = j.first
-      i.has_key?('panel').should be_true
-    end
-      it 'コマは作家を含んでいる' do
-        r = PanelColor.list.to_json PanelColor.list_json_opt
-        j = JSON.parse r
-        i = j.first
-        s = i['panel']
-        s.has_key?('author').should be_true
-      end
-  end
-  
-  describe '単体取得に於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-    end
-    context 'つつがなく終わるとき' do
-      it '単体取得オプションを利用している' do
-        PanelColor.stub(:show_opt).with(any_args).and_return({:include => :panel})
-        PanelColor.should_receive(:show_opt).with(any_args).exactly(1)
-        r = PanelColor.show @pc.id, @author
-      end
-      it '閲覧許可を問い合わせている' do
-        PanelColor.any_instance.stub(:visible?).with(any_args).and_return(true)
-        PanelColor.any_instance.should_receive(:visible?).with(any_args).exactly(1)
-        r = PanelColor.show @pc.id, @author
-      end
-    end
-    it '指定の指定色地を返す' do
-      PanelColor.any_instance.stub(:visible?).and_return(true)
-      pl = PanelColor.show @pc.id, @author
-      pl.should eq @pc
-    end
-    context '閲覧許可が出なかったとき' do
-      it '403Forbidden例外を返す' do
-        PanelColor.any_instance.stub(:visible?).and_return(false)
-        lambda{
-          PanelColor.show @pc.id, @author
-        }.should raise_error(ActiveRecord::Forbidden)
-      end
-    end
-    context '存在しない指定色地を開こうとしたとき' do
-      it '404RecordNotFound例外を返す' do
-        lambda{
-          PanelColor.show 110, @author
-        }.should raise_error(ActiveRecord::RecordNotFound)
-      end
-    end
-  end
-  describe '単体取得オプションに於いて' do
-    it 'includeキーを含んでいる' do
-      r = PanelColor.show_opt
-      r.has_key?(:include).should be_true
-    end
-    it '1つの項目を含んでいる' do
-      r = PanelColor.show_opt[:include]
-      r.should have(1).items
-    end
-    it 'コマを含んでいる' do
-      r = PanelColor.show_opt[:include]
-      r.has_key?(:panel).should be_true
-    end
-      it 'コマは作家を含んでいる' do
-        r = PanelColor.show_opt[:include]
-        r[:panel].has_key?(:author).should be_true
-      end
-  end
-  describe 'json単体出力オプションに於いて' do
-    before do
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-    end
-    it 'コマを含んでいる' do
-      r = PanelColor.show(@pc.id, @author).to_json PanelColor.show_json_opt
-      j = JSON.parse r
-      i = j
-      i.has_key?('panel').should be_true
-    end
-      it 'コマは作家を含んでいる' do
-        r = PanelColor.show(@pc.id, @author).to_json PanelColor.show_json_opt
-        j = JSON.parse r
-        i = j
-        s = i['panel']
-        s.has_key?('author').should be_true
-      end
-  end
-  
-end
index ed2b56c..853ff23 100644 (file)
@@ -7,7 +7,6 @@ describe Panel do
     @sp = FactoryGirl.create :system_picture\r
     @lg = FactoryGirl.create :license_group\r
     @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id\r
-    @color = FactoryGirl.create :color\r
     @user = FactoryGirl.create( :user_yas)\r
     @author = FactoryGirl.create :author, :user_id => @user.id\r
     @artist = FactoryGirl.create :artist_yas, :author_id => @author.id\r
@@ -542,9 +541,9 @@ describe Panel do
       r = Panel.list_opt\r
       r.has_key?(:include).should be_true\r
     end\r
-    it '6つの項目を含んでいる' do\r
+    it '5つの項目を含んでいる' do\r
       r = Panel.list_opt[:include]\r
-      r.should have(6).items\r
+      r.should have(5).items\r
     end\r
     it 'コマ絵を含んでいる' do\r
       r = Panel.list_opt[:include]\r
@@ -574,11 +573,11 @@ describe Panel do
         r = Panel.list_opt[:include]\r
         r[:speech_balloons].has_key?(:speeches).should be_true\r
       end\r
-    it '景色画像を含んでいる' do\r
+    it '絵地を含んでいる' do\r
       r = Panel.list_opt[:include]\r
       r.has_key?(:ground_pictures).should be_true\r
     end\r
-      it '景色画像は実素材を含んでいる' do\r
+      it '絵地は実素材を含んでいる' do\r
         r = Panel.list_opt[:include]\r
         r[:ground_pictures].has_key?(:picture).should be_true\r
       end\r
@@ -590,18 +589,10 @@ describe Panel do
           r = Panel.list_opt[:include]\r
           r[:ground_pictures][:picture].has_key?(:license).should be_true\r
         end\r
-    it '間接色を含んでいる' do\r
+    it '色地を含んでいる' do\r
       r = Panel.list_opt[:include]\r
       r.has_key?(:ground_colors).should be_true\r
     end\r
-      it '間接色は色を含んでいる' do\r
-        r = Panel.list_opt[:include]\r
-        r[:ground_colors].has_key?(:color).should be_true\r
-      end\r
-    it '景色を含んでいる' do\r
-      r = Panel.list_opt[:include]\r
-      r.has_key?(:panel_colors).should be_true\r
-    end\r
     it '作家を含んでいる' do\r
       r = Panel.list_opt[:include]\r
       r.has_key?(:author).should be_true\r
@@ -689,9 +680,9 @@ describe Panel do
       r = Panel.show_opt\r
       r.has_key?(:include).should be_true\r
     end\r
-    it '6つの項目を含んでいる' do\r
+    it '5つの項目を含んでいる' do\r
       r = Panel.show_opt[:include]\r
-      r.should have(6).items\r
+      r.should have(5).items\r
     end\r
     it 'コマ絵を含んでいる' do\r
       r = Panel.show_opt[:include]\r
@@ -721,11 +712,11 @@ describe Panel do
         r = Panel.show_opt[:include]\r
         r[:speech_balloons].has_key?(:speeches).should be_true\r
       end\r
-    it '景色画像を含んでいる' do\r
+    it '絵地を含んでいる' do\r
       r = Panel.show_opt[:include]\r
       r.has_key?(:ground_pictures).should be_true\r
     end\r
-      it '景色画像は実素材を含んでいる' do\r
+      it '絵地は実素材を含んでいる' do\r
         r = Panel.show_opt[:include]\r
         r[:ground_pictures].has_key?(:picture).should be_true\r
       end\r
@@ -737,18 +728,10 @@ describe Panel do
           r = Panel.show_opt[:include]\r
           r[:ground_pictures][:picture].has_key?(:license).should be_true\r
         end\r
-    it '間接色を含んでいる' do\r
+    it '色地を含んでいる' do\r
       r = Panel.show_opt[:include]\r
       r.has_key?(:ground_colors).should be_true\r
     end\r
-      it '間接色は色を含んでいる' do\r
-        r = Panel.show_opt[:include]\r
-        r[:ground_colors].has_key?(:color).should be_true\r
-      end\r
-    it '景色を含んでいる' do\r
-      r = Panel.show_opt[:include]\r
-      r.has_key?(:panel_colors).should be_true\r
-    end\r
     it '作家を含んでいる' do\r
       r = Panel.show_opt[:include]\r
       r.has_key?(:author).should be_true\r
@@ -765,14 +748,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     it 'リストを返している' do\r
@@ -784,11 +764,10 @@ describe Panel do
       r.include?(@pp).should be_true\r
       r.include?(@sb).should be_true\r
     end\r
-    it '景色素材と景色カラーと景色カラーコードを含んでいない' do\r
+    it '絵地と色地を含んでいない' do\r
       r = @panel.parts_element\r
       r.include?(@gc).should_not be_true\r
       r.include?(@gp).should_not be_true\r
-      r.include?(@pc).should_not be_true\r
     end\r
   end\r
   describe 'コマ部品に於いて' do\r
@@ -800,14 +779,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     context 'つつがなく終わるとき' do\r
@@ -851,25 +827,21 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     it 'リストを返している' do\r
       r = @panel.grounds\r
       r.is_a?(Array).should be_true\r
     end\r
-    it '景色素材と景色カラーと景色カラーコードを合わせている' do\r
+    it '絵地と色地を合わせている' do\r
       r = @panel.grounds\r
       r.include?(@gc).should be_true\r
       r.include?(@gp).should be_true\r
-      r.include?(@pc).should be_true\r
     end\r
     it 'コマ絵とフキダシを含んでいない' do\r
       r = @panel.grounds\r
@@ -886,14 +858,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     context 'つつがなく終わるとき' do\r
@@ -917,11 +886,10 @@ describe Panel do
       r.include?(@pp).should be_true\r
       r.include?(@sb).should be_true\r
     end\r
-    it '景色素材と景色カラーと景色カラーコードを合わせている' do\r
+    it '絵地と色地を合わせている' do\r
       r = @panel.panel_elements\r
       r.include?(@gc).should be_true\r
       r.include?(@gp).should be_true\r
-      r.include?(@pc).should be_true\r
     end\r
     it 'tでソートしている[t順にソートできる部品の方が優先順位は高い。]' do\r
       r = @panel.panel_elements\r
@@ -938,14 +906,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     context 'つつがなく終わるとき' do\r
@@ -954,7 +919,6 @@ describe Panel do
         Panel.stub(:elm_json_opt).with(@sb).and_return({})\r
         Panel.stub(:elm_json_opt).with(@gp).and_return({})\r
         Panel.stub(:elm_json_opt).with(@gc).and_return({})\r
-        Panel.stub(:elm_json_opt).with(@pc).and_return({})\r
       end\r
       it 'コマ要素のjson出力オプションにコマ絵json出力オプションを依頼している' do\r
         Panel.should_receive(:elm_json_opt).with(@pp).exactly(1)\r
@@ -964,18 +928,14 @@ describe Panel do
         Panel.should_receive(:elm_json_opt).with(@sb).exactly(1)\r
         r = @panel.elements\r
       end\r
-      it 'コマ要素のjson出力オプションに景色素材json出力オプションを依頼している' do\r
+      it 'コマ要素のjson出力オプションに絵地json出力オプションを依頼している' do\r
         Panel.should_receive(:elm_json_opt).with(@gp).exactly(1)\r
         r = @panel.elements\r
       end\r
-      it 'コマ要素のjson出力オプションに景色カラーjson出力オプションを依頼している' do\r
+      it 'コマ要素のjson出力オプションに色地json出力オプションを依頼している' do\r
         Panel.should_receive(:elm_json_opt).with(@gc).exactly(1)\r
         r = @panel.elements\r
       end\r
-      it 'コマ要素のjson出力オプションに景色カラーコードjson出力オプションを依頼している' do\r
-        Panel.should_receive(:elm_json_opt).with(@pc).exactly(1)\r
-        r = @panel.elements\r
-      end\r
     end\r
     it 'リストを返している' do\r
       r = @panel.elements\r
@@ -991,14 +951,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     context 'つつがなく終わるとき' do\r
@@ -1061,14 +1018,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p2.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
       @panel.reload\r
     end\r
     context '事前チェック' do\r
@@ -1289,14 +1243,11 @@ describe Panel do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
       )\r
       @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)\r
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)\r
       )\r
       @gp = @panel.ground_pictures.create(\r
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)\r
       )\r
-      @pc = @panel.panel_colors.create(\r
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)\r
-      )\r
     end\r
     context 'つつがなく終わるとき' do\r
       it '自身を削除する' do\r
index 6a3443a..c023a77 100644 (file)
@@ -7,7 +7,6 @@ describe Story do
     @sp = FactoryGirl.create :system_picture
     @lg = FactoryGirl.create :license_group
     @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
-    @color = FactoryGirl.create :color
     @user = FactoryGirl.create( :user_yas)
     @author = FactoryGirl.create :author, :user_id => @user.id
     @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
@@ -778,14 +777,11 @@ describe Story do
         FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)
       )
       @gc = @panel.ground_colors.create(
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :color_id => @color.id)
+        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id)
       )
       @gp = @panel.ground_pictures.create(
         FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id)
       )
-      @pc = @panel.panel_colors.create(
-        FactoryGirl.attributes_for(:panel_color, :panel_id => @panel.id, :code => 0xff0000)
-      )
       @panel.reload
       @comic = FactoryGirl.create :comic, :author_id => @author.id
       @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id, :panel_id => @panel.id