From e3ed5d83fcbd2d94ea1f1d0af6d5b6a278bb201c Mon Sep 17 00:00:00 2001 From: yasushiito Date: Mon, 20 Aug 2012 19:07:52 +0900 Subject: [PATCH] t#29312:any update --- .gitignore | 6 + .rspec | 2 +- Gemfile | 7 +- Gemfile.lock | 17 +- app/assets/javascripts/ie5.js | 78 +++++++ app/controllers/application_controller.rb | 4 +- app/controllers/artists_controller.rb | 17 +- app/controllers/colors_controller.rb | 16 ++ app/controllers/comics_controller.rb | 36 ++-- app/controllers/ground_colors_controller.rb | 17 ++ app/controllers/ground_pictures_controller.rb | 18 ++ app/controllers/original_pictures_controller.rb | 17 +- app/controllers/panel_colors_controller.rb | 18 ++ app/controllers/panels_controller.rb | 18 +- app/controllers/pictures_controller.rb | 1 + app/controllers/stories_controller.rb | 2 +- app/helpers/colors_helper.rb | 2 + app/helpers/ground_colors_helper.rb | 2 + app/helpers/ground_pictures_helper.rb | 2 + app/helpers/panel_colors_helper.rb | 2 + app/models/artist.rb | 18 +- app/models/author.rb | 45 ++++ app/models/color.rb | 61 ++++++ app/models/comic.rb | 13 +- app/models/ground_color.rb | 58 +++++ app/models/ground_picture.rb | 58 +++++ app/models/license_group.rb | 11 + app/models/original_picture.rb | 36 +++- app/models/panel.rb | 58 ++++- app/models/panel_color.rb | 57 +++++ app/models/panel_picture.rb | 1 + app/models/picture.rb | 26 ++- app/models/resource_picture.rb | 7 +- app/models/system_picture.rb | 2 +- app/views/artists/_form.html.erb | 2 - app/views/artists/list.html.erb | 2 - app/views/colors/index.html.erb | 19 ++ app/views/comics/_form.html.erb | 8 - app/views/comics/browse.html.erb | 10 - app/views/comics/list.html.erb | 4 - app/views/comics/show.html.erb | 10 - app/views/ground_colors/index.html.erb | 19 ++ app/views/ground_pictures/index.html.erb | 19 ++ app/views/home/step3.html.erb | 3 - app/views/layouts/system.html.erb | 2 +- app/views/layouts/test.html.erb | 2 + .../original_pictures/_artist_register.html.erb | 2 - app/views/original_pictures/_exist.html.erb | 4 + app/views/original_pictures/_history_list.html.erb | 6 + app/views/original_pictures/browse.html.erb | 8 +- app/views/original_pictures/history.html.erb | 2 + app/views/original_pictures/index.html.erb | 8 +- app/views/original_pictures/list.html.erb | 2 + app/views/original_pictures/show.html.erb | 12 ++ app/views/panel_colors/index.html.erb | 19 ++ app/views/pictures/_head.html.erb | 3 + app/views/pictures/_tail.html.erb | 2 + app/views/pictures/show.html.erb | 36 ++++ app/views/resource_pictures/index.html.erb | 2 +- app/views/resource_pictures/show.html.erb | 10 +- app/views/system/browse.html.erb | 5 + config/environment.rb | 6 +- config/routes.rb | 29 +++ db/colors.json | 10 + db/migrate/20120815021444_add_md5.rb | 13 ++ .../20120815043236_rm_default_ls_on_artist.rb | 9 + .../20120815045014_rm_default_size_on_comic.rb | 11 + db/migrate/20120816022713_create_colors.rb | 11 + db/migrate/20120816024744_create_ground_colors.rb | 12 ++ db/migrate/20120816024915_create_panel_colors.rb | 11 + .../20120816025308_create_ground_pictures.rb | 11 + lib/tasks/licenses.rake | 20 ++ lib/validators/resize_validator.rb | 2 +- lib/validators/reverse_validator.rb | 2 +- lib/validators/sync_vh_validator.rb | 2 +- script/gem_builder.rb | 23 ++ script/ls_helper.rb | 40 ++++ spec/cli/u/panels/create.json | 22 +- spec/controllers/colors_controller_spec.rb | 95 +++++++++ spec/controllers/comics_controller_spec.rb | 41 ++-- spec/controllers/ground_colors_controller_spec.rb | 115 ++++++++++ .../controllers/ground_pictures_controller_spec.rb | 117 ++++++++++ .../original_pictures_controller_spec.rb | 124 +++++++++-- spec/controllers/panel_colors_controller_spec.rb | 114 ++++++++++ spec/controllers/panels_controller_spec.rb | 10 +- spec/controllers/pictures_controller_spec.rb | 168 ++++++++------- spec/controllers/stories_controller_spec.rb | 140 ++++++------ spec/factories.rb | 29 ++- spec/helpers/artists_helper_spec.rb | 3 +- spec/helpers/authors_helper_spec.rb | 3 +- spec/helpers/balloons_helper_spec.rb | 3 +- spec/helpers/colors_helper_spec.rb | 16 ++ spec/helpers/comics_helper_spec.rb | 3 +- spec/helpers/ground_colors_helper_spec.rb | 16 ++ spec/helpers/ground_pictures_helper_spec.rb | 14 ++ spec/helpers/home_helper_spec.rb | 3 +- spec/helpers/license_groups_helper_spec.rb | 3 +- spec/helpers/licenses_helper_spec.rb | 3 +- .../original_picture_license_groups_helper_spec.rb | 3 +- spec/helpers/original_pictures_helper_spec.rb | 3 +- spec/helpers/panel_colors_helper_spec.rb | 16 ++ spec/helpers/panel_pictures_helper_spec.rb | 3 +- spec/helpers/panels_helper_spec.rb | 3 +- spec/helpers/pictures_helper_spec.rb | 3 +- spec/helpers/resource_pictures_helper_spec.rb | 3 +- .../speech_balloon_templates_helper_spec.rb | 3 +- spec/helpers/speech_balloons_helper_spec.rb | 3 +- spec/helpers/speeches_helper_spec.rb | 3 +- spec/helpers/system_helper_spec.rb | 3 +- spec/helpers/system_pictures_helper_spec.rb | 3 +- spec/json/color.json | 6 + spec/json/colors.json | 10 + spec/json/license_group.json | 2 +- spec/json/license_groups.json | 4 +- spec/models/admin_spec.rb | 3 +- spec/models/artist_spec.rb | 35 ++- spec/models/color_spec.rb | 224 +++++++++++++++++++ spec/models/comic_spec.rb | 61 +++--- spec/models/ground_color_spec.rb | 222 +++++++++++++++++++ spec/models/ground_picture_spec.rb | 237 +++++++++++++++++++++ spec/models/original_picture_spec.rb | 198 +++++++++++------ spec/models/panel_color_spec.rb | 217 +++++++++++++++++++ spec/models/panel_picture_spec.rb | 35 +-- spec/models/panel_spec.rb | 200 ++++++++++++----- spec/models/picture_spec.rb | 130 +++++++++++ spec/models/resource_picture_spec.rb | 38 +++- spec/models/story_spec.rb | 2 +- 127 files changed, 3350 insertions(+), 531 deletions(-) create mode 100644 app/assets/javascripts/ie5.js create mode 100644 app/controllers/colors_controller.rb create mode 100644 app/controllers/ground_colors_controller.rb create mode 100644 app/controllers/ground_pictures_controller.rb create mode 100644 app/controllers/panel_colors_controller.rb create mode 100644 app/helpers/colors_helper.rb create mode 100644 app/helpers/ground_colors_helper.rb create mode 100644 app/helpers/ground_pictures_helper.rb create mode 100644 app/helpers/panel_colors_helper.rb create mode 100644 app/models/color.rb create mode 100644 app/models/ground_color.rb create mode 100644 app/models/ground_picture.rb create mode 100644 app/models/panel_color.rb create mode 100644 app/views/colors/index.html.erb create mode 100644 app/views/ground_colors/index.html.erb create mode 100644 app/views/ground_pictures/index.html.erb create mode 100644 app/views/original_pictures/_exist.html.erb create mode 100644 app/views/original_pictures/_history_list.html.erb create mode 100644 app/views/original_pictures/history.html.erb create mode 100644 app/views/panel_colors/index.html.erb create mode 100644 app/views/pictures/_head.html.erb create mode 100644 app/views/pictures/_tail.html.erb create mode 100644 app/views/pictures/show.html.erb create mode 100644 db/colors.json create mode 100644 db/migrate/20120815021444_add_md5.rb create mode 100644 db/migrate/20120815043236_rm_default_ls_on_artist.rb create mode 100644 db/migrate/20120815045014_rm_default_size_on_comic.rb create mode 100644 db/migrate/20120816022713_create_colors.rb create mode 100644 db/migrate/20120816024744_create_ground_colors.rb create mode 100644 db/migrate/20120816024915_create_panel_colors.rb create mode 100644 db/migrate/20120816025308_create_ground_pictures.rb create mode 100644 lib/tasks/licenses.rake create mode 100644 script/gem_builder.rb create mode 100644 script/ls_helper.rb create mode 100644 spec/controllers/colors_controller_spec.rb create mode 100644 spec/controllers/ground_colors_controller_spec.rb create mode 100644 spec/controllers/ground_pictures_controller_spec.rb create mode 100644 spec/controllers/panel_colors_controller_spec.rb create mode 100644 spec/helpers/colors_helper_spec.rb create mode 100644 spec/helpers/ground_colors_helper_spec.rb create mode 100644 spec/helpers/ground_pictures_helper_spec.rb create mode 100644 spec/helpers/panel_colors_helper_spec.rb create mode 100644 spec/json/color.json create mode 100644 spec/json/colors.json create mode 100644 spec/models/color_spec.rb create mode 100644 spec/models/ground_color_spec.rb create mode 100644 spec/models/ground_picture_spec.rb create mode 100644 spec/models/panel_color_spec.rb diff --git a/.gitignore b/.gitignore index 012febfd..7d019e64 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,9 @@ config/picture_io.yml config/license.yml config/test_layout lib/test/temp/ +db/migrate/*_creative_commons_v??_licenses_attributes.rb +db/migrate/*_pettan_commons_v??_licenses_attributes.rb +db/migrate/*_pettan_protected_v??_licenses_attributes.rb +db/migrate/*_pettan_public_v??_licenses_attributes.rb +db/migrate/*_public_domain_v??_licenses_attributes.rb +db/migrate/*_unknown_v??_licenses_attributes.rb diff --git a/.rspec b/.rspec index 53607ea5..38dcdb57 100644 --- a/.rspec +++ b/.rspec @@ -1 +1 @@ ---colour +--no-colour diff --git a/Gemfile b/Gemfile index b44c1f7a..258ae6df 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,12 @@ gem 'aws-s3' gem 'validates_existence' gem "validate_url" gem "standard_licenses" -gem "creative_commons_v30_licenses", '>= 0.0.4' +gem "creative_commons_v30_licenses" +gem 'pettan_commons_v01_licenses' +gem 'pettan_protected_v01_licenses' +gem 'pettan_public_v01_licenses' +gem 'public_domain_v01_licenses' +gem 'unknown_v01_licenses' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' diff --git a/Gemfile.lock b/Gemfile.lock index 5158c6c7..34911c79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,8 +99,16 @@ GEM multi_json (1.3.6) nokogiri (1.5.5-x86-mingw32) orm_adapter (0.0.7) + pettan_commons_v01_licenses (0.0.5) + rails (~> 3.1.1) + pettan_protected_v01_licenses (0.0.5) + rails (~> 3.1.1) + pettan_public_v01_licenses (0.0.5) + rails (~> 3.1.1) pg (0.14.0-x86-mingw32) polyglot (0.3.3) + public_domain_v01_licenses (0.0.5) + rails (~> 3.1.1) rack (1.3.6) rack-cache (1.2) rack (>= 0.4) @@ -177,6 +185,8 @@ GEM uglifier (1.2.6) execjs (>= 0.3.0) multi_json (~> 1.3) + unknown_v01_licenses (0.0.5) + rails (~> 3.1.1) validate_url (0.2.0) activemodel (>= 3.0.0) validates_existence (0.7.1) @@ -197,7 +207,7 @@ DEPENDENCIES autotest aws-s3 coffee-rails (~> 3.1.1) - creative_commons_v30_licenses (>= 0.0.4) + creative_commons_v30_licenses cucumber cucumber-rails database_cleaner @@ -205,7 +215,11 @@ DEPENDENCIES factory_girl jquery-rails moro-miso + pettan_commons_v01_licenses + pettan_protected_v01_licenses + pettan_public_v01_licenses pg + public_domain_v01_licenses rails (= 3.1.1) rails-erd rmagick @@ -216,6 +230,7 @@ DEPENDENCIES standard_licenses therubyracer-heroku uglifier (>= 1.0.3) + unknown_v01_licenses validate_url validates_existence webrat diff --git a/app/assets/javascripts/ie5.js b/app/assets/javascripts/ie5.js new file mode 100644 index 00000000..c404f21a --- /dev/null +++ b/app/assets/javascripts/ie5.js @@ -0,0 +1,78 @@ +/** + * http://d.hatena.ne.jp/ofk/20080904/1220485969 + * @author ofk + */ + +Function.prototype.apply || (Function.prototype.apply = function (x, y) { + x = x || window; + y = y ||[]; + x.__apply = this; + if (!x.__apply) x.constructor.prototype.__apply = this; + var r, j = y.length; + switch (j) { + case 0: r = x.__apply(); break; + case 1: r = x.__apply(y[0]); break; + case 2: r = x.__apply(y[0], y[1]); break; + case 3: r = x.__apply(y[0], y[1], y[2]); break; + case 4: r = x.__apply(y[0], y[1], y[2], y[3]); break; + case 5: r = x.__apply(y[0], y[1], y[2], y[3], y[4]); break; + case 6: r = x.__apply(y[0], y[1], y[2], y[3], y[4], y[5]); break; + case 7: r = x.__apply(y[0], y[1], y[2], y[3], y[4], y[5], y[6]); break; + case 8: r = x.__apply(y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); break; + case 9: r = x.__apply(y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], y[8]); break; + default: + var a = []; + for (var i = 0; i < j; ++i) + a[i] = 'y[' + i + ']'; + r = eval('x.__apply(' + a.join(',') + ')'); + break; + } + delete x.__apply ? x.__apply : x.constructor.prototype.__apply; + return r; +}); +Function.prototype.call || (Function.prototype.call = function () { + var a = arguments, x = a[0], y = []; + for (var i = 1, j = a.length; i < j; ++i) + y[i - 1] = a[i] + return this.apply(x, y); +}); +Array.prototype.pop || (Array.prototype.pop = function () { + var r = this[this.length - 1]; + --this.length; + return r; +}); +Array.prototype.push || (Array.prototype.push = function () { + for (var a = arguments, i = 0, j = a.length, l = this.length; i < j; ++i) + this[l + i] = a[i]; + return this.length; +}); +Array.prototype.shift || (Array.prototype.shift = function () { + var r = this[0]; + for(var i = 1, j = this.length; i < j; ++i) + this[i - 1] = this[i]; + --this.length; + return r; +}); +Array.prototype.unshift || (Array.prototype.unshift = function () { + var a = arguments, l = a.length, j = this.length += l - 1; + for (var i = j; i >= l; --i) + this[i] = this[i - l]; + for (var i = 0; i < l; ++i) + this[i] = a[i]; + return j; +}); +Array.prototype.splice || (Array.prototype.splice = function (x, y) { + var a = arguments, s = a.length - 2 - y, r = this.slice(x, x + y); + if (s > 0) { + for (var i = this.length - 1, j = x + y; i >= j; --i) + this[i + s] = this[i]; + } + else if (s < 0) { + for (var i = x + y, j = this.length; i < j; ++i) + this[i + s] = this[i]; + this.length += s; + } + for (var i = 2, j = a.length; i < j; ++i) + this[i - 2 + x] = a[i]; + return r; +}); diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f108ef90..125b159b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base @artist = if @author and @author.artist? @author.artist else - Artist.new author_id: @author.id, email: @user.email, name: @author.name, default_license_id: 1 + Artist.new author_id: @author.id, email: @user.email, name: @author.name end end end @@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base true else respond_to do |format| - format.html { redirect_to new_artist_path, :status => :found } + format.html { redirect_to main_app.new_artist_path, :status => :found } format.js { render "artists/new" } format.json { raise ActiveRecord::Forbidden diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index ae96dd99..dec44edd 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -56,6 +56,7 @@ layout 'test' # GET /artists/new.json def new @artist = Artist.new + @artist.supply_default respond_to do |format| format.html # new.html.erb @@ -66,14 +67,16 @@ layout 'test' # GET /artists/1/edit def edit - @artist = Artist.find(params[:id]) + @artist = Artist.edit(params[:id], @author) end # POST /artists # POST /artists.json def create - @artist = Artist.new(params[:artist]) - @artist.author_id = @author.id + @artist = Artist.new() + @artist.supply_default + @artist.attributes = params[:artist] + @artist.overwrite @author respond_to do |format| if @artist.save format.html { redirect_to @artist, notice: 'Artist was successfully created.' } @@ -88,10 +91,12 @@ layout 'test' # PUT /artists/1 # PUT /artists/1.json def update - @artist = Artist.find(params[:id]) + @artist = Artist.edit(params[:id], @author) + @artist.attributes = params[:artist] + @artist.overwrite @author respond_to do |format| - if @artist.update_attributes(params[:artist]) + if @artist.save format.html { redirect_to @artist, notice: 'Artist was successfully updated.' } format.json { head :ok } else @@ -104,7 +109,7 @@ layout 'test' # DELETE /artists/1 # DELETE /artists/1.json def destroy - @artist = Artist.find(params[:id]) + @artist = Artist.edit(params[:id], @author) @artist.destroy respond_to do |format| diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rb new file mode 100644 index 00000000..9a936ffb --- /dev/null +++ b/app/controllers/colors_controller.rb @@ -0,0 +1,16 @@ +class ColorsController < ApplicationController + layout 'test' if Pettanr::TestLayout + + # GET /colors + # GET /colors.json + def index + @page = PanelColor.page params[:page] + @page_size = PanelColor.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 +end diff --git a/app/controllers/comics_controller.rb b/app/controllers/comics_controller.rb index ae1459d1..4444e834 100644 --- a/app/controllers/comics_controller.rb +++ b/app/controllers/comics_controller.rb @@ -7,14 +7,6 @@ class ComicsController < ApplicationController end before_filter :authenticate_admin!, :only => [:list, :browse] - private - - def treat_param comic - comic.author_id = @author.id - end - - public - def top @new_comics = Comic.find(:all, :include => :author, :conditions => ['visible > 0'], :order => 'updated_at desc', :limit => 5 @@ -88,7 +80,7 @@ class ComicsController < ApplicationController # GET /comics/1/edit # GET /comics/1.js/edit def edit - @comic = Comic.show(params[:id], @author) + @comic = Comic.edit(params[:id], @author) @comic.supply_default respond_to do |format| format.html @@ -100,8 +92,10 @@ class ComicsController < ApplicationController # POST /comics.json def create params[:comic].merge! author_id: @author.id - @comic = Comic.new params[:comic] + @comic = Comic.new @comic.supply_default + @comic.attributes = params[:comic] + @comic.overwrite @author respond_to do |format| if @comic.save @@ -117,10 +111,11 @@ class ComicsController < ApplicationController # PUT /comics/1 # PUT /comics/1.json def update - params[:comic].merge! author_id: @author.id - @comic = Comic.show(params[:id], @author) + @comic = Comic.edit(params[:id], @author) + @comic.attributes = params[:comic] + @comic.overwrite @author respond_to do |format| - if @comic.update_attributes(params[:comic]) + if @comic.save format.html { redirect_to @comic, notice: 'Comic was successfully updated.' } format.json { head :ok } else @@ -133,16 +128,11 @@ class ComicsController < ApplicationController # DELETE /comics/1 # DELETE /comics/1.json def destroy - @comic = Comic.find(params[:id]) - if @comic.own? @author - @comic.destroy - respond_to do |format| - format.html { redirect_to comics_url } - format.json { head :ok } - end - else - format.html { render action: "edit" } - format.json { render json: @comic.errors, status: :unprocessable_entity } + @comic = Comic.edit(params[:id], @author) + @comic.destroy + respond_to do |format| + format.html { redirect_to comics_url } + format.json { head :ok } end end end diff --git a/app/controllers/ground_colors_controller.rb b/app/controllers/ground_colors_controller.rb new file mode 100644 index 00000000..db1f252a --- /dev/null +++ b/app/controllers/ground_colors_controller.rb @@ -0,0 +1,17 @@ +class GroundColorsController < ApplicationController + layout 'test' if Pettanr::TestLayout + before_filter :authenticate_user!, :only => [:index] + + # GET /ground_colors + # GET /ground_colors.json + def index + @page = GroundColor.page params[:page] + @page_size = GroundColor.page_size params[:page_size] + @ground_colors = GroundColor.list({}, @page, @page_size) + + respond_to do |format| + format.html # index.html.erb + format.json { render :json => @ground_colors.to_json(GroundColor.list_json_opt) } + end + end +end diff --git a/app/controllers/ground_pictures_controller.rb b/app/controllers/ground_pictures_controller.rb new file mode 100644 index 00000000..28de1711 --- /dev/null +++ b/app/controllers/ground_pictures_controller.rb @@ -0,0 +1,18 @@ +class GroundPicturesController < ApplicationController + layout 'test' if Pettanr::TestLayout + before_filter :authenticate_user!, :only => [:index] + + # GET /ground_pictures + # GET /ground_pictures.json + def index + @page = GroundPicture.page params[:page] + @page_size = GroundPicture.page_size params[:page_size] + @ground_pictures = GroundPicture.list({}, @page, @page_size) + + respond_to do |format| + format.html # index.html.erb + format.json { render :json => @ground_pictures.to_json(GroundPicture.list_json_opt) } + end + end + +end diff --git a/app/controllers/original_pictures_controller.rb b/app/controllers/original_pictures_controller.rb index c211d867..eaa3a847 100644 --- a/app/controllers/original_pictures_controller.rb +++ b/app/controllers/original_pictures_controller.rb @@ -1,9 +1,9 @@ #原画 class OriginalPicturesController < ApplicationController layout 'test' if Pettanr::TestLayout - before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy] + before_filter :authenticate_user!, :only => [:index, :show, :history, :new, :edit, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] - before_filter :authenticate_artist, :only => [:index, :show, :new, :edit, :create, :update, :destroy] + before_filter :authenticate_artist, :only => [:index, :show, :history, :new, :edit, :create, :update, :destroy] private @@ -49,6 +49,16 @@ class OriginalPicturesController < ApplicationController end end + def history + @original_picture = OriginalPicture.show(params[:id], @artist) + @history = @original_picture.history + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @history.to_json } + end + end + def list @original_pictures = OriginalPicture.all @@ -91,7 +101,7 @@ class OriginalPicturesController < ApplicationController # GET /original_pictures/1/edit def edit - @original_picture = OriginalPicture.show(params[:id], @author) + @original_picture = OriginalPicture.edit(params[:id], @author) respond_to do |format| format.html format.js @@ -121,7 +131,6 @@ class OriginalPicturesController < ApplicationController def update @picture_data = set_image params[:original_picture][:file] @original_picture = OriginalPicture.edit(params[:id], @author) - @original_picture.supply_default @artist respond_to do |format| if @original_picture.store(@picture_data, @artist) diff --git a/app/controllers/panel_colors_controller.rb b/app/controllers/panel_colors_controller.rb new file mode 100644 index 00000000..c701e771 --- /dev/null +++ b/app/controllers/panel_colors_controller.rb @@ -0,0 +1,18 @@ +class PanelColorsController < ApplicationController + layout 'test' if Pettanr::TestLayout + before_filter :authenticate_user!, :only => [:index] + + # 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 + +end diff --git a/app/controllers/panels_controller.rb b/app/controllers/panels_controller.rb index abae3f71..29390ce4 100644 --- a/app/controllers/panels_controller.rb +++ b/app/controllers/panels_controller.rb @@ -68,7 +68,7 @@ class PanelsController < ApplicationController end def edit - @panel = Panel.show(params[:id], @author) + @panel = Panel.edit(params[:id], @author) respond_to do |format| format.html format.js @@ -131,20 +131,4 @@ class PanelsController < ApplicationController end end - def move - @panel = Panel.find(params[:id]) - @new_seq = params[:panel][:t].to_i - respond_to do |format| - Panel.transaction do - if @panel.move_to(@new_t) - format.html { redirect_to @panel, notice: 'Panel was successfully moved.' } - format.json { head :ok } - else - format.html { render action: "show" } - format.json { render json: @panel.errors, status: :unprocessable_entity } - end - end - end - end - end diff --git a/app/controllers/pictures_controller.rb b/app/controllers/pictures_controller.rb index 4661dbfd..4ebe33a3 100644 --- a/app/controllers/pictures_controller.rb +++ b/app/controllers/pictures_controller.rb @@ -10,6 +10,7 @@ class PicturesController < ApplicationController format.png { send_data(@picture.restore(params[:subdir]), opt ) } format.gif { send_data(@picture.restore(params[:subdir]), opt ) } format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) } + format.html format.json { render :json => @picture.to_json} end end diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index f2ee0825..4f41dc16 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -58,7 +58,7 @@ class StoriesController < ApplicationController # GET /stories/1/edit # GET /stories/1.js/edit def edit - @story = Story.show(params[:id], @author) + @story = Story.edit(params[:id], @author) respond_to do |format| format.html format.js diff --git a/app/helpers/colors_helper.rb b/app/helpers/colors_helper.rb new file mode 100644 index 00000000..f74a8a76 --- /dev/null +++ b/app/helpers/colors_helper.rb @@ -0,0 +1,2 @@ +module ColorsHelper +end diff --git a/app/helpers/ground_colors_helper.rb b/app/helpers/ground_colors_helper.rb new file mode 100644 index 00000000..99eb4ee6 --- /dev/null +++ b/app/helpers/ground_colors_helper.rb @@ -0,0 +1,2 @@ +module GroundColorsHelper +end diff --git a/app/helpers/ground_pictures_helper.rb b/app/helpers/ground_pictures_helper.rb new file mode 100644 index 00000000..76df63c5 --- /dev/null +++ b/app/helpers/ground_pictures_helper.rb @@ -0,0 +1,2 @@ +module GroundPicturesHelper +end diff --git a/app/helpers/panel_colors_helper.rb b/app/helpers/panel_colors_helper.rb new file mode 100644 index 00000000..f554e630 --- /dev/null +++ b/app/helpers/panel_colors_helper.rb @@ -0,0 +1,2 @@ +module PanelColorsHelper +end diff --git a/app/models/artist.rb b/app/models/artist.rb index db85188d..093983a0 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -4,11 +4,27 @@ class Artist < ActiveRecord::Base validates :name, :presence => true, :length => {:maximum => 30} # validates :default_license_id, :presence => true, :numericality => true, :existence => true - + def supply_default self.name = 'no name' if self.name.blank? end + def overwrite au + return false unless au + self.author_id = au.id + end + + def own? author + return false unless author + self.author_id == author.id + end + + def self.edit sid, au + res = Artist.find sid + raise ActiveRecord::Forbidden unless res.own?(au) + res + end + def self.find_by_author author Artist.find( :first, :conditions => ['author_id = ?', author.id]) end diff --git a/app/models/author.rb b/app/models/author.rb index 980da84e..a6db5c2f 100644 --- a/app/models/author.rb +++ b/app/models/author.rb @@ -112,6 +112,51 @@ class Author < ActiveRecord::Base page_size end + def self.default_ground_picture_page_size + 30 + end + + def self.ground_picture_max_page_size + 200 + end + + def self.ground_picture_page_size prm = self.default_ground_picture_page_size + page_size = prm.to_i + page_size = self.ground_picture_max_page_size if page_size > self.ground_picture_max_page_size + page_size = self.default_ground_picture_page_size if page_size < 1 + page_size + end + + def self.default_ground_color_page_size + 30 + end + + def self.ground_color_max_page_size + 200 + end + + def self.ground_color_page_size prm = self.default_ground_color_page_size + page_size = prm.to_i + page_size = self.ground_color_max_page_size if page_size > self.ground_color_max_page_size + page_size = self.default_ground_color_page_size if page_size < 1 + page_size + end + + def self.default_panel_color_page_size + 30 + end + + def self.panel_color_max_page_size + 200 + end + + def self.panel_color_page_size prm = self.default_panel_color_page_size + page_size = prm.to_i + page_size = self.panel_color_max_page_size if page_size > self.panel_color_max_page_size + page_size = self.default_panel_color_page_size if page_size < 1 + page_size + end + def self.show aid, opt = {} a = Author.find(aid, :include => self.show_include_opt(opt)) # raise ActiveRecord::Forbidden unless c.visible?(au) diff --git a/app/models/color.rb b/app/models/color.rb new file mode 100644 index 00000000..d09ae2c2 --- /dev/null +++ b/app/models/color.rb @@ -0,0 +1,61 @@ +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} + + 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 + + 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 opt = {}, page = 1, page_size = self.default_page_size + opt.merge!({:order => 'colors.t', :limit => page_size, :offset => (page -1) * page_size}) + Color.find(:all, opt) + end + + def self.list_opt + {:include => {:ground_color => {:panel => {:author => {}}} }} + end + + def self.list_json_opt + {:include => {:ground_color => {:panel => {:author => {}}} }} + end + + def self.show cid + c = Color.find(cid) + c + end + +end diff --git a/app/models/comic.rb b/app/models/comic.rb index 13ef9c76..6a1e92b8 100644 --- a/app/models/comic.rb +++ b/app/models/comic.rb @@ -4,8 +4,6 @@ class Comic < ActiveRecord::Base belongs_to :author validates :title, :presence => true, :length => {:maximum => 100} - validates :width, :presence => true, :numericality => true, :natural_number => true - validates :height, :presence => true, :numericality => true, :natural_number => true validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..3} before_save do |r| @@ -16,6 +14,11 @@ class Comic < ActiveRecord::Base self.visible = 0 if self.visible.blank? end + def overwrite au + return false unless au + self.author_id = au.id + end + def own? author return false unless author self.author_id == author.id @@ -84,6 +87,12 @@ class Comic < ActiveRecord::Base c end + def self.edit cid, au, opt = {} + c = Comic.find(cid, :include => self.show_include_opt(opt)) + raise ActiveRecord::Forbidden unless c.own?(au) + c + end + def self.show_include_opt opt = {} res = {:stories => {:panel => {}}, :author => {}} res.push(opt[:include]) if opt[:include] diff --git a/app/models/ground_color.rb b/app/models/ground_color.rb new file mode 100644 index 00000000..c8af47ed --- /dev/null +++ b/app/models/ground_color.rb @@ -0,0 +1,58 @@ +class GroundColor < ActiveRecord::Base + belongs_to :panel + belongs_to :color + + validates :panel_id, :numericality => {:allow_blank => true} + validates :color_id, :numericality => true, :existence => true + validates :z, :presence => true, :numericality => {:greater_than => 0} + + 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.offset cnt, prm = nil + offset = prm.to_i + offset = cnt - 1 if offset >= cnt + offset = cnt - offset.abs if offset < 0 + offset = 0 if offset < 0 + offset + end + + def self.list opt = {}, page = 1, page_size = self.default_page_size + opt.merge!(self.list_opt) unless opt[:include] + opt.merge!({:conditions => 'panels.publish > 0', :order => 'ground_colors.updated_at desc', :limit => page_size, :offset => (page -1) * page_size}) + GroundColor.find(:all, opt) + end + + def self.list_opt + {:include => {:panel => {:author => {}}, :color => {} }} + end + + def self.list_json_opt + {:include => {:panel => {:author => {}}, :color => {} }} + end + + def self.mylist au, opt = {}, page = 1, ground_color_page_size = Author.default_ground_color_page_size + opt.merge!(self.list_opt) unless opt[:include] + opt.merge!({:conditions => ['panels.author_id = ?', au.id], :order => 'ground_colors.updated_at desc', :limit => page_size, :offset => (page -1) * ground_color_page_size}) + GroundColor.find(:all, opt) + end + +end diff --git a/app/models/ground_picture.rb b/app/models/ground_picture.rb new file mode 100644 index 00000000..207b2083 --- /dev/null +++ b/app/models/ground_picture.rb @@ -0,0 +1,58 @@ +class GroundPicture < ActiveRecord::Base + belongs_to :panel + belongs_to :picture + + validates :panel_id, :numericality => {:allow_blank => true} + validates :picture_id, :numericality => true, :existence => true + validates :z, :presence => true, :numericality => {:greater_than => 0} + + 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.offset cnt, prm = nil + offset = prm.to_i + offset = cnt - 1 if offset >= cnt + offset = cnt - offset.abs if offset < 0 + offset = 0 if offset < 0 + offset + end + + def self.list opt = {}, page = 1, page_size = self.default_page_size + opt.merge!(self.list_opt) unless opt[:include] + opt.merge!({:conditions => 'panels.publish > 0', :order => 'ground_pictures.updated_at desc', :limit => page_size, :offset => (page -1) * page_size}) + GroundPicture.find(:all, opt) + end + + def self.list_opt + {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}} + end + + def self.list_json_opt + {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}} + end + + def self.mylist au, opt = {}, page = 1, ground_picture_page_size = Author.default_ground_picture_page_size + opt.merge!(self.list_opt) unless opt[:include] + opt.merge!({:conditions => ['panels.author_id = ?', au.id], :order => 'ground_pictures.updated_at desc', :limit => page_size, :offset => (page -1) * ground_picture_page_size}) + GroundPicture.find(:all, opt) + end + +end diff --git a/app/models/license_group.rb b/app/models/license_group.rb index fa67c7b8..7d7f13df 100644 --- a/app/models/license_group.rb +++ b/app/models/license_group.rb @@ -55,4 +55,15 @@ class LicenseGroup < ActiveRecord::Base {:include => {:licenses => {}}} end + def self.disp_import_error r + if r == false + puts "json file error. file does not exist or broken" + else + unless r.empty? + r.each do |lg| + put lg.errors.full_messages + end + end + end + end end diff --git a/app/models/original_picture.rb b/app/models/original_picture.rb index a2606bf4..497fa646 100644 --- a/app/models/original_picture.rb +++ b/app/models/original_picture.rb @@ -2,18 +2,25 @@ class OriginalPicture < ActiveRecord::Base belongs_to :artist belongs_to :original_picture_license_group has_one :resource_picture + has_many :pictures - validates :ext, :presence => true, :length => {:maximum => 4}, :inclusion => {:in => ['png', 'jpeg', 'gif']} + validates :ext, :presence => true, :length => {:maximum => 4}, :inclusion => {:in => ['png', 'jpeg', 'gif']} validates :width, :presence => true, :numericality => true, :natural_number => true validates :height, :presence => true, :numericality => true, :natural_number => true validates :filesize, :presence => true, :numericality => {:greater_than => 0, :less_than_or_equal_to => 2000000}, :natural_number => true validates :artist_id, :presence => true, :numericality => true, :existence => true + validates :md5, :presence => true, :length => {:maximum => 32} before_destroy :destroy_with_file def supply_default art end + def overwrite art + return false unless art + self.artist_id = art.id + end + def self.default_page_size 25 end @@ -43,34 +50,36 @@ class OriginalPicture < ActiveRecord::Base OriginalPicture.find(:all, opt) end + def history + Picture.find(:all, {:conditions => ['pictures.original_picture_id = ?', self.id], :order => 'pictures.revision desc'} ) + end + def self.list_opt - {:include => {:resource_picture => {}}} + {:include => {:resource_picture => {}, :pictures => {}}} end def self.list_json_opt - {:include => {:resource_picture => {}}} + {:include => {:resource_picture => {}, :pictures => {}}} end def self.show cid, artist, opt = {} - pic = OriginalPicture.find(cid, :include => self.show_include_opt(opt)) + pic = OriginalPicture.find(cid, self.show_include_opt) raise ActiveRecord::Forbidden unless pic.own?(artist) pic end def self.edit cid, artist, opt = {} - pic = OriginalPicture.find(cid, :include => self.show_include_opt(opt)) + pic = OriginalPicture.find(cid, self.show_include_opt) raise ActiveRecord::Forbidden unless pic.own?(artist) pic end - def self.show_include_opt opt = {} - res = {:resource_picture => {}} - res.merge!(opt[:include]) if opt[:include] - res + def self.show_include_opt + {:include => {:resource_picture => {}, :pictures => {}}} end def self.show_json_include_opt - {:include => {:resource_picture => {}}} + {:include => {:resource_picture => {}, :pictures => {}}} end def destroy_with_file @@ -94,6 +103,11 @@ class OriginalPicture < ActiveRecord::Base '/original_pictures/' + filename end + def opt_img_tag + tw, th = ResourcePicture.fix_size_both(MagicNumber['thumbnail_width'], MagicNumber['thumbnail_height'], self.width, self.height) + {:src => self.url, :width => tw, :height => th} + end + def data_to_mgk picture_data begin mgk = Magick::Image.from_blob(picture_data).shift @@ -111,6 +125,8 @@ class OriginalPicture < ActiveRecord::Base self.attributes = {:ext => mgk.format.downcase, :width => mgk.columns, :height => mgk.rows, :filesize => mgk.filesize, :artist_id => art.id } + self.md5 = Digest::MD5.hexdigest(picture_data) + self.overwrite art OriginalPicture.transaction do if res = self.save if res = PictureIO.original_picture_io.put(picture_data, self.filename) diff --git a/app/models/panel.rb b/app/models/panel.rb index 4328e91d..db740ffa 100644 --- a/app/models/panel.rb +++ b/app/models/panel.rb @@ -2,12 +2,17 @@ class Panel < ActiveRecord::Base belongs_to :author belongs_to :resource_picture -# belongs_to :background_picture, :class_name => 'ResourcePicture' has_many :stories has_many :panel_pictures, :dependent => :destroy 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 @@ -144,6 +149,14 @@ class Panel < ActiveRecord::Base :picture => {:artist => {}, :license => {}} }, :speech_balloons => {:balloons => {}, :speeches => {}}, + :ground_pictures => { + :picture => {:artist => {}, :license => {}} + }, + :ground_colors => { + :color => {} + }, + :panel_colors => { + }, :author => {} }} end @@ -154,6 +167,14 @@ class Panel < ActiveRecord::Base :picture => {:artist => {}, :license => {}} }, :speech_balloons => {:balloons => {}, :speeches => {}}, + :ground_pictures => { + :picture => {:artist => {}, :license => {}} + }, + :ground_colors => { + :color => {} + }, + :panel_colors => { + }, :author => {} }} end @@ -182,6 +203,14 @@ class Panel < ActiveRecord::Base :picture => {:artist => {}, :license => {}} }, :speech_balloons => {:balloons => {}, :speeches => {}}, + :ground_pictures => { + :picture => {:artist => {}, :license => {}} + }, + :ground_colors => { + :color => {} + }, + :panel_colors => { + }, :author => {} } res.merge!(opt[:include]) if opt[:include] @@ -194,6 +223,14 @@ class Panel < ActiveRecord::Base :picture => {:artist => {}, :license => {}} }, :speech_balloons => {:balloons => {}, :speeches => {}}, + :ground_pictures => { + :picture => {:artist => {}, :license => {}} + }, + :ground_colors => { + :color => {} + }, + :panel_colors => { + }, :author => {} }} end @@ -227,6 +264,12 @@ class Panel < ActiveRecord::Base pe end + def each_ground + (self.ground_colors || []) + (self.ground_pictures || []) + (self.panel_colors || []).each do |e| + yield e + end + end + def each_element self.sort_by_time.each do |e| yield e @@ -237,12 +280,23 @@ class Panel < ActiveRecord::Base res = [] self.each_element do |elm| if elm.kind_of?(PanelPicture) - res[elm.t] = elm.to_json({:include => :resource_picture}) + res[elm.t] = elm.to_json({:include => {:picture => {:artist => {}, :license => {}}}}) end if elm.kind_of?(SpeechBalloon) res[elm.t] = elm.to_json({:include => {:balloons => {}, :speeches => {}}}) end end + self.each_ground do |elm| + if elm.kind_of?(GroundColor) + res << elm.to_json({:include => :color}) + end + if elm.kind_of?(GroundPicture) + res << elm.to_json({:include => {:picture => {:artist => {}, :license => {}}}}) + end + if elm.kind_of?(PanelColor) + res << elm.to_json({:include => {}}) + end + end res end diff --git a/app/models/panel_color.rb b/app/models/panel_color.rb new file mode 100644 index 00000000..820a541f --- /dev/null +++ b/app/models/panel_color.rb @@ -0,0 +1,57 @@ +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 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.offset cnt, prm = nil + offset = prm.to_i + offset = cnt - 1 if offset >= cnt + offset = cnt - offset.abs if offset < 0 + offset = 0 if offset < 0 + offset + end + + def self.list opt = {}, page = 1, page_size = self.default_page_size + opt.merge!(self.list_opt) unless opt[:include] + opt.merge!({:conditions => 'panels.publish > 0', :order => 'panel_colors.updated_at desc', :limit => page_size, :offset => (page -1) * page_size}) + PanelColor.find(:all, opt) + end + + def self.list_opt + {:include => {:panel => {:author => {}} }} + end + + def self.list_json_opt + {:include => {:panel => {:author => {}} }} + end + + def self.mylist au, opt = {}, page = 1, panel_color_page_size = Author.default_panel_color_page_size + opt.merge!(self.list_opt) unless opt[:include] + opt.merge!({:conditions => ['panels.author_id = ?', au.id], :order => 'panel_colors.updated_at desc', :limit => page_size, :offset => (page -1) * panel_color_page_size}) + PanelColor.find(:all, opt) + end + +end diff --git a/app/models/panel_picture.rb b/app/models/panel_picture.rb index a26e0a2f..afbe97f1 100644 --- a/app/models/panel_picture.rb +++ b/app/models/panel_picture.rb @@ -3,6 +3,7 @@ class PanelPicture < ActiveRecord::Base belongs_to :picture validates :panel_id, :numericality => {:allow_blank => true} + validates :picture_id, :numericality => true, :existence => true validates :link, :length => {:maximum => 200} validates :x, :presence => true, :numericality => true validates :y, :presence => true, :numericality => true diff --git a/app/models/picture.rb b/app/models/picture.rb index 1c1ff83b..38305a19 100644 --- a/app/models/picture.rb +++ b/app/models/picture.rb @@ -11,6 +11,7 @@ class Picture < ActiveRecord::Base validates :width, :presence => true, :numericality => true, :natural_number => true validates :height, :presence => true, :numericality => true, :natural_number => true validates :filesize, :presence => true, :numericality => {:greater_than => 0, :less_than_or_equal_to => 2000000}, :natural_number => true + validates :md5, :presence => true, :length => {:maximum => 32} validates :license_id, :presence => true, :numericality => true, :existence => true validates :artist_id, :presence => true, :numericality => true, :existence => true validates :artist_name, :presence => true @@ -32,6 +33,27 @@ class Picture < ActiveRecord::Base "image/#{self.dext}" end + def dext + self.ext.downcase + end + + def url + '/pictures/' + filename + end + + def self.list_by_md5 md5, opid + r = Picture.find :all, :conditions => ['pictures.md5 = ? and pictures.original_picture_id <> ?', md5, opid], :order => 'pictures.updated_at desc' + end + + def self.exist_by_md5 md5, opid + Picture.list_by_md5(md5, opid).empty? ? false : true + end + + def head? + r = self.resource_picture + r ? true : false + end + def new_revision Picture.maximum(:revision, :conditions => ['original_picture_id = ?', self.original_picture_id]).to_i + 1 end @@ -71,7 +93,7 @@ class Picture < ActiveRecord::Base def copy_data(rp) attr = {:width => rp.width, :height => rp.height, :ext => rp.ext, :filesize => rp.filesize, :original_picture_id => rp.original_picture_id, :license_id => rp.license_id, :artist_id => rp.artist_id, - :artist_name => rp.artist_name, :classname => rp.classname, :credit => rp.credit, :settings => rp.settings + :md5 => rp.md5, :artist_name => rp.artist_name, :classname => rp.classname, :credit => rp.credit, :settings => rp.settings } self.attributes = attr end @@ -104,7 +126,7 @@ class Picture < ActiveRecord::Base end def restore(subdir = nil) - PictureIO.resource_picture_io.get self.filename, subdir + PictureIO.picture_io.get self.filename, subdir end def self.show pid diff --git a/app/models/resource_picture.rb b/app/models/resource_picture.rb index 5e1b4f75..9c1514f3 100644 --- a/app/models/resource_picture.rb +++ b/app/models/resource_picture.rb @@ -78,9 +78,14 @@ class ResourcePicture < ActiveRecord::Base ResourcePicture.resize(rimg.to_blob, tw, th).to_blob end + def opt_img_tag + tw, th = ResourcePicture.fix_size_both(MagicNumber['thumbnail_width'], MagicNumber['thumbnail_height'], self.width, self.height) + {:src => self.url, :width => tw, :height => th} + end + def copy_data(op) attr = {:width => op.width, :height => op.height, :ext => op.ext, :filesize => op.filesize, - :original_picture_id => op.id, :artist_id => op.artist_id + :original_picture_id => op.id, :artist_id => op.artist_id, :md5 => op.md5 } self.attributes = attr end diff --git a/app/models/system_picture.rb b/app/models/system_picture.rb index a2dea479..ccfe6af2 100644 --- a/app/models/system_picture.rb +++ b/app/models/system_picture.rb @@ -48,7 +48,7 @@ class SystemPicture < ActiveRecord::Base self.attributes = {:ext => mgk.format.downcase, :width => mgk.columns, :height => mgk.rows, :filesize => mgk.filesize } - self.md5 = Digest::MD5.hexdigest(picture_data) unless self.md5 + self.md5 = Digest::MD5.hexdigest(picture_data) SystemPicture.transaction do if res = self.save res = PictureIO.system_picture_io.put(picture_data, self.filename) diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index 5a0690b6..b91ef8a8 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -18,8 +18,6 @@ <%= f.label :name %>
<%= f.text_field :name %>
- <%= f.label :default_license_id %>
- <%= f.number_field :default_license_id %>
<%= f.submit %> diff --git a/app/views/artists/list.html.erb b/app/views/artists/list.html.erb index dcb90be7..de4e1df0 100644 --- a/app/views/artists/list.html.erb +++ b/app/views/artists/list.html.erb @@ -7,7 +7,6 @@ name homepage_url api_url - default_license crowled_at author_id created_at @@ -21,7 +20,6 @@ <%= h artist.name %> <%= h artist.homepage_url %> <%= h artist.api_url %> - <%= link_to artist.default_license_id, :controller => 'licenses', :action => :browse, :id => artist.default_license_id %> <%= artist.crowled_at %> <%= link_to artist.author_id, :controller => 'authors', :action => :browse, :id => artist.author_id %> <%= artist.created_at %> diff --git a/app/views/colors/index.html.erb b/app/views/colors/index.html.erb new file mode 100644 index 00000000..907e97f7 --- /dev/null +++ b/app/views/colors/index.html.erb @@ -0,0 +1,19 @@ +

Listing Colors

+ + + + + + + + + +<% @colors.each do |c| %> + + + + + + +<% end -%> +
idnamecodet
<%= c.id %><%= h c.name %><%= c.code %>*****<%= c.t %>
diff --git a/app/views/comics/_form.html.erb b/app/views/comics/_form.html.erb index c8e1fb64..21a7d4f9 100644 --- a/app/views/comics/_form.html.erb +++ b/app/views/comics/_form.html.erb @@ -16,14 +16,6 @@ <%= f.text_field :title %>
- <%= f.label :width %>
- <%= f.number_field :width %> -
-
- <%= f.label :height %>
- <%= f.number_field :height %> -
-
<%= f.label :visible %>
<%= f.collection_select :visible, [['only me', 0], ['everyone', 3]], :last, :first, :html => {:selected => @comic.visible} %>
diff --git a/app/views/comics/browse.html.erb b/app/views/comics/browse.html.erb index c9861b96..6e781df9 100644 --- a/app/views/comics/browse.html.erb +++ b/app/views/comics/browse.html.erb @@ -6,16 +6,6 @@

- width: - <%= @comic.width %> -

- -

- height: - <%= @comic.height %> -

- -

visible: <%= @comic.visible %>

diff --git a/app/views/comics/list.html.erb b/app/views/comics/list.html.erb index 189ada4f..f7b7e62b 100644 --- a/app/views/comics/list.html.erb +++ b/app/views/comics/list.html.erb @@ -4,8 +4,6 @@ id Title - width - height visible author_id created_at @@ -17,8 +15,6 @@ <%= link_to comic.id, :action => :browse, :id => comic.id %> <%= h comic.title %> - <%= comic.width %> - <%= comic.height %> <%= comic.visible %> <%= link_to comic.author_id, :controller => '/authors', :action => :browse, :id => comic.author_id %> <%= comic.created_at %> diff --git a/app/views/comics/show.html.erb b/app/views/comics/show.html.erb index f77abc22..15154295 100644 --- a/app/views/comics/show.html.erb +++ b/app/views/comics/show.html.erb @@ -6,16 +6,6 @@

- width: - <%= @comic.width %> -

- -

- height: - <%= @comic.height %> -

- -

visible: <%= @comic.visible %>

diff --git a/app/views/ground_colors/index.html.erb b/app/views/ground_colors/index.html.erb new file mode 100644 index 00000000..fed3158d --- /dev/null +++ b/app/views/ground_colors/index.html.erb @@ -0,0 +1,19 @@ +

Listing Ground Colors

+ + + + + + + + + +<% @ground_colors.each do |gc| %> + + + + + + +<% end -%> +
idpanel_idcolor_idz
<%= gc.id %><%= link_to gc.panel_id, panel_path(gc.panel_id) %><%= link_to gc.color_id, color_path(gc.color_id) %><%= gc.z %>
diff --git a/app/views/ground_pictures/index.html.erb b/app/views/ground_pictures/index.html.erb new file mode 100644 index 00000000..32f741c6 --- /dev/null +++ b/app/views/ground_pictures/index.html.erb @@ -0,0 +1,19 @@ +

Listing Ground Pictures

+ + + + + + + + + +<% @ground_pictures.each do |gp| %> + + + + + + +<% end -%> +
idpanel_idpicture_idz
<%= gp.id %><%= link_to gp.panel_id, panel_path(gp.panel_id) %><%= link_to gp.picture_id, color_path(gp.picture_id) %><%= gp.z %>
diff --git a/app/views/home/step3.html.erb b/app/views/home/step3.html.erb index 9c1941ca..bc604f0d 100644 --- a/app/views/home/step3.html.erb +++ b/app/views/home/step3.html.erb @@ -19,9 +19,6 @@ <%= f.label :name %>
<%= f.text_field :name %>
-

素材をアップロードするときのデフォルトライセンスを選択します。

- <%= f.label :default_license_id %>
- <%= f.select :default_license_id, License.all.map {|l| [l.name, l.id] }, :html => {:selected => @artist.default_license_id} %> <%= f.hidden_field :author_id, :value => @artist.author_id %>
diff --git a/app/views/layouts/system.html.erb b/app/views/layouts/system.html.erb index 9cb2930e..97ced9d8 100644 --- a/app/views/layouts/system.html.erb +++ b/app/views/layouts/system.html.erb @@ -3,7 +3,7 @@ Pettanr <%= stylesheet_link_tag "application" %> - <%# javascript_include_tag "application" %> + <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> diff --git a/app/views/layouts/test.html.erb b/app/views/layouts/test.html.erb index 0c1a06ec..ff14561c 100644 --- a/app/views/layouts/test.html.erb +++ b/app/views/layouts/test.html.erb @@ -3,6 +3,7 @@ Pettanr <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> @@ -36,6 +37,7 @@ <%= link_to 'speeches', main_app.speeches_path %> : <%= link_to 'speech_balloon_templates', main_app.speech_balloon_templates_path %> +<%= link_to 'colors', main_app.colors_path %> : <%= link_to 'artists', main_app.artists_path %> <%= link_to 'system_pictures', main_app.system_pictures_path %> diff --git a/app/views/original_pictures/_artist_register.html.erb b/app/views/original_pictures/_artist_register.html.erb index c07140c4..4fc44453 100644 --- a/app/views/original_pictures/_artist_register.html.erb +++ b/app/views/original_pictures/_artist_register.html.erb @@ -18,8 +18,6 @@ <%= f.label :name %>
<%= f.text_field :name %>
- <%= f.label :default_license_id %>
- <%= f.number_field :default_license_id %> <%= f.hidden_field :author_id, :value => @artist.author_id %>
diff --git a/app/views/original_pictures/_exist.html.erb b/app/views/original_pictures/_exist.html.erb new file mode 100644 index 00000000..8129f4fb --- /dev/null +++ b/app/views/original_pictures/_exist.html.erb @@ -0,0 +1,4 @@ +<% case exist -%> +<% when true -%> + この画像は既に公開されています +<% end -%> diff --git a/app/views/original_pictures/_history_list.html.erb b/app/views/original_pictures/_history_list.html.erb new file mode 100644 index 00000000..8fd4c22e --- /dev/null +++ b/app/views/original_pictures/_history_list.html.erb @@ -0,0 +1,6 @@ +<% history.each do |picture| -%> +

revision:<%= picture.revision %>

+
licensed at <%= picture.created_at %>
+ + <%= render picture.credit_template, :picture => picture %> +<% end -%> diff --git a/app/views/original_pictures/browse.html.erb b/app/views/original_pictures/browse.html.erb index 9142c7de..03ea4843 100644 --- a/app/views/original_pictures/browse.html.erb +++ b/app/views/original_pictures/browse.html.erb @@ -25,14 +25,16 @@ <%= @original_picture.artist_id %>

+

+ md5: + <%= @original_picture.md5 %> +

+

browse picture

-

-<%= link_to '再生成', :action => :refresh, :id => @original_picture.id %> -

<% if @original_picture.own? @author -%>

Replace picture diff --git a/app/views/original_pictures/history.html.erb b/app/views/original_pictures/history.html.erb new file mode 100644 index 00000000..4a1396ac --- /dev/null +++ b/app/views/original_pictures/history.html.erb @@ -0,0 +1,2 @@ +History of Original Picture <%= @original_picture.id %> +<%= render 'history_list', :history => @history %> diff --git a/app/views/original_pictures/index.html.erb b/app/views/original_pictures/index.html.erb index 8411ea1e..0089f094 100644 --- a/app/views/original_pictures/index.html.erb +++ b/app/views/original_pictures/index.html.erb @@ -4,22 +4,28 @@ + + + <% @original_pictures.each do |original_picture| %>
+ + + <% end %>
picturerevisions filename Width Height filesizemd5history
- <%= link_to tag(:img, :src => original_picture.url, :width => 50, :height => 50), original_picture %> + <%= link_to tag(:img, original_picture.opt_img_tag), original_picture %> <%= original_picture.pictures.empty? ? '' : original_picture.history.first.revision %> <%= original_picture.filename %> <%= original_picture.width %> <%= original_picture.height %> <%= original_picture.filesize %><%= original_picture.md5 %><%= link_to '...', :controller => 'original_pictures', :action => :history, :id => original_picture.id %>
diff --git a/app/views/original_pictures/list.html.erb b/app/views/original_pictures/list.html.erb index 0727ed19..f9a69df4 100644 --- a/app/views/original_pictures/list.html.erb +++ b/app/views/original_pictures/list.html.erb @@ -9,6 +9,7 @@ Height filesize artist + md5 created_at updated_at @@ -22,6 +23,7 @@ <%= original_picture.height %> <%= original_picture.filesize %> <%= link_to original_picture.artist_id, :controller => 'artists', :action => :browse, :id => original_picture.artist_id %> + <%= original_picture.md5 %> <%= original_picture.created_at %> <%= original_picture.updated_at %> diff --git a/app/views/original_pictures/show.html.erb b/app/views/original_pictures/show.html.erb index 5d32979c..89ce57c5 100644 --- a/app/views/original_pictures/show.html.erb +++ b/app/views/original_pictures/show.html.erb @@ -1,3 +1,4 @@ +<%= render 'exist', :exist => Picture.exist_by_md5(@original_picture.md5, @original_picture.id) %>

<%= notice %>

@@ -21,6 +22,11 @@

+ md5: + <%= @original_picture.md5 %> +

+ +

artist: <%= @original_picture.artist_id %>

@@ -45,5 +51,11 @@ Replace picture <%= f.submit 'replace' %>
<% end %> +
+

+ History +

+ <%= render 'history_list', :history => @original_picture.history %> +
<%= link_to 'Back', original_pictures_path %> diff --git a/app/views/panel_colors/index.html.erb b/app/views/panel_colors/index.html.erb new file mode 100644 index 00000000..e6a9fa21 --- /dev/null +++ b/app/views/panel_colors/index.html.erb @@ -0,0 +1,19 @@ +

Listing Panel Colors

+ + + + + + + + + +<% @panel_colors.each do |pc| %> + + + + + + +<% end -%> +
idpanel_idcodez
<%= pc.id %><%= link_to pc.panel_id, panel_path(pc.panel_id) %><%= pc.code %>*****<%= pc.z %>
diff --git a/app/views/pictures/_head.html.erb b/app/views/pictures/_head.html.erb new file mode 100644 index 00000000..ac14f8f0 --- /dev/null +++ b/app/views/pictures/_head.html.erb @@ -0,0 +1,3 @@ + +<%= render picture.credit_template, :picture => picture %> +
revision:<%= picture.revision %>
diff --git a/app/views/pictures/_tail.html.erb b/app/views/pictures/_tail.html.erb new file mode 100644 index 00000000..d080031f --- /dev/null +++ b/app/views/pictures/_tail.html.erb @@ -0,0 +1,2 @@ +この画像は既に改訂されています <%= link_to 'Head', resource_picture_path(picture.resource_picture ) %> +
revision:<%= picture.revision %>
diff --git a/app/views/pictures/show.html.erb b/app/views/pictures/show.html.erb new file mode 100644 index 00000000..952542ac --- /dev/null +++ b/app/views/pictures/show.html.erb @@ -0,0 +1,36 @@ +

+ Ext: + <%= @original_picture.ext %> +

+ +

+ Width: + <%= @original_picture.width %> +

+ +

+ Height: + <%= @original_picture.height %> +

+ +

+ filesize: + <%= @original_picture.filesize %> +

+ +

+ md5: + <%= @original_picture.md5 %> +

+ +

+ artist: + <%= @original_picture.artist_id %> +

+ +<% if @picture.head? %> + <%= render 'head', :picture => @picture %> +<% else %> + <%= render 'tail', :picture => @picture %> +<% end %> + diff --git a/app/views/resource_pictures/index.html.erb b/app/views/resource_pictures/index.html.erb index 76defae4..71e75669 100644 --- a/app/views/resource_pictures/index.html.erb +++ b/app/views/resource_pictures/index.html.erb @@ -3,7 +3,7 @@ <% @resource_picture = resource_picture %>
<%= link_to resource_picture.filename, resource_picture_path(resource_picture) %> - <%= tag :img, :src => resource_picture.url, :width => MagicNumber['thumbnail_width'], :height => MagicNumber['thumbnail_height'] %> + <%= tag :img, resource_picture.opt_img_tag %> <%= resource_picture.width %>x<%= resource_picture.height %> <%= resource_picture.filesize %>bytes <%= render resource_picture.credit_template, :picture => resource_picture %> diff --git a/app/views/resource_pictures/show.html.erb b/app/views/resource_pictures/show.html.erb index 0839b2dd..6827972a 100644 --- a/app/views/resource_pictures/show.html.erb +++ b/app/views/resource_pictures/show.html.erb @@ -1,11 +1,3 @@

<%= notice %>

-<%= render @resource_picture.credit_template, :picture => @resource_picture %> -

- ノーマル - -

-

- サムネ - -

+ <%= render 'pictures/head', :picture => @resource_picture.picture %> <%= link_to 'Back', resource_pictures_path %> diff --git a/app/views/system/browse.html.erb b/app/views/system/browse.html.erb index d8c3075f..e857e0dc 100644 --- a/app/views/system/browse.html.erb +++ b/app/views/system/browse.html.erb @@ -48,6 +48,11 @@ <%= link_to 'speeches', :controller => 'speeches', :action => :list %> + + + <%= link_to 'colors', :controller => 'colors' %> + + フキダシテンプレート関連 diff --git a/config/environment.rb b/config/environment.rb index a32bd2f8..aa0ff2ef 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,10 +1,6 @@ # Load the rails application require File.expand_path('../application', __FILE__) -begin - require 'RMagick' -rescue LoadError - require 'DMagick' -end +require 'RMagick' # Initialize the rails application Pettanr::Application.initialize! diff --git a/config/routes.rb b/config/routes.rb index bcdc2705..6a1e38c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -109,6 +109,7 @@ Pettanr::Application.routes.draw do collection do get :index get :show + get :history post :create get :list get :browse @@ -127,6 +128,34 @@ Pettanr::Application.routes.draw do post :create end end + resources :colors do + collection do + get :index + end + member do + end + end + resources :panel_colors do + collection do + get :index + end + member do + end + end + resources :ground_colors do + collection do + get :index + end + member do + end + end + resources :ground_pictures do + collection do + get :index + end + member do + end + end resources :panels do new do get :new diff --git a/db/colors.json b/db/colors.json new file mode 100644 index 00000000..fba582f0 --- /dev/null +++ b/db/colors.json @@ -0,0 +1,10 @@ +{ + "white": { + "code": 255, + "t": 0 + }, + "black": { + "code": 0, + "t": 1 + } +} diff --git a/db/migrate/20120815021444_add_md5.rb b/db/migrate/20120815021444_add_md5.rb new file mode 100644 index 00000000..51c26846 --- /dev/null +++ b/db/migrate/20120815021444_add_md5.rb @@ -0,0 +1,13 @@ +class AddMd5 < ActiveRecord::Migration + def up + add_column :original_pictures, :md5, :string, :null => false, :limit => 32, :default => '00000000000000000000000000000000' + add_column :pictures, :md5, :string, :null => false, :limit => 32, :default => '00000000000000000000000000000000' + add_column :resource_pictures, :md5, :string, :null => false, :limit => 32, :default => '00000000000000000000000000000000' + end + + def down + remove_column :original_pictures, :md5 + remove_column :pictures, :md5 + remove_column :resource_pictures, :md5 + end +end diff --git a/db/migrate/20120815043236_rm_default_ls_on_artist.rb b/db/migrate/20120815043236_rm_default_ls_on_artist.rb new file mode 100644 index 00000000..9b01e60a --- /dev/null +++ b/db/migrate/20120815043236_rm_default_ls_on_artist.rb @@ -0,0 +1,9 @@ +class RmDefaultLsOnArtist < ActiveRecord::Migration + def up + remove_column :artists, :default_license_id + end + + def down + remove_column :artists, :default_license_id, :integer , :null => false, :default => 0 + end +end diff --git a/db/migrate/20120815045014_rm_default_size_on_comic.rb b/db/migrate/20120815045014_rm_default_size_on_comic.rb new file mode 100644 index 00000000..0aca16a1 --- /dev/null +++ b/db/migrate/20120815045014_rm_default_size_on_comic.rb @@ -0,0 +1,11 @@ +class RmDefaultSizeOnComic < ActiveRecord::Migration + def up + remove_column :comics, :width + remove_column :comics, :height + end + + def down + add_column :comics, :width, :integer , :null => false, :default => 0 + add_column :comics, :height, :integer , :null => false, :default => 0 + end +end diff --git a/db/migrate/20120816022713_create_colors.rb b/db/migrate/20120816022713_create_colors.rb new file mode 100644 index 00000000..6b4a7064 --- /dev/null +++ b/db/migrate/20120816022713_create_colors.rb @@ -0,0 +1,11 @@ +class CreateColors < ActiveRecord::Migration + def change + 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 diff --git a/db/migrate/20120816024744_create_ground_colors.rb b/db/migrate/20120816024744_create_ground_colors.rb new file mode 100644 index 00000000..b6294ae9 --- /dev/null +++ b/db/migrate/20120816024744_create_ground_colors.rb @@ -0,0 +1,12 @@ +class CreateGroundColors < ActiveRecord::Migration + def change + create_table :ground_colors do |t| + t.integer :panel_id, :null => false, :default => 0 + t.integer :color_id, :null => false, :default => 0 + t.integer :author_id, :null => false, :default => 0 + t.integer :z, :null => false, :default => 0 + + t.timestamps + end + end +end diff --git a/db/migrate/20120816024915_create_panel_colors.rb b/db/migrate/20120816024915_create_panel_colors.rb new file mode 100644 index 00000000..32433c00 --- /dev/null +++ b/db/migrate/20120816024915_create_panel_colors.rb @@ -0,0 +1,11 @@ +class CreatePanelColors < ActiveRecord::Migration + def change + 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 + end +end diff --git a/db/migrate/20120816025308_create_ground_pictures.rb b/db/migrate/20120816025308_create_ground_pictures.rb new file mode 100644 index 00000000..27852f3b --- /dev/null +++ b/db/migrate/20120816025308_create_ground_pictures.rb @@ -0,0 +1,11 @@ +class CreateGroundPictures < ActiveRecord::Migration + def change + create_table :ground_pictures do |t| + t.integer :panel_id, :null => false, :default => 0 + t.integer :picture_id, :null => false, :default => 0 + t.integer :z, :null => false, :default => 0 + + t.timestamps + end + end +end diff --git a/lib/tasks/licenses.rake b/lib/tasks/licenses.rake new file mode 100644 index 00000000..8caed780 --- /dev/null +++ b/lib/tasks/licenses.rake @@ -0,0 +1,20 @@ +namespace :licenses do + desc "Import json format license data in license engine" + task :import => :environment do + licenses = YAML.load(open(Rails.root + 'config/license.yml').read) + licenses.each do |name, klass| + puts name + "\n" + system 'rake ' + name + ':import' + end + end + + desc "Copy migration file for license " + task :install => :environment do + licenses = YAML.load(open(Rails.root + 'config/license.yml').read) + licenses.each do |name, klass| + puts name + "\n" + system 'rake ' + name + ':install:migrations' + end + puts "run 'rake db:migrate' if you can migrate database\n" + end +end diff --git a/lib/validators/resize_validator.rb b/lib/validators/resize_validator.rb index 59b62650..be01eeb6 100644 --- a/lib/validators/resize_validator.rb +++ b/lib/validators/resize_validator.rb @@ -1,6 +1,6 @@ class ResizeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - if record.picture.flag_resize < 0 + if record.picture and record.picture.flag_resize < 0 record.errors[attribute] << (options[:message] || "no resize") unless value == record.picture[attribute] end end diff --git a/lib/validators/reverse_validator.rb b/lib/validators/reverse_validator.rb index 638e5b99..b52f6975 100644 --- a/lib/validators/reverse_validator.rb +++ b/lib/validators/reverse_validator.rb @@ -1,6 +1,6 @@ class ReverseValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - if record.picture.flag_reverse < 0 + if record.picture and record.picture.flag_reverse < 0 record.errors[attribute] << (options[:message] || "no reverse") if value < 0 end end diff --git a/lib/validators/sync_vh_validator.rb b/lib/validators/sync_vh_validator.rb index 928d957e..04425fdf 100644 --- a/lib/validators/sync_vh_validator.rb +++ b/lib/validators/sync_vh_validator.rb @@ -1,6 +1,6 @@ class SyncVhValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - if record.picture.flag_sync_vh < 0 + if record.picture and record.picture.flag_sync_vh < 0 record.errors[attribute] << (options[:message] || "sync_vh") unless sync?(record) end end diff --git a/script/gem_builder.rb b/script/gem_builder.rb new file mode 100644 index 00000000..6866ae6c --- /dev/null +++ b/script/gem_builder.rb @@ -0,0 +1,23 @@ +#ライセンスのgemファイルを作るサポートツール +#Yamlファイルからコンバートする +if ARGV.size < 1 + puts "gem_builder.rb dir" + puts "build to gem on child dirs" + exit +end + +dirname = File.expand_path ARGV[0] +Dir.glob dirname + '/*' do |filename| + if File.directory?(filename) + fn = Dir.glob(filename + '/*.gemspec').first + c = "gem build " + fn + Dir.chdir filename do + puts c + system c + end + gem = Dir.glob(filename + '/*.gem').sort.last + c = "gem install " + gem + puts c + system c + end +end diff --git a/script/ls_helper.rb b/script/ls_helper.rb new file mode 100644 index 00000000..4ea1a668 --- /dev/null +++ b/script/ls_helper.rb @@ -0,0 +1,40 @@ +#ライセンスのjsonファイルを作るサポートツール +#Yamlファイルからコンバートする +if ARGV.size < 1 + puts "ls_helper.rb ls.yml [work dir=current dir]" + puts "generate to ls.json" + exit +end + +require 'yaml' +require 'json' +require 'base64' + +filename = ARGV[0] +lg = YAML.load(open(filename).read) +fn = File.basename filename, ".*" +wd = ARGV[1] ? File.expand_path(ARGV[1]) : File.dirname(filename) +o = wd + '/' + fn + '.json' + +lg.each do |k, g| + puts k + g['licenses_attributes'].each do |lk, l| + puts lk + if l['settings'] + puts 'settings to json' + l['settings'] = l['settings'].to_json.to_s + end + if l['system_picture_file'] + fn = File.expand_path(wd + '/' + l['system_picture_file']) + puts 'open system picture file ' + fn + d = File.open(fn, 'rb').read + b = Base64.encode64(d).gsub(/\r/, '').gsub(/\n/, '') + l['system_picture'] = b + l.delete 'system_picture_file' + end + end +end +puts "generating " + o +File.open(o, 'wb') do |f| + f.write lg.to_json.to_s +end diff --git a/spec/cli/u/panels/create.json b/spec/cli/u/panels/create.json index 9b610c9b..53014549 100644 --- a/spec/cli/u/panels/create.json +++ b/spec/cli/u/panels/create.json @@ -9,7 +9,7 @@ "publish": 1, "panel_pictures_attributes": { "new1": { - "resource_picture_id": 3, + "picture_id": 3, "x": 10, "y": 135, "z": 3, @@ -17,7 +17,25 @@ "width": 100, "height": 103 } + }, + "ground_pictures_attributes": { + "new1": { + "picture_id": 1, + "z": 1 + } + }, + "ground_colors_attributes": { + "new1": { + "color_id": 1, + "z": 1 + } + }, + "panel_colors_attributes": { + "new1": { + "code": 1, + "z": 1 + } } }, - "auth_token": "vX7rc33zxVJSQPKjp2vc" + "auth_token": "3d3Fvz9RafTPcpzLrYSW" } \ No newline at end of file diff --git a/spec/controllers/colors_controller_spec.rb b/spec/controllers/colors_controller_spec.rb new file mode 100644 index 00000000..c0a301ef --- /dev/null +++ b/spec/controllers/colors_controller_spec.rb @@ -0,0 +1,95 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#色マスター + +describe ColorsController 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 + end + + 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 'データがリスト構造になっている' 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 + +end diff --git a/spec/controllers/comics_controller_spec.rb b/spec/controllers/comics_controller_spec.rb index 4f937d8b..5d2f639a 100644 --- a/spec/controllers/comics_controller_spec.rb +++ b/spec/controllers/comics_controller_spec.rb @@ -1,12 +1,12 @@ # -*- encoding: utf-8 -*- -require 'spec_helper' - -describe ComicsController do - before do - FactoryGirl.create :admin - @sp = FactoryGirl.create :system_picture - @lg = FactoryGirl.create :license_group - @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id +require 'spec_helper' + +describe ComicsController do + before do + FactoryGirl.create :admin + @sp = FactoryGirl.create :system_picture + @lg = FactoryGirl.create :license_group + @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id @user = FactoryGirl.create :user_yas @author = @user.author #ユーザ作成時に連動して作成される end @@ -392,15 +392,15 @@ describe ComicsController do before do @comic = FactoryGirl.create :comic, :author_id => @user.author.id sign_in @user - Comic.stub(:show).and_return(@comic) + Comic.stub(:edit).and_return(@comic) end context 'つつがなく終わるとき' do it 'ステータスコード200 OKを返す' do get :edit, :id => @comic.id response.should be_success end - it 'コミックモデルに単体取得を問い合わせている' do - Comic.should_receive(:show).exactly(1) + it 'コミックモデルに編集取得を問い合わせている' do + Comic.should_receive(:edit).exactly(1) get :edit, :id => @comic.id end it '@comicにデータを用意している' do @@ -454,13 +454,14 @@ describe ComicsController do sign_in @user end context '事前チェックしておく' do - it 'コミックモデルに単体取得を問い合わせている' do - Comic.stub(:show).with(any_args()).and_return @comic - Comic.should_receive(:show).exactly(1) + it 'コミックモデルに編集取得を問い合わせている' do + Comic.stub(:edit).with(any_args()).and_return @comic + Comic.should_receive(:edit).exactly(1) put :update, :id => @comic.id, :comic => @attr end it 'モデルに更新を依頼する' do - Comic.any_instance.should_receive(:update_attributes).with(any_args) + Comic.any_instance.stub(:save).with(any_args).and_return true + Comic.any_instance.should_receive(:save).exactly(1) put :update, :id => @comic.id, :comic => @attr end it '@comicにアレを取得している' do @@ -475,7 +476,7 @@ describe ComicsController do end context 'html形式' do it 'ステータスコード302 Foundを返す' do - Comic.any_instance.stub(:update_attributes).with(any_args()).and_return(true) + Comic.any_instance.stub(:save).with(any_args()).and_return(true) put :update, :id => @comic.id, :comic => @attr response.status.should eq 302 end @@ -486,12 +487,12 @@ describe ComicsController do end context 'json形式' do it 'ステータスコード200 OKを返す' do - Comic.any_instance.stub(:update_attributes).with(any_args()).and_return(true) + Comic.any_instance.stub(:save).with(any_args()).and_return(true) put :update, :id => @comic.id, :comic => @attr, :format => :json response.should be_success end it 'ページ本体は特に返さない' do - Comic.any_instance.stub(:update_attributes).with(any_args()).and_return(true) + Comic.any_instance.stub(:save).with(any_args()).and_return(true) put :update, :id => @comic.id, :comic => @attr, :format => :json response.body.should match /./ end @@ -520,7 +521,7 @@ describe ComicsController do end context '検証、保存に失敗したとき' do before do - Comic.any_instance.stub(:update_attributes).and_return(false) + Comic.any_instance.stub(:save).and_return(false) end context 'html形式' do it 'ステータスコード200 Okを返す' do @@ -534,7 +535,7 @@ describe ComicsController do end context 'json形式' do it 'ステータスコード422 unprocessable_entity を返す' do - Comic.any_instance.stub(:update_attributes).and_return(false) + Comic.any_instance.stub(:save).and_return(false) put :update, :id => @comic.id, :comic => @attr, :format => :json response.status.should eq 422 end diff --git a/spec/controllers/ground_colors_controller_spec.rb b/spec/controllers/ground_colors_controller_spec.rb new file mode 100644 index 00000000..8d40002a --- /dev/null +++ b/spec/controllers/ground_colors_controller_spec.rb @@ -0,0 +1,115 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマの間接背景 + +describe GroundColorsController 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 = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.id + @panel = FactoryGirl.create :panel, :author_id => @author.id + @color = FactoryGirl.create :color + end + + describe '一覧表示に於いて' do + before do + sign_in @user + @gc = FactoryGirl.create :ground_color + GroundColor.stub(:list).and_return([@gc, @gc, @gc]) + 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 GroundColor.default_page_size + end + it '最大を超えると@page_sizeにデフォルト最大値が入る' do + get :index, :page_size => 1500 + assigns(:page_size).should eq GroundColor.max_page_size + end + it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do + get :index, :page_size => 0 + assigns(:page_size).should eq GroundColor.default_page_size + end + end + context 'つつがなく終わるとき' do + it 'ステータスコード200 OKを返す' do + get :index + response.should be_success + end + it '間接背景モデルに一覧を問い合わせている' do + GroundColor.should_receive(:list).exactly(1) + get :index + end + it '@ground_colorsにリストを取得している' do + get :index + assigns(:ground_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 'データがリスト構造になっている' 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").should be_true + json.first.has_key?("color_id").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 + end + +end diff --git a/spec/controllers/ground_pictures_controller_spec.rb b/spec/controllers/ground_pictures_controller_spec.rb new file mode 100644 index 00000000..e150928a --- /dev/null +++ b/spec/controllers/ground_pictures_controller_spec.rb @@ -0,0 +1,117 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマの画像背景 + +describe GroundPicturesController 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 = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.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 + sign_in @user + @gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id + GroundPicture.stub(:list).and_return([@gp, @gp, @gp]) + 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 GroundPicture.default_page_size + end + it '最大を超えると@page_sizeにデフォルト最大値が入る' do + get :index, :page_size => 1500 + assigns(:page_size).should eq GroundPicture.max_page_size + end + it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do + get :index, :page_size => 0 + assigns(:page_size).should eq GroundPicture.default_page_size + end + end + context 'つつがなく終わるとき' do + it 'ステータスコード200 OKを返す' do + get :index + response.should be_success + end + it 'コマの画像背景モデルに一覧を問い合わせている' do + GroundPicture.should_receive(:list).exactly(1) + get :index + end + it '@ground_picturesにリストを取得している' do + get :index + assigns(:ground_pictures).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 'データがリスト構造になっている' 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?("picture_id").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 + end + +end diff --git a/spec/controllers/original_pictures_controller_spec.rb b/spec/controllers/original_pictures_controller_spec.rb index a81df829..351ffd9d 100644 --- a/spec/controllers/original_pictures_controller_spec.rb +++ b/spec/controllers/original_pictures_controller_spec.rb @@ -34,7 +34,7 @@ describe OriginalPicturesController do end it '省略されると@page_sizeにデフォルト値が入る' do get :index - assigns(:page_size).should eq OriginalPicture.default_page_size + assigns(:page_size).should eq OriginalPicture.default_page_size end it '最大を超えると@page_sizeにデフォルト最大値が入る' do get :index, :page_size => 1500 @@ -51,7 +51,7 @@ describe OriginalPicturesController do response.should be_success end it '原画モデルに一覧を問い合わせている' do - OriginalPicture.should_receive(:list).exactly(1) + OriginalPicture.should_receive(:list).exactly(1) get :index end it '@original_picturesにリストを取得している' do @@ -142,7 +142,7 @@ describe OriginalPicturesController do response.should be_success end it '原画モデルに単体取得を問い合わせている' do - OriginalPicture.should_receive(:show).exactly(1) + OriginalPicture.should_receive(:show).exactly(1) get :show end it '@original_pictureにアレを取得している' do @@ -171,33 +171,33 @@ describe OriginalPicturesController do #スタブをおいてsend_dataがデータを返す体裁でテストする。 context 'png形式' do it '画像モデルに画像データを問い合わせる' do - OriginalPicture.any_instance.should_receive(:restore).exactly(1) + OriginalPicture.any_instance.should_receive(:restore).exactly(1) get :show, :id => @pic.id, :format => :png end it '画像を送信する' do - OriginalPicture.any_instance.stub(:restore).and_return('aaa') + OriginalPicture.any_instance.stub(:restore).and_return('aaa') get :show, :id => @pic.id, :format => :png response.body.should eq 'aaa' end end context 'gif形式' do it '画像モデルに画像データを問い合わせる' do - OriginalPicture.any_instance.should_receive(:restore).exactly(1) + OriginalPicture.any_instance.should_receive(:restore).exactly(1) get :show, :id => @pic.id, :format => :gif end it '画像を送信する' do - OriginalPicture.any_instance.stub(:restore).and_return('bbb') + OriginalPicture.any_instance.stub(:restore).and_return('bbb') get :show, :id => @pic.id, :format => :gif response.body.should eq 'bbb' end end context 'jpeg形式' do it '画像モデルに画像データを問い合わせる' do - OriginalPicture.any_instance.should_receive(:restore).exactly(1) + OriginalPicture.any_instance.should_receive(:restore).exactly(1) get :show, :id => @pic.id, :format => :jpeg end it '画像を送信する' do - OriginalPicture.any_instance.stub(:restore).and_return('ccc') + OriginalPicture.any_instance.stub(:restore).and_return('ccc') get :show, :id => @pic.id, :format => :jpeg response.body.should eq 'ccc' end @@ -293,6 +293,104 @@ describe OriginalPicturesController do =end end + describe '履歴一覧表示に於いて' do + before do + @op = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 0, + :original_picture_id => @op.id + sign_in @user + OriginalPicture.stub(:show).and_return(@op) + OriginalPicture.any_instance.stub(:history).and_return([@p, @p, @p]) + end + context 'つつがなく終わるとき' do + it 'ステータスコード200 OKを返す' do + get :history, :id => @op.id + response.should be_success + end + it '原画モデルに単体取得を問い合わせている' do + OriginalPicture.should_receive(:show).exactly(1) + get :history, :id => @op.id + end + it '自身に履歴一覧を問い合わせている' do + OriginalPicture.any_instance.should_receive(:history).exactly(1) + get :history + end + it '@historyにリストを取得している' do + get :history, :id => @op.id + assigns(:history).should have_at_least(3).items + end + context 'html形式' do + it 'historyテンプレートを描画する' do + get :history, :id => @op.id + response.should render_template("history") + end + end + context 'json形式' do + it 'jsonデータを返す' do + get :history, :id => @op.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + it 'データがリスト構造になっている' do + get :history, :id => @op.id, :format => :json + json = JSON.parse response.body + json.should have_at_least(3).items + end + it 'リストの先頭くらいは原画っぽいものであって欲しい' do + get :history, :id => @op.id, :format => :json + json = JSON.parse response.body + json.first.has_key?("ext").should be_true + end + end + end + context '作家権限がないとき' do + before do + sign_out @user + end + context 'html形式' do + it 'ステータスコード302 Foundを返す' do + get :history, :id => @op.id + response.status.should eq 302 + end + it 'サインインページへ遷移する' do + get :history, :id => @op.id + response.should redirect_to '/users/sign_in' + end + end + context 'json形式' do + it 'ステータスコード401 Unauthorizedを返す' do + get :history, :id => @op.id, :format => :json + response.status.should eq 401 + end + it '応答メッセージにUnauthorizedを返す' do + get :history, :id => @op.id, :format => :json + response.message.should match(/Unauthorized/) + end + end + end + context '作家が絵師でないとき' do + before do + Author.any_instance.stub(:artist?).and_return(false) + end + context 'html形式' do + it 'ステータスコード302 Foundを返す' do + get :history, :id => @op.id + response.status.should eq 302 + end + it '絵師登録ページへ遷移する' do + get :history, :id => @op.id + response.should redirect_to new_artist_path + end + end + context 'json形式' do + it '例外403 forbiddenを返す' do + lambda{ + get :history, :id => @op.id, :format => :json + }.should raise_error(ActiveRecord::Forbidden) + end + end + end + end + describe '新規作成フォーム表示に於いて' do before do sign_in @user @@ -307,7 +405,7 @@ describe OriginalPicturesController do assigns(:original_picture).should be_a_new(OriginalPicture) end it '原画モデルにデフォルト値補充を依頼している' do - OriginalPicture.any_instance.should_receive(:supply_default).exactly(1) + OriginalPicture.any_instance.should_receive(:supply_default).exactly(1) get :new end context 'html形式' do @@ -519,8 +617,8 @@ describe OriginalPicturesController do get :edit, :id => @pic.id response.should be_success end - it '原画モデルに単体取得を問い合わせている' do - OriginalPicture.should_receive(:show).exactly(1) + it '原画モデルに編集取得を問い合わせている' do + OriginalPicture.should_receive(:edit).exactly(1) get :edit, :id => @pic.id end it '@original_pictureにデータを用意している' do @@ -603,7 +701,7 @@ describe OriginalPicturesController do OriginalPicture.any_instance.stub(:store).with(any_args()).and_return(true) end it '原画モデルに単体取得を問い合わせている' do - OriginalPicture.should_receive(:edit).exactly(1) + OriginalPicture.should_receive(:edit).exactly(1) put :update, :id => @pic.id, :original_picture => FactoryGirl.attributes_for(:original_picture) end it 'モデルに更新を依頼する' do diff --git a/spec/controllers/panel_colors_controller_spec.rb b/spec/controllers/panel_colors_controller_spec.rb new file mode 100644 index 00000000..102009d1 --- /dev/null +++ b/spec/controllers/panel_colors_controller_spec.rb @@ -0,0 +1,114 @@ +# -*- 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 = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.id + @panel = FactoryGirl.create :panel, :author_id => @author.id + end + + 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 'データがリスト構造になっている' 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 + end + +end diff --git a/spec/controllers/panels_controller_spec.rb b/spec/controllers/panels_controller_spec.rb index 7f1770b5..485b04d6 100644 --- a/spec/controllers/panels_controller_spec.rb +++ b/spec/controllers/panels_controller_spec.rb @@ -4,9 +4,9 @@ require 'spec_helper' describe PanelsController do before do FactoryGirl.create :admin - @sp = FactoryGirl.create :system_picture - @lg = FactoryGirl.create :license_group - @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id + @sp = FactoryGirl.create :system_picture + @lg = FactoryGirl.create :license_group + @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id @user = FactoryGirl.create :user_yas @author = @user.author #ユーザ作成時に連動して作成される end @@ -430,8 +430,8 @@ describe PanelsController do get :edit, :id => @panel.id response.should be_success end - it 'コマモデルに単体取得を問い合わせている' do - Panel.should_receive(:show).exactly(1) + it 'コマモデルに編集取得を問い合わせている' do + Panel.should_receive(:edit).exactly(1) get :edit, :id => @panel.id end it '@panelにデータを用意している' do diff --git a/spec/controllers/pictures_controller_spec.rb b/spec/controllers/pictures_controller_spec.rb index b61f9200..6fdc26ec 100644 --- a/spec/controllers/pictures_controller_spec.rb +++ b/spec/controllers/pictures_controller_spec.rb @@ -33,6 +33,12 @@ describe PicturesController do get :show, :id => @p.id, :format => :json assigns(:picture).id.should eq(@p.id) end + context 'html形式' do + it 'showテンプレートを描画する' do + get :show, :id => @p.id + response.should render_template("show") + end + end context 'json形式' do it 'jsonデータを返す' do get :show, :id => @p.id, :format => :json @@ -149,89 +155,89 @@ describe PicturesController do =end end - describe 'クレジット表示に於いて' do - before do + describe 'クレジット表示に於いて' do + before do @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id sign_in @user Picture.stub(:show).and_return(@p) - end - context 'つつがなく終わるとき' do - it 'ステータスコード200 OKを返す' do - get :credit, :id => @p.id - response.should be_success - end - it '実素材モデルに単体取得を問い合わせている' do - Picture.should_receive(:show).exactly(1) - get :credit, :id => @p.id - end - it '@pictureにアレを取得している' do - get :credit, :id => @p.id - assigns(:picture).id.should eq(@p.id) - end - context 'html形式' do - it 'creditテンプレートを描画する' do - get :credit, :id => @p.id - response.should render_template("credit") - end - end - context 'json形式' do - it 'jsonデータを返す' do - get :credit, :id => @p.id, :format => :json - lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) - end - it 'データがアレになっている' do - get :credit, :id => @p.id, :format => :json - json = JSON.parse response.body - json["ext"].should match(/png/) - end - end - end - context '作家権限がないとき' do - before do - sign_out @user - end - context 'html形式' do - it 'ステータスコード302 Foundを返す' do - get :credit, :id => @p.id - response.status.should eq 302 - end - it 'サインインページへ遷移する' do - get :credit, :id => @p.id - response.body.should redirect_to '/users/sign_in' - end - end - context 'json形式' do - it 'ステータスコード401 Unauthorizedを返す' do - get :credit, :id => @p.id, :format => :json - response.status.should eq 401 - end - it '応答メッセージにUnauthorizedを返す' do - get :credit, :id => @p.id, :format => :json - response.message.should match(/Unauthorized/) - end - end - end -=begin - context '対象素材がないとき' do - before do - Picture.unstub(:show) - end - context 'html形式' do - it '例外404 not_foundを返す' do - lambda{ - get :show, :id => 0 - }.should raise_error(ActiveRecord::RecordNotFound) - end - end - context 'json形式' do - it '例外404 not_foundを返す' do - lambda{ - get :show, :id => 0, :format => :json - }.should raise_error(ActiveRecord::RecordNotFound) - end - end - end -=end - end + end + context 'つつがなく終わるとき' do + it 'ステータスコード200 OKを返す' do + get :credit, :id => @p.id + response.should be_success + end + it '実素材モデルに単体取得を問い合わせている' do + Picture.should_receive(:show).exactly(1) + get :credit, :id => @p.id + end + it '@pictureにアレを取得している' do + get :credit, :id => @p.id + assigns(:picture).id.should eq(@p.id) + end + context 'html形式' do + it 'creditテンプレートを描画する' do + get :credit, :id => @p.id + response.should render_template("credit") + end + end + context 'json形式' do + it 'jsonデータを返す' do + get :credit, :id => @p.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + it 'データがアレになっている' do + get :credit, :id => @p.id, :format => :json + json = JSON.parse response.body + json["ext"].should match(/png/) + end + end + end + context '作家権限がないとき' do + before do + sign_out @user + end + context 'html形式' do + it 'ステータスコード302 Foundを返す' do + get :credit, :id => @p.id + response.status.should eq 302 + end + it 'サインインページへ遷移する' do + get :credit, :id => @p.id + response.body.should redirect_to '/users/sign_in' + end + end + context 'json形式' do + it 'ステータスコード401 Unauthorizedを返す' do + get :credit, :id => @p.id, :format => :json + response.status.should eq 401 + end + it '応答メッセージにUnauthorizedを返す' do + get :credit, :id => @p.id, :format => :json + response.message.should match(/Unauthorized/) + end + end + end +=begin + context '対象素材がないとき' do + before do + Picture.unstub(:show) + end + context 'html形式' do + it '例外404 not_foundを返す' do + lambda{ + get :show, :id => 0 + }.should raise_error(ActiveRecord::RecordNotFound) + end + end + context 'json形式' do + it '例外404 not_foundを返す' do + lambda{ + get :show, :id => 0, :format => :json + }.should raise_error(ActiveRecord::RecordNotFound) + end + end + end +=end + end end diff --git a/spec/controllers/stories_controller_spec.rb b/spec/controllers/stories_controller_spec.rb index 878be3b3..0ac61e4b 100644 --- a/spec/controllers/stories_controller_spec.rb +++ b/spec/controllers/stories_controller_spec.rb @@ -209,8 +209,8 @@ describe StoriesController do get :edit, :id => @story.id response.should be_success end - it 'コマモデルに単体取得を問い合わせている' do - Story.should_receive(:show).exactly(1) + it 'コマモデルに編集取得を問い合わせている' do + Story.should_receive(:edit).exactly(1) get :edit, :id => @story.id end it '@storyにデータを用意している' do @@ -363,74 +363,74 @@ describe StoriesController do end end - describe '削除に於いて' do - before do + describe '削除に於いて' do + before do @story = FactoryGirl.create :story, :author_id => @author.id sign_in @user - Story.stub(:edit).and_return(@story) - end - context 'つつがなく終わるとき' do - it 'ストーリーモデルに編集取得を問い合わせている' do - Story.should_receive(:edit).exactly(1) - delete :destroy, :id => @story.id - end - it '@storyにアレを取得している' do - delete :destroy, :id => @story.id - assigns(:story).id.should eq(@story.id) - end - it 'そのストーリーを一つのトランザクションで削除する' do - lambda { - delete :destroy, :id => @story.id - }.should change(Story, :count) - end - context 'html形式' do - it 'ステータスコード302 Foundを返す' do - delete :destroy, :id => @story.id - response.status.should eq 302 - end - it 'ストーリー一覧ページへ遷移する' do - delete :destroy, :id => @story.id - response.should redirect_to(story_path(@story.comic_id)) - end - end - context 'json形式' do - it 'ステータスコード200 OKを返す' do - delete :destroy, :id => @story.id, :format => :json - response.should be_success - end - end - end - context '作家権限がないとき' do - before do - sign_out @user - end - context 'html形式' do - it 'ステータスコード302 Foundを返す' do - delete :destroy, :id => @story.id - response.status.should eq 302 - end - it 'サインインページへ遷移する' do - delete :destroy, :id => @story.id - response.body.should redirect_to '/users/sign_in' - end - end - context 'json形式' do - it 'ステータスコード401 Unauthorizedを返す' do - delete :destroy, :id => @story.id, :format => :json - response.status.should eq 401 - end - it '応答メッセージにUnauthorizedを返す' do - delete :destroy, :id => @story.id, :format => :json - response.message.should match(/Unauthorized/) - end - end - end -=begin - context '対象ストーリーがないとき' do - end - context '他人のストーリーだったとき' do - end -=end - end - + Story.stub(:edit).and_return(@story) + end + context 'つつがなく終わるとき' do + it 'ストーリーモデルに編集取得を問い合わせている' do + Story.should_receive(:edit).exactly(1) + delete :destroy, :id => @story.id + end + it '@storyにアレを取得している' do + delete :destroy, :id => @story.id + assigns(:story).id.should eq(@story.id) + end + it 'そのストーリーを一つのトランザクションで削除する' do + lambda { + delete :destroy, :id => @story.id + }.should change(Story, :count) + end + context 'html形式' do + it 'ステータスコード302 Foundを返す' do + delete :destroy, :id => @story.id + response.status.should eq 302 + end + it 'ストーリー一覧ページへ遷移する' do + delete :destroy, :id => @story.id + response.should redirect_to(story_path(@story.comic_id)) + end + end + context 'json形式' do + it 'ステータスコード200 OKを返す' do + delete :destroy, :id => @story.id, :format => :json + response.should be_success + end + end + end + context '作家権限がないとき' do + before do + sign_out @user + end + context 'html形式' do + it 'ステータスコード302 Foundを返す' do + delete :destroy, :id => @story.id + response.status.should eq 302 + end + it 'サインインページへ遷移する' do + delete :destroy, :id => @story.id + response.body.should redirect_to '/users/sign_in' + end + end + context 'json形式' do + it 'ステータスコード401 Unauthorizedを返す' do + delete :destroy, :id => @story.id, :format => :json + response.status.should eq 401 + end + it '応答メッセージにUnauthorizedを返す' do + delete :destroy, :id => @story.id, :format => :json + response.message.should match(/Unauthorized/) + end + end + end +=begin + context '対象ストーリーがないとき' do + end + context '他人のストーリーだったとき' do + end +=end + end + end diff --git a/spec/factories.rb b/spec/factories.rb index b8c0dfdd..ff13301b 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -52,10 +52,14 @@ 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.width 100 - comic.height 10 comic.visible 3 end @@ -65,6 +69,7 @@ FactoryGirl.define do op.height 111 op.filesize 100000 op.artist_id 1 + op.md5 'op8f6bcd4621d373cade4e832627b4f6' end factory :oplg, :class => OriginalPictureLicenseGroup do |oplg| @@ -77,6 +82,7 @@ FactoryGirl.define do rp.width 222 rp.height 111 rp.filesize 100000 + rp.md5 'rp8f6bcd4621d373cade4e832627b4f6' rp.artist_id 1 rp.license_id 1 rp.classname 'StandardLicense' @@ -90,6 +96,7 @@ FactoryGirl.define do p.width 222 p.height 111 p.filesize 100000 + p.md5 'ap8f6bcd4621d373cade4e832627b4f6' p.artist_id 1 p.license_id 1 p.artist_name 'no name' @@ -156,6 +163,24 @@ 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.z 1 + end + + factory :ground_picture, :class => GroundPicture do |gp| + gp.panel_id 1 + gp.picture_id 1 + gp.z 1 + end + factory :panel, :class => Panel do |panel| panel.border 1 panel.x nil diff --git a/spec/helpers/artists_helper_spec.rb b/spec/helpers/artists_helper_spec.rb index 7a1305af..f66b09fc 100644 --- a/spec/helpers/artists_helper_spec.rb +++ b/spec/helpers/artists_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe ArtistsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/authors_helper_spec.rb b/spec/helpers/authors_helper_spec.rb index 09acc33b..9c0a8cba 100644 --- a/spec/helpers/authors_helper_spec.rb +++ b/spec/helpers/authors_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe AuthorsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/balloons_helper_spec.rb b/spec/helpers/balloons_helper_spec.rb index c8b66059..5a4a680a 100644 --- a/spec/helpers/balloons_helper_spec.rb +++ b/spec/helpers/balloons_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe BalloonsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/colors_helper_spec.rb b/spec/helpers/colors_helper_spec.rb new file mode 100644 index 00000000..9e0d6e50 --- /dev/null +++ b/spec/helpers/colors_helper_spec.rb @@ -0,0 +1,16 @@ +# -*- 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/comics_helper_spec.rb b/spec/helpers/comics_helper_spec.rb index 30bdaafa..3ffabda5 100644 --- a/spec/helpers/comics_helper_spec.rb +++ b/spec/helpers/comics_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe ComicsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/ground_colors_helper_spec.rb b/spec/helpers/ground_colors_helper_spec.rb new file mode 100644 index 00000000..612d2801 --- /dev/null +++ b/spec/helpers/ground_colors_helper_spec.rb @@ -0,0 +1,16 @@ +# -*- encoding: utf-8 -*- +#  +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the GroundColorsHelper. For example: +# +# describe GroundColorsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe GroundColorsHelper do +end diff --git a/spec/helpers/ground_pictures_helper_spec.rb b/spec/helpers/ground_pictures_helper_spec.rb new file mode 100644 index 00000000..49bac834 --- /dev/null +++ b/spec/helpers/ground_pictures_helper_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the GroundPicturesHelper. For example: +# +# describe GroundPicturesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe GroundPicturesHelper do +end diff --git a/spec/helpers/home_helper_spec.rb b/spec/helpers/home_helper_spec.rb index 4a376330..85739de7 100644 --- a/spec/helpers/home_helper_spec.rb +++ b/spec/helpers/home_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe HomeHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/license_groups_helper_spec.rb b/spec/helpers/license_groups_helper_spec.rb index 5b68da92..086a88c2 100644 --- a/spec/helpers/license_groups_helper_spec.rb +++ b/spec/helpers/license_groups_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe LicenseGroupsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/licenses_helper_spec.rb b/spec/helpers/licenses_helper_spec.rb index 832b7963..727c0565 100644 --- a/spec/helpers/licenses_helper_spec.rb +++ b/spec/helpers/licenses_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe LicensesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/original_picture_license_groups_helper_spec.rb b/spec/helpers/original_picture_license_groups_helper_spec.rb index 85b259bb..dcc573e7 100644 --- a/spec/helpers/original_picture_license_groups_helper_spec.rb +++ b/spec/helpers/original_picture_license_groups_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe OriginalPictureLicenseGroupsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/original_pictures_helper_spec.rb b/spec/helpers/original_pictures_helper_spec.rb index b5062052..fe678c18 100644 --- a/spec/helpers/original_pictures_helper_spec.rb +++ b/spec/helpers/original_pictures_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe OriginalPicturesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/panel_colors_helper_spec.rb b/spec/helpers/panel_colors_helper_spec.rb new file mode 100644 index 00000000..2f2d8178 --- /dev/null +++ b/spec/helpers/panel_colors_helper_spec.rb @@ -0,0 +1,16 @@ +# -*- 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/helpers/panel_pictures_helper_spec.rb b/spec/helpers/panel_pictures_helper_spec.rb index fb0c201c..622414f8 100644 --- a/spec/helpers/panel_pictures_helper_spec.rb +++ b/spec/helpers/panel_pictures_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe PanelPicturesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/panels_helper_spec.rb b/spec/helpers/panels_helper_spec.rb index 8a383885..a3cff28b 100644 --- a/spec/helpers/panels_helper_spec.rb +++ b/spec/helpers/panels_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe PanelsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/pictures_helper_spec.rb b/spec/helpers/pictures_helper_spec.rb index d0a47d3a..ebaaea89 100644 --- a/spec/helpers/pictures_helper_spec.rb +++ b/spec/helpers/pictures_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe PicturesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/resource_pictures_helper_spec.rb b/spec/helpers/resource_pictures_helper_spec.rb index 1da55083..2ce12b2a 100644 --- a/spec/helpers/resource_pictures_helper_spec.rb +++ b/spec/helpers/resource_pictures_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe ResourcePicturesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/speech_balloon_templates_helper_spec.rb b/spec/helpers/speech_balloon_templates_helper_spec.rb index 6134c6da..ed083a43 100644 --- a/spec/helpers/speech_balloon_templates_helper_spec.rb +++ b/spec/helpers/speech_balloon_templates_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe SpeechBalloonTemplatesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/speech_balloons_helper_spec.rb b/spec/helpers/speech_balloons_helper_spec.rb index 041cfcf1..d89b38cb 100644 --- a/spec/helpers/speech_balloons_helper_spec.rb +++ b/spec/helpers/speech_balloons_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe SpeechBalloonsHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/speeches_helper_spec.rb b/spec/helpers/speeches_helper_spec.rb index 0de28b6f..e0582b8c 100644 --- a/spec/helpers/speeches_helper_spec.rb +++ b/spec/helpers/speeches_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe SpeechesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/system_helper_spec.rb b/spec/helpers/system_helper_spec.rb index 8f363454..39b804fd 100644 --- a/spec/helpers/system_helper_spec.rb +++ b/spec/helpers/system_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe SystemHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/helpers/system_pictures_helper_spec.rb b/spec/helpers/system_pictures_helper_spec.rb index 839a2e7d..6b0acadd 100644 --- a/spec/helpers/system_pictures_helper_spec.rb +++ b/spec/helpers/system_pictures_helper_spec.rb @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- +#  require 'spec_helper' # Specs in this file have access to a helper object that includes @@ -11,5 +13,4 @@ require 'spec_helper' # end # end describe SystemPicturesHelper do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/json/color.json b/spec/json/color.json new file mode 100644 index 00000000..e9b2ddc2 --- /dev/null +++ b/spec/json/color.json @@ -0,0 +1,6 @@ +{ + "white": { + "code": 0, + "t": 0 + } +} diff --git a/spec/json/colors.json b/spec/json/colors.json new file mode 100644 index 00000000..fba582f0 --- /dev/null +++ b/spec/json/colors.json @@ -0,0 +1,10 @@ +{ + "white": { + "code": 255, + "t": 0 + }, + "black": { + "code": 0, + "t": 1 + } +} diff --git a/spec/json/license_group.json b/spec/json/license_group.json index 3cfb5ab8..fec9dbaf 100644 --- a/spec/json/license_group.json +++ b/spec/json/license_group.json @@ -8,7 +8,7 @@ "PublicDomain": { "caption": "Public Domain", "url": "http://test.com/", - "system_picture": "Data" + "system_picture": "iVBORw0KGgoAAAANSUhEUgAAAHkAAAB6CAIAAAAUDGuwAAAgAElEQVR4nM196VcUSdZ+ZFYVS1GAArLvi6CyiIjiK9i2jQug3a2t0zNzzvwT80fNnD7dtjbgLj1to4i4sAnKvoNQ7DtVlZnvh9uGt+6NrHY+/M7vjQ91sjIjbtz73HufyCUyUvvnP/9ZVVUl/n+Xvb09IYTP55udnQ0EAoFAYGRkxDCM/0qIZVmpqan79+8XQiQkJOzbt08I4XQ6HQ7H/wud/6vS3t7urKqqunHjhmVZcq+maZZlaZqGq+I9dkexECyHHCXyl5eXNzY2nj59qu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cw8PT09Nv3LgBX8YaHBycmpra29sLcalpF7Ok5p8mhF0uWpYFEHs8npMnT3o8nrKyMj4AEkyxSpxVSOTZBcqnqyCSYiEIkQi1Ox/AWmZlZWVmZh45cmRwcHBsbGxycnJ1dZV/uIsUTIVCRSa8X6WdctQFujh48GBCQkJJSUlKSgpONc45/ExBhKQ7YgtpQj+tIasq2V3JM8om3HJN0+BFyuPHj3/48GF9fR3ODuHtG/IWlxLN0DZzfeQe0zThPeLS0tIDBw6kpaXBPFXlOQ8uoY9yG3n444b0Gp3rSsyWsCqBCGE53khJSUlJSUlLS4N53Ovr62/evMHoSDlKQuDbuHd86QgP4fLy8nJycuLj491ut/ykaAj4lOQr9cHd8aiSwrkQGtd2vfJDPLk4k9oRPfzCs+ezZ89alnX69GkhBHzL0+/3BwKBsbEx+T0P5fimNCkpKWn//v2maRYWFmZnZ1uWFRUVJVcZV5pgF5LKnTzIBIszu4HH2d7eLv7PFMuy4Lbn7u4uvG32XzWHO03gwqGhIfjQ+/+R0t7e/r/EJS/D7Vqp8gAAAABJRU5ErkJggg==" } } } diff --git a/spec/json/license_groups.json b/spec/json/license_groups.json index fe31ec72..e8b082a9 100644 --- a/spec/json/license_groups.json +++ b/spec/json/license_groups.json @@ -12,12 +12,12 @@ "UnknownF1": { "caption": "Unknown Flag1", "url": "http://test.com/f1", - "system_picture": "Dataf1" + "system_picture": "iVBORw0KGgoAAAANSUhEUgAAAHkAAAB6CAIAAAAUDGuwAAAgAElEQVR4nM196VcUSdZ+ZFYVS1GAArLvi6CyiIjiK9i2jQug3a2t0zNzzvwT80fNnD7dtjbgLj1to4i4sAnKvoNQ7DtVlZnvh9uGt+6NrHY+/M7vjQ91sjIjbtz73HufyCUyUvvnP/9ZVVUl/n+Xvb09IYTP55udnQ0EAoFAYGRkxDCM/0qIZVmpqan79+8XQiQkJOzbt08I4XQ6HQ7H/wud/6vS3t7urKqqunHjhmVZcq+maZZlaZqGq+I9dkexECyHHCXyl5eXNzY2nj59quu6rO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T09Nv3LgBX8YaHBycmpra29sLcalpF7Ok5p8mhF0uWpYFEHs8npMnT3o8nrKyMj4AEkyxSpxVSOTZBcqnqyCSYiEIkQi1Ox/AWmZlZWVmZh45cmRwcHBsbGxycnJ1dZV/uIsUTIVCRSa8X6WdctQFujh48GBCQkJJSUlKSgpONc45/ExBhKQ7YgtpQj+tIasq2V3JM8om3HJN0+BFyuPHj3/48GF9fR3ODuHtG/IWlxLN0DZzfeQe0zThPeLS0tIDBw6kpaXBPFXlOQ8uoY9yG3n444b0Gp3rSsyWsCqBCGE53khJSUlJSUlLS4N53Ovr62/evMHoSDlKQuDbuHd86QgP4fLy8nJycuLj491ut/ykaAj4lOQr9cHd8aiSwrkQGtd2vfJDPLk4k9oRPfzCs+ezZ89alnX69GkhBHzL0+/3BwKBsbEx+T0P5fimNCkpKWn//v2maRYWFmZnZ1uWFRUVJVcZV5pgF5LKnTzIBIszu4HH2d7eLv7PFMuy4Lbn7u4uvG32XzWHO03gwqGhIfjQ+/+R0t7e/r/EJS/D7Vqp8gAAAABJRU5ErkJggg==" }, "UnknownF2": { "caption": "Unknown Flag2", "url": "http://test.com/f2", - "system_picture": "Dataf2" + "system_picture": "iVBORw0KGgoAAAANSUhEUgAAAHkAAAB6CAIAAAAUDGuwAAAgAElEQVR4nM196VcUSdZ+ZFYVS1GAArLvi6CyiIjiK9i2jQug3a2t0zNzzvwT80fNnD7dtjbgLj1to4i4sAnKvoNQ7DtVlZnvh9uGt+6NrHY+/M7vjQ91sjIjbtz73HufyCUyUvvnP/9ZVVUl/n+Xvb09IYTP55udnQ0EAoFAYGRkxDCM/0qIZVmpqan79+8XQiQkJOzbt08I4XQ6HQ7H/wud/6vS3t7urKqqunHjhmVZcq+maZZlaZqGq+I9dkexECyHHCXyl5eXNzY2nj59quu6rOZyuYqKimCb9GWnA1FD0zSHw2EYRmZm5sGDB2NiYlwul+wdK4kb2tmO1ZB/yQYWqNTQaQcNqU1EEEG8Gv6Lf0HCzs6O3+/v7+/f2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VmZh45cmRwcHBsbGxycnJ1dZV/uIsUTIVCRSa8X6WdctQFujh48GBCQkJJSUlKSgpONc45/ExBhKQ7YgtpQj+tIasq2V3JM8om3HJN0+BFyuPHj3/48GF9fR3ODuHtG/IWlxLN0DZzfeQe0zThPeLS0tIDBw6kpaXBPFXlOQ8uoY9yG3n444b0Gp3rSsyWsCqBCGE53khJSUlJSUlLS4N53Ovr62/evMHoSDlKQuDbuHd86QgP4fLy8nJycuLj491ut/ykaAj4lOQr9cHd8aiSwrkQGtd2vfJDPLk4k9oRPfzCs+ezZ89alnX69GkhBHzL0+/3BwKBsbEx+T0P5fimNCkpKWn//v2maRYWFmZnZ1uWFRUVJVcZV5pgF5LKnTzIBIszu4HH2d7eLv7PFMuy4Lbn7u4uvG32XzWHO03gwqGhIfjQ+/+R0t7e/r/EJS/D7Vqp8gAAAABJRU5ErkJggg==" } } } diff --git a/spec/models/admin_spec.rb b/spec/models/admin_spec.rb index ccc4624d..745094ea 100644 --- a/spec/models/admin_spec.rb +++ b/spec/models/admin_spec.rb @@ -1,5 +1,6 @@ +# -*- encoding: utf-8 -*- +#管理者 require 'spec_helper' describe Admin do - pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/artist_spec.rb b/spec/models/artist_spec.rb index b1b088bc..f7797cf0 100644 --- a/spec/models/artist_spec.rb +++ b/spec/models/artist_spec.rb @@ -17,17 +17,17 @@ describe Artist do end it 'オーソドックスなデータなら通る' do - @artist = FactoryGirl.build :artist, :author_id => @author.id, :default_license_id => @license.id + @artist = FactoryGirl.build :artist, :author_id => @author.id @artist.should be_valid end context 'nameを検証するとき' do it 'nullなら失敗する' do - @artist = FactoryGirl.build :artist, :author_id => @author.id, :default_license_id => @license.id, :name => nil + @artist = FactoryGirl.build :artist, :author_id => @author.id, :name => nil @artist.should_not be_valid end it '30文字以上なら失敗する' do - @artist = FactoryGirl.build :artist, :author_id => @author.id, :default_license_id => @license.id, :name => 'a'*31 + @artist = FactoryGirl.build :artist, :author_id => @author.id, :name => 'a'*31 @artist.should_not be_valid end end @@ -43,7 +43,7 @@ describe Artist do describe '単体取得に於いて' do before do - @artist = FactoryGirl.create :artist, :author_id => @author.id, :default_license_id => @license.id + @artist = FactoryGirl.create :artist, :author_id => @author.id end it '指定の絵師を返す' do a = Artist.show @artist.id @@ -62,9 +62,34 @@ describe Artist do end end end + describe '編集取得に於いて' do + before do + @artist = FactoryGirl.create :artist, :author_id => @author.id + end + it '指定の絵師を返す' do + Artist.any_instance.stub(:own?).and_return(true) + r = Artist.edit @artist.id, @author.id + r.should eq @artist + end + context '他人の絵師を開こうとしたとき' do + it '403Forbidden例外を返す' do + Artist.any_instance.stub(:own?).and_return(false) + lambda{ + Artist.edit @artist.id, @author + }.should raise_error(ActiveRecord::Forbidden) + end + end + context '存在しない絵師を開こうとしたとき' do + it '404RecordNotFound例外を返す' do + lambda{ + Artist.edit 110, @author + }.should raise_error(ActiveRecord::RecordNotFound) + end + end + end describe '一覧取得に於いて' do before do - @artist = FactoryGirl.create :artist, :author_id => @author.id, :default_license_id => @license.id + @artist = FactoryGirl.create :artist, :author_id => @author.id end context 'page補正について' do it '文字列から数値に変換される' do diff --git a/spec/models/color_spec.rb b/spec/models/color_spec.rb new file mode 100644 index 00000000..bbb61261 --- /dev/null +++ b/spec/models/color_spec.rb @@ -0,0 +1,224 @@ +# -*- 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' + FactoryGirl.create :admin + @user = FactoryGirl.create( :user_yas) + @author = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.id + @other_user = FactoryGirl.create( :user_yas) + @other_author = @other_user.author + @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 + end + + it 'オーソドックスなデータなら通る' do + @c = FactoryGirl.build :color + @c.should be_valid + end + + context 'nameを検証するとき' do + before do + @c = FactoryGirl.build :color + end + it 'テストデータの確認' do + @c.name = 'a'*50 + @c.should be_valid + end + 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 + before do + @c = FactoryGirl.build :color + end + it 'テストデータの確認' do + @c.code = 0xffffff + @c.should be_valid + end + 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 + before do + @c = FactoryGirl.build :color + end + it 'テストデータの確認' do + @c.t = '1' + @c.should be_valid + end + 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 + 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 + + describe '単体取得に於いて' do + before do + @c = FactoryGirl.create :color + end + it '指定の色を返す' do + c = Color.show @c.id + c.should eq @c + end + context '存在しない色を開こうとしたとき' do + it '404RecordNotFound例外を返す' do + lambda{ + Color.show 110 + }.should raise_error(ActiveRecord::RecordNotFound) + end + end + end + + describe '一覧取得に於いて' do + before do + @color = 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 + it 'リストを返す' do + cl = Color.list + cl.should eq [@color] + end + it 'tで並んでいる' do + ncl = FactoryGirl.create :color, :t => 1, :name => 'name a' + cl = Color.list + cl.should eq [@color, ncl] + end + context 'DBに5件あって1ページの件数を2件に変えたとして' do + before do + @nc2 = FactoryGirl.create :color, :t => 1, :name => 'name a' + @nc3 = FactoryGirl.create :color, :t => 3, :name => 'name b' + @nc4 = FactoryGirl.create :color, :t => 2, :name => 'name c' + @nc5 = FactoryGirl.create :color, :t => 4, :name => 'name d' + Color.stub(:default_page_size).and_return(2) + end + it '通常は2件を返す' do + cl = Color.list + cl.should have(2).items + end + it 'page=1なら末尾2件を返す' do + #時系列で並んでいる + cl = Color.list( {}, 1) + cl.should eq [@color, @nc2] + end + it 'page=2なら中間2件を返す' do + cl = Color.list({}, 2) + cl.should eq [@nc4, @nc3] + end + it 'page=3なら先頭1件を返す' do + cl = Color.list({}, 3) + cl.should eq [@nc5] + end + end + end + +end diff --git a/spec/models/comic_spec.rb b/spec/models/comic_spec.rb index b4d9f423..c73ec3b0 100644 --- a/spec/models/comic_spec.rb +++ b/spec/models/comic_spec.rb @@ -35,42 +35,6 @@ describe Comic do @comic.should_not be_valid end end - context 'widthを検証するとき' do - it 'nullなら失敗する' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :width => nil - @comic.should_not be_valid - end - it '0なら失敗する' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :width => 0 - @comic.should_not be_valid - end - it '負でも失敗する' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :width => -1 - @comic.should_not be_valid - end - it '正なら通る' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :width => 1 - @comic.should be_valid - end - end - context 'heightを検証するとき' do - it 'nullなら失敗する' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :height => nil - @comic.should_not be_valid - end - it '0なら失敗する' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :height => 0 - @comic.should_not be_valid - end - it '負でも失敗する' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :height => -1 - @comic.should_not be_valid - end - it '正なら通る' do - @comic = FactoryGirl.build :comic, :author_id => @author.id, :height => 1 - @comic.should be_valid - end - end context 'visibleを検証するとき' do it 'nullなら失敗する' do @comic = FactoryGirl.build :comic, :author_id => @author.id, :visible => nil @@ -153,6 +117,31 @@ describe Comic do c.should eq @comic end end + describe '編集取得に於いて' do + before do + @comic = FactoryGirl.create :comic, :author_id => @author.id + end + it '指定のコミックを返す' do + Comic.any_instance.stub(:own?).and_return(true) + c = Comic.edit @comic.id, @author.id + c.should eq @comic + end + context '他人のコミックを開こうとしたとき' do + it '403Forbidden例外を返す' do + Comic.any_instance.stub(:own?).and_return(false) + lambda{ + Comic.edit @comic.id, @author + }.should raise_error(ActiveRecord::Forbidden) + end + end + context '存在しないコミックを開こうとしたとき' do + it '404RecordNotFound例外を返す' do + lambda{ + Comic.edit 110, @author + }.should raise_error(ActiveRecord::RecordNotFound) + end + end + end describe '関連テーブルプションに於いて' do context 'オプションがないとき' do it '2つの項目を含んでいる' do diff --git a/spec/models/ground_color_spec.rb b/spec/models/ground_color_spec.rb new file mode 100644 index 00000000..556956e9 --- /dev/null +++ b/spec/models/ground_color_spec.rb @@ -0,0 +1,222 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマの背景間接 + +describe GroundColor do + before do + FactoryGirl.create :admin + @user = FactoryGirl.create( :user_yas) + @author = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.id + @other_user = FactoryGirl.create( :user_yas) + @other_author = @other_user.author + @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 + @color = FactoryGirl.create :color + end + + describe '検証に於いて' do + before do + @gc = FactoryGirl.build :ground_color, :panel_id => @panel.id, :color_id => @color.id + end + it 'オーソドックスなデータなら通る' do + @gc.save + @gc.should be_valid + end + + context 'panel_idを検証するとき' do + #ネストの保存はnilを許可しなければならないので数値チェックだけ + it 'テストデータの確認' do + @gc.panel_id = @panel.id + @gc.should be_valid + end + it '数値でなければ失敗する' do + @gc.panel_id = 'a' + @gc.should_not be_valid + end + end + context 'color_idを検証するとき' do + it 'テストデータの確認' do + @gc.color_id = @color.id + @gc.should be_valid + end + it 'nullなら失敗する' do + @gc.color_id = nil + @gc.should_not be_valid + end + it '数値でなければ失敗する' do + @gc.color_id = 'a' + @gc.should_not be_valid + end + it '存在する実素材でなければ失敗する' do + @gc.color_id = 0 + @gc.should_not be_valid + end + end + context 'zを検証するとき' do + it 'テストデータの確認' do + @gc.z = 1 + @gc.should be_valid + end + it 'nullなら失敗する' do + @gc.z = nil + @gc.should_not be_valid + end + it '数値でなければ失敗する' do + @gc.z = 'a' + @gc.should_not be_valid + end + it '負なら失敗する' do + @gc.z = -1 + @gc.should_not be_valid + end + it '負なら失敗する' do + @gc.z = 0 + @gc.should_not be_valid + end + end + end + describe '一覧取得に於いて' do + before do + @gc = FactoryGirl.create :ground_color, :panel_id => @panel.id, :color_id => @color.id + end + context 'page補正について' do + it '文字列から数値に変換される' do + GroundColor.page('8').should eq 8 + end + it 'nilの場合は1になる' do + GroundColor.page().should eq 1 + end + it '0以下の場合は1になる' do + GroundColor.page('0').should eq 1 + end + end + context 'page_size補正について' do + it '文字列から数値に変換される' do + GroundColor.page_size('7').should eq 7 + end + it 'nilの場合はGroundColor.default_page_sizeになる' do + GroundColor.page_size().should eq GroundColor.default_page_size + end + it '0以下の場合はGroundColor.default_page_sizeになる' do + GroundColor.page_size('0').should eq GroundColor.default_page_size + end + it 'GroundColor.max_page_sizeを超えた場合はGroundColor.max_page_sizeになる' do + GroundColor.page_size('1000').should eq GroundColor.max_page_size + end + end + it 'リストを返す' do + pl = GroundColor.list + 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 + pl = GroundColor.list + pl.should eq [npl, @gc] + end + 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 + pl = GroundColor.list + pl.should eq [@gc] + end + context 'DBに5件あって1ページの件数を2件に変えたとして' do + before do + @npl2 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 1, :color_id => @color.id, :updated_at => Time.now + 100 + @npl3 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 2, :color_id => @color.id, :updated_at => Time.now + 200 + @npl4 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 3, :color_id => @color.id, :updated_at => Time.now + 300 + @npl5 = FactoryGirl.create :ground_color, :panel_id => @panel.id, :z => 4, :color_id => @color.id, :updated_at => Time.now + 400 + GroundColor.stub(:default_page_size).and_return(2) + end + it '通常は2件を返す' do + pl = GroundColor.list + pl.should have(2).items + end + it 'page=1なら末尾2件を返す' do + #時系列で並んでいる + pl = GroundColor.list( {}, 1) + pl.should eq [@npl5, @npl4] + end + it 'page=2なら中間2件を返す' do + pl = GroundColor.list({}, 2) + pl.should eq [@npl3, @npl2] + end + it 'page=3なら先頭1件を返す' do + pl = GroundColor.list({}, 3) + pl.should eq [@gc] + end + end + end + describe 'list関連テーブルプションに於いて' do + it 'includeキーを含んでいる' do + r = GroundColor.list_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = GroundColor.list_opt[:include] + r.should have(2).items + end + it 'コマを含んでいる' do + r = GroundColor.list_opt[:include] + r.has_key?(:panel).should be_true + end + it 'コマは作家を含んでいる' 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 + it 'includeキーを含んでいる' do + r = GroundColor.list_json_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = GroundColor.list_json_opt[:include] + r.should have(2).items + end + it 'コマを含んでいる' do + r = GroundColor.list_json_opt[:include] + r.has_key?(:panel).should be_true + end + it 'コマは作家を含んでいる' do + r = GroundColor.list_json_opt[:include] + r[:panel].has_key?(:author).should be_true + end + it '色を含んでいる' do + r = GroundColor.list_json_opt[:include] + r.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 + end + it 'リストを返す' do + pl = GroundColor.mylist @author + 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 + pl = GroundColor.mylist @author + pl.should eq [npl, @gc] + end + 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 + pl = GroundColor.mylist @author + pl.should eq [@gc] + end + end + +end diff --git a/spec/models/ground_picture_spec.rb b/spec/models/ground_picture_spec.rb new file mode 100644 index 00000000..9a45e754 --- /dev/null +++ b/spec/models/ground_picture_spec.rb @@ -0,0 +1,237 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマの画像背景 + +describe GroundPicture do + before do + FactoryGirl.create :admin + @user = FactoryGirl.create( :user_yas) + @author = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.id + @other_user = FactoryGirl.create( :user_yas) + @other_author = @other_user.author + @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 + @gp = FactoryGirl.build :ground_picture, :panel_id => @panel.id, :picture_id => @p.id + end + it 'オーソドックスなデータなら通る' do + @gp.save + @gp.should be_valid + end + + context 'panel_idを検証するとき' do + #ネストの保存はnilを許可しなければならないので数値チェックだけ + it 'テストデータの確認' do + @gp.panel_id = @panel.id + @gp.should be_valid + end + it '数値でなければ失敗する' do + @gp.panel_id = 'a' + @gp.should_not be_valid + end + end + context 'picture_idを検証するとき' do + it 'テストデータの確認' do + @gp.picture_id = @panel.id + @gp.should be_valid + end + it 'nullなら失敗する' do + @gp.picture_id = nil + @gp.should_not be_valid + end + it '数値でなければ失敗する' do + @gp.picture_id = 'a' + @gp.should_not be_valid + end + it '存在する実素材でなければ失敗する' do + @gp.picture_id = 0 + @gp.should_not be_valid + end + end + context 'zを検証するとき' do + it 'テストデータの確認' do + @gp.z = 1 + @gp.should be_valid + end + it 'nullなら失敗する' do + @gp.z = nil + @gp.should_not be_valid + end + it '数値でなければ失敗する' do + @gp.z = 'a' + @gp.should_not be_valid + end + it '負なら失敗する' do + @gp.z = -1 + @gp.should_not be_valid + end + it '負なら失敗する' do + @gp.z = 0 + @gp.should_not be_valid + end + end + end + describe '一覧取得に於いて' do + before do + @gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id + end + context 'page補正について' do + it '文字列から数値に変換される' do + GroundPicture.page('8').should eq 8 + end + it 'nilの場合は1になる' do + GroundPicture.page().should eq 1 + end + it '0以下の場合は1になる' do + GroundPicture.page('0').should eq 1 + end + end + context 'page_size補正について' do + it '文字列から数値に変換される' do + GroundPicture.page_size('7').should eq 7 + end + it 'nilの場合はGroundPicture.default_page_sizeになる' do + GroundPicture.page_size().should eq GroundPicture.default_page_size + end + it '0以下の場合はGroundPicture.default_page_sizeになる' do + GroundPicture.page_size('0').should eq GroundPicture.default_page_size + end + it 'GroundPicture.max_page_sizeを超えた場合はGroundPicture.max_page_sizeになる' do + GroundPicture.page_size('1000').should eq GroundPicture.max_page_size + end + end + it 'リストを返す' do + pl = GroundPicture.list + pl.should eq [@gp] + end + it '時系列で並んでいる' do + npl = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id, :z => 2, :updated_at => Time.now + 100 + pl = GroundPicture.list + pl.should eq [npl, @gp] + end + it '非公開のコマの景色は含まない' do + hpl = FactoryGirl.create :panel, :author_id => @author.id, :publish => 0 + npl = FactoryGirl.create :ground_picture, :panel_id => hpl.id, :picture_id => @p.id, :updated_at => Time.now + 100 + pl = GroundPicture.list + pl.should eq [@gp] + end + context 'DBに5件あって1ページの件数を2件に変えたとして' do + before do + @npl2 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 1, :picture_id => @p.id, :updated_at => Time.now + 100 + @npl3 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 2, :picture_id => @p.id, :updated_at => Time.now + 200 + @npl4 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 3, :picture_id => @p.id, :updated_at => Time.now + 300 + @npl5 = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :z => 4, :picture_id => @p.id, :updated_at => Time.now + 400 + GroundPicture.stub(:default_page_size).and_return(2) + end + it '通常は2件を返す' do + pl = GroundPicture.list + pl.should have(2).items + end + it 'page=1なら末尾2件を返す' do + #時系列で並んでいる + pl = GroundPicture.list( {}, 1) + pl.should eq [@npl5, @npl4] + end + it 'page=2なら中間2件を返す' do + pl = GroundPicture.list({}, 2) + pl.should eq [@npl3, @npl2] + end + it 'page=3なら先頭1件を返す' do + pl = GroundPicture.list({}, 3) + pl.should eq [@gp] + end + end + end + describe 'list関連テーブルプションに於いて' do + it 'includeキーを含んでいる' do + r = GroundPicture.list_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = GroundPicture.list_opt[:include] + r.should have(2).items + end + it 'コマを含んでいる' do + r = GroundPicture.list_opt[:include] + r.has_key?(:panel).should be_true + end + it 'コマは作家を含んでいる' do + r = GroundPicture.list_opt[:include] + r[:panel].has_key?(:author).should be_true + end + it '実素材を含んでいる' do + r = GroundPicture.list_opt[:include] + r.has_key?(:picture).should be_true + end + it '実素材は絵師を含んでいる' do + r = GroundPicture.list_opt[:include] + r[:picture].has_key?(:artist).should be_true + end + it '実素材はライセンスを含んでいる' do + r = GroundPicture.list_opt[:include] + r[:picture].has_key?(:license).should be_true + end + end + describe 'json一覧出力オプションに於いて' do + it 'includeキーを含んでいる' do + r = GroundPicture.list_json_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = GroundPicture.list_json_opt[:include] + r.should have(2).items + end + it 'コマを含んでいる' do + r = GroundPicture.list_json_opt[:include] + r.has_key?(:panel).should be_true + end + it 'コマは作家を含んでいる' do + r = GroundPicture.list_json_opt[:include] + r[:panel].has_key?(:author).should be_true + end + it '実素材を含んでいる' do + r = GroundPicture.list_json_opt[:include] + r.has_key?(:picture).should be_true + end + it '実素材は絵師を含んでいる' do + r = GroundPicture.list_json_opt[:include] + r[:picture].has_key?(:artist).should be_true + end + it '実素材はライセンスを含んでいる' do + r = GroundPicture.list_json_opt[:include] + r[:picture].has_key?(:license).should be_true + end + end + + describe '自分のコマで使った景色画像一覧取得に於いて' do + before do + @gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id + end + it 'リストを返す' do + pl = GroundPicture.mylist @author + pl.should eq [@gp] + end + it '時系列で並んでいる' do + npl = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id, :z => 2, :updated_at => Time.now + 100 + pl = GroundPicture.mylist @author + pl.should eq [npl, @gp] + end + it '他人のコマの景色は公開でも含まない' do + hpl = FactoryGirl.create :panel, :author_id => @other_author.id, :publish => 1 + npl = FactoryGirl.create :ground_picture, :panel_id => hpl.id, :picture_id => @p.id + pl = GroundPicture.mylist @author + pl.should eq [@gp] + end + end + +end diff --git a/spec/models/original_picture_spec.rb b/spec/models/original_picture_spec.rb index cea37e9e..4314fd3f 100644 --- a/spec/models/original_picture_spec.rb +++ b/spec/models/original_picture_spec.rb @@ -1,4 +1,5 @@ # -*- encoding: utf-8 -*- +#原画 require 'spec_helper' describe OriginalPicture do @@ -141,6 +142,23 @@ describe OriginalPicture do @op.should_not be_valid end end + context 'md5を検証するとき' do + before do + @op = FactoryGirl.build :original_picture + end + it 'テストデータの確認' do + @op.md5 = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @op.should be_valid + end + it 'nullなら失敗する' do + @op.md5 = '' + @op.should_not be_valid + end + it '32文字以上なら失敗する' do + @op.md5 = 'a'*33 + @op.should_not be_valid + end + end end describe 'データ補充に於いて' do @@ -216,19 +234,41 @@ describe OriginalPicture do end end end + describe '単体出力オプションに於いて' do + it 'includeキーを含んでいる' do + r = OriginalPicture.show_include_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = OriginalPicture.show_include_opt[:include] + r.should have(2).items + end + it '素材を含んでいる' do + r = OriginalPicture.show_include_opt[:include] + r.has_key?(:resource_picture).should be_true + end + it '実素材を含んでいる' do + r = OriginalPicture.show_include_opt[:include] + r.has_key?(:pictures).should be_true + end + end describe 'json単体出力オプションに於いて' do - it 'includeキーを含んでいる' do - r = OriginalPicture.show_json_include_opt - r.has_key?(:include).should be_true - end - it '1つの項目を含んでいる' do - r = OriginalPicture.show_json_include_opt[:include] - r.should have(1).items - end - it '素材を含んでいる' do - r = OriginalPicture.show_json_include_opt[:include] - r.has_key?(:resource_picture).should be_true - end + it 'includeキーを含んでいる' do + r = OriginalPicture.show_json_include_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = OriginalPicture.show_json_include_opt[:include] + r.should have(2).items + end + it '素材を含んでいる' do + r = OriginalPicture.show_json_include_opt[:include] + r.has_key?(:resource_picture).should be_true + end + it '実素材を含んでいる' do + r = OriginalPicture.show_json_include_opt[:include] + r.has_key?(:pictures).should be_true + end end describe '一覧取得に於いて' do before do @@ -300,34 +340,66 @@ describe OriginalPicture do end end end - describe 'list関連テーブルプションに於いて' do - it 'includeキーを含んでいる' do - r = OriginalPicture.list_opt - r.has_key?(:include).should be_true - end - it '1つの項目を含んでいる' do - r = OriginalPicture.list_opt[:include] - r.should have(1).items - end - it '素材を含んでいる' do - r = OriginalPicture.list_opt[:include] - r.has_key?(:resource_picture).should be_true - end + describe 'list関連テーブルプションに於いて' do + it 'includeキーを含んでいる' do + r = OriginalPicture.list_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = OriginalPicture.list_opt[:include] + r.should have(2).items + end + it '素材を含んでいる' do + r = OriginalPicture.list_opt[:include] + r.has_key?(:resource_picture).should be_true + end + it '実素材を含んでいる' do + r = OriginalPicture.list_opt[:include] + r.has_key?(:pictures).should be_true + end + end + describe 'json一覧出力オプションに於いて' do + it 'includeキーを含んでいる' do + r = OriginalPicture.list_json_opt + r.has_key?(:include).should be_true + end + it '2つの項目を含んでいる' do + r = OriginalPicture.list_json_opt[:include] + r.should have(2).items + end + it '素材を含んでいる' do + r = OriginalPicture.list_json_opt[:include] + r.has_key?(:resource_picture).should be_true + end + it '実素材を含んでいる' do + r = OriginalPicture.list_json_opt[:include] + r.has_key?(:pictures).should be_true + end + end + describe '更新履歴一覧取得に於いて' do + before do + @op = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 0, + :original_picture_id => @op.id + @op2 = FactoryGirl.create :original_picture, :artist_id => @artist.id + end + it 'リストを返す' do + r = @op.history + r.should eq [@p] + end + it '他の原画の実素材は含んでいない' do + @p2 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 0, + :original_picture_id => @op2.id + r = @op.history + r.should eq [@p] + end + it 'revisionで並んでいる' do + @p2 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 1, + :original_picture_id => @op.id + r = @op.history + r.should eq [@p2, @p] + end end - describe 'json一覧出力オプションに於いて' do - it 'includeキーを含んでいる' do - r = OriginalPicture.list_json_opt - r.has_key?(:include).should be_true - end - it '1つの項目を含んでいる' do - r = OriginalPicture.list_json_opt[:include] - r.should have(1).items - end - it '素材を含んでいる' do - r = OriginalPicture.list_json_opt[:include] - r.has_key?(:resource_picture).should be_true - end - end describe 'RMagick変換に於いて' do before do @op = FactoryGirl.build :original_picture, :artist_id => @artist.id @@ -375,36 +447,36 @@ describe OriginalPicture do #すべての処理が正常パターンで通過すれば、一番深い分岐まで通る。 #それで外部のメソッド呼び出しだけに着目してテストする。 OriginalPicture.any_instance.stub(:data_to_mgk).with(any_args).and_return(Mgk.new) - OriginalPicture.any_instance.stub(:save).with(any_args).and_return(true) + OriginalPicture.any_instance.stub(:save).with(any_args).and_return(true) PictureIO::LocalPicture.any_instance.stub(:put).with(any_args).and_return(true) end it 'RMagick変換を依頼している' do OriginalPicture.any_instance.should_receive(:data_to_mgk).exactly(1) - @op.store 'bindata', @artist + @op.store 'bindata', @artist end it '自身に属性をセットしている' do OriginalPicture.any_instance.should_receive(:attributes=).exactly(1) - @op.store 'bindata', @artist + @op.store 'bindata', @artist end it '自身が保存されている' do - OriginalPicture.any_instance.should_receive(:save).exactly(1) - @op.store 'bindata', @artist + OriginalPicture.any_instance.should_receive(:save).exactly(1) + @op.store 'bindata', @artist end it 'PictureIoに画像データの保存を依頼している' do PictureIO::LocalPicture.any_instance.should_receive(:put).with(any_args).exactly(1) - @op.store 'bindata', @artist + @op.store 'bindata', @artist end end context 'つつがなく終わるとき' do before do #すべての処理を正常パターンで通過させ、保存機能をチェックする。 OriginalPicture.any_instance.stub(:data_to_mgk).with(any_args).and_return(Mgk.new) -# OriginalPicture.any_instance.stub(:save).with(any_args).and_return(true) +# OriginalPicture.any_instance.stub(:save).with(any_args).and_return(true) PictureIO::LocalPicture.any_instance.stub(:put).with(any_args).and_return(true) end it '自身に属性をセットしている' do lambda { - @op.store 'bindata', @artist + @op.store 'bindata', @artist }.should change @op, :filesize end it '原画モデルが作成されている' do @@ -414,10 +486,10 @@ describe OriginalPicture do end it '原画が保存されている' do @op.store 'bindata', @artist - OriginalPicture.find(@op).should_not be_nil + OriginalPicture.find(@op).should_not be_nil end it 'Trueを返す' do - @op.store('bindata', @artist).should eq true + @op.store('bindata', @artist).should eq true end end #以下から例外ケース。処理先頭から失敗させていく @@ -426,49 +498,49 @@ describe OriginalPicture do OriginalPicture.any_instance.stub(:data_to_mgk).with(any_args).and_return(false) end it 'falseを返す' do - @op.store('bindata', @artist).should be_false + @op.store('bindata', @artist).should be_false end it '自身の保存は呼ばれていない' do - OriginalPicture.any_instance.should_not_receive(:save) - @op.store('bindata', @artist) + OriginalPicture.any_instance.should_not_receive(:save) + @op.store('bindata', @artist) end end context '自身の保存に失敗したとき' do before do OriginalPicture.any_instance.stub(:data_to_mgk).with(any_args).and_return(Mgk.new) - OriginalPicture.any_instance.stub(:save).with(any_args).and_return(false) + OriginalPicture.any_instance.stub(:save).with(any_args).and_return(false) end it 'falseを返す' do - @op.store('bindata', @artist).should be_false + @op.store('bindata', @artist).should be_false end it '更新されていない' do @op.store('bindata', @artist) - @op.should be_a_new OriginalPicture + @op.should be_a_new OriginalPicture end it '原画の保存は呼ばれていない' do - PictureIO::LocalPicture.any_instance.should_not_receive(:put) + PictureIO::LocalPicture.any_instance.should_not_receive(:put) end end context '原画の保存に失敗したとき' do before do OriginalPicture.any_instance.stub(:data_to_mgk).with(any_args).and_return(Mgk.new) - OriginalPicture.any_instance.stub(:save).with(any_args).and_return(true) + OriginalPicture.any_instance.stub(:save).with(any_args).and_return(true) PictureIO::LocalPicture.any_instance.stub(:put).with(any_args).and_return(false) end it 'falseを返す' do - @op.store('bindata', @artist).should be_false + @op.store('bindata', @artist).should be_false end it '更新されていない' do - @op.store('bindata', @artist) - @op.should be_a_new OriginalPicture + @op.store('bindata', @artist) + @op.should be_a_new OriginalPicture end it '対象素材オブジェクトの保存は呼ばれていない' do - ResourcePicture.any_instance.should_not_receive(:save) - @op.store('bindata', @artist) + ResourcePicture.any_instance.should_not_receive(:save) + @op.store('bindata', @artist) end it '全体エラーメッセージがセットされている' do lambda { - @op.store('bindata', @artist) + @op.store('bindata', @artist) }.should change(@op.errors[:base], :count) end end diff --git a/spec/models/panel_color_spec.rb b/spec/models/panel_color_spec.rb new file mode 100644 index 00000000..7f0c5b5c --- /dev/null +++ b/spec/models/panel_color_spec.rb @@ -0,0 +1,217 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマの色背景 + +describe PanelColor do + before do + FactoryGirl.create :admin + @user = FactoryGirl.create( :user_yas) + @author = @user.author + @artist = FactoryGirl.create :artist_yas, :author_id => @author.id + @other_user = FactoryGirl.create( :user_yas) + @other_author = @other_user.author + @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 + it 'オーソドックスなデータなら通る' do + @pc.save + @pc.should be_valid + 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 + 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 + npl = FactoryGirl.create :panel_color, :panel_id => @panel.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 + @npl2 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 1, :updated_at => Time.now + 100 + @npl3 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 2, :updated_at => Time.now + 200 + @npl4 = FactoryGirl.create :panel_color, :panel_id => @panel.id, :z => 3, :updated_at => Time.now + 300 + @npl5 = 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 [@npl5, @npl4] + end + it 'page=2なら中間2件を返す' do + pl = PanelColor.list({}, 2) + pl.should eq [@npl3, @npl2] + end + it 'page=3なら先頭1件を返す' do + pl = PanelColor.list({}, 3) + pl.should eq [@pc] + end + end + end + describe 'list関連テーブルプションに於いて' 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 + it 'includeキーを含んでいる' do + r = PanelColor.list_json_opt + r.has_key?(:include).should be_true + end + it '1つの項目を含んでいる' do + r = PanelColor.list_json_opt[:include] + r.should have(1).items + end + it 'コマを含んでいる' do + r = PanelColor.list_json_opt[:include] + r.has_key?(:panel).should be_true + end + it 'コマは作家を含んでいる' do + r = PanelColor.list_json_opt[:include] + r[:panel].has_key?(:author).should be_true + end + end + + describe '自分のコマで使った色一覧取得に於いて' do + before do + @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id + 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 + end + +end diff --git a/spec/models/panel_picture_spec.rb b/spec/models/panel_picture_spec.rb index 09a3a474..f3a70a30 100644 --- a/spec/models/panel_picture_spec.rb +++ b/spec/models/panel_picture_spec.rb @@ -23,9 +23,12 @@ describe PanelPicture do before do @pp = FactoryGirl.build :panel_picture, :panel_id => @panel.id, :picture_id => @p.id, :width => @p.width, :height => @p.height + Picture.any_instance.stub(:flag_reverse).with(any_args).and_return(0) + Picture.any_instance.stub(:flag_resize).with(any_args).and_return(0) + Picture.any_instance.stub(:flag_sync_vh).with(any_args).and_return(0) end it 'オーソドックスなデータなら通る' do - @pp.save! + @pp.save @pp.should be_valid end @@ -100,9 +103,6 @@ describe PanelPicture do end context 'widthを検証するとき' do before do - Picture.any_instance.stub(:flag_reverse).with(any_args).and_return(0) - Picture.any_instance.stub(:flag_resize).with(any_args).and_return(0) - Picture.any_instance.stub(:flag_sync_vh).with(any_args).and_return(0) end it 'テストデータの確認' do @pp.width = 1 @@ -122,7 +122,6 @@ describe PanelPicture do end context '反転許可のとき' do before do - Picture.any_instance.stub(:flag_reverse).with(any_args).and_return(0) end it '負でも通る' do @pp.width = -1 @@ -140,7 +139,6 @@ describe PanelPicture do end context 'サイズ変更許可のとき' do before do - Picture.any_instance.stub(:flag_resize).with(any_args).and_return(0) end it '実素材のサイズと違っても通る' do @pp.width = @p.width-1 @@ -158,7 +156,6 @@ describe PanelPicture do end context '縦横比変更許可のとき' do before do - Picture.any_instance.stub(:flag_sync_vh).with(any_args).and_return(0) end it '実素材の縦横比と違っても通る' do @pp.width = @p.width / 2 @@ -177,9 +174,6 @@ describe PanelPicture do end context 'heightを検証するとき' do before do - Picture.any_instance.stub(:flag_reverse).with(any_args).and_return(0) - Picture.any_instance.stub(:flag_resize).with(any_args).and_return(0) - Picture.any_instance.stub(:flag_sync_vh).with(any_args).and_return(0) end it 'テストデータの確認' do @pp.height = '1' @@ -203,7 +197,6 @@ describe PanelPicture do end context '反転許可のとき' do before do - Picture.any_instance.stub(:flag_reverse).with(any_args).and_return(0) end it '負でも通る' do @pp.height = -1 @@ -221,7 +214,6 @@ describe PanelPicture do end context 'サイズ変更許可のとき' do before do - Picture.any_instance.stub(:flag_resize).with(any_args).and_return(0) end it '実素材のサイズと違っても通る' do @pp.height = @p.height-1 @@ -239,7 +231,6 @@ describe PanelPicture do end context '縦横比変更許可のとき' do before do - Picture.any_instance.stub(:flag_sync_vh).with(any_args).and_return(0) end it '実素材の縦横比と違っても通る' do @pp.height = @p.height / 2 @@ -296,6 +287,24 @@ describe PanelPicture do @pp.should_not be_valid end end + context 'picture_idを検証するとき' do + it 'テストデータの確認' do + @pp.picture_id = @p.id + @pp.should be_valid + end + it 'nullなら失敗する' do + @pp.picture_id = nil + @pp.should_not be_valid + end + it '数値でなければ失敗する' do + @pp.picture_id = 'a' + @pp.should_not be_valid + end + it '存在する実素材でなければ失敗する' do + @pp.picture_id = 0 + @pp.should_not be_valid + end + end end describe '一覧取得に於いて' do before do diff --git a/spec/models/panel_spec.rb b/spec/models/panel_spec.rb index ba2a3860..ecf150a4 100644 --- a/spec/models/panel_spec.rb +++ b/spec/models/panel_spec.rb @@ -288,7 +288,7 @@ describe Panel do end end end - describe '単体取得に於いて' do + describe '編集取得に於いて' do before do @panel = FactoryGirl.create :panel, :author_id => @author.id end @@ -314,53 +314,69 @@ describe Panel do end end describe '関連テーブルプションに於いて' do - context 'オプションがないとき' do - it '3つの項目を含んでいる' do - r = Panel.show_include_opt - r.should have(3).items - end - it 'コマ絵を含んでいる' do + it '6つの項目を含んでいる' do + r = Panel.show_include_opt + r.should have(6).items + end + it 'コマ絵を含んでいる' do + r = Panel.show_include_opt + r.has_key?(:panel_pictures).should be_true + end + it 'コマ絵は実素材を含んでいる' do r = Panel.show_include_opt - r.has_key?(:panel_pictures).should be_true + r[:panel_pictures].has_key?(:picture).should be_true end - it 'コマ絵は実素材を含んでいる' do + it '実素材は絵師を含んでいる' do r = Panel.show_include_opt - r[:panel_pictures].has_key?(:picture).should be_true + r[:panel_pictures][:picture].has_key?(:artist).should be_true end - it '実素材は絵師を含んでいる' do - r = Panel.show_include_opt - r[:panel_pictures][:picture].has_key?(:artist).should be_true - end - it '実素材はライセンスを含んでいる' do - r = Panel.show_include_opt - r[:panel_pictures][:picture].has_key?(:license).should be_true - end - it 'フキダシを含んでいる' do + it '実素材はライセンスを含んでいる' do + r = Panel.show_include_opt + r[:panel_pictures][:picture].has_key?(:license).should be_true + end + it 'フキダシを含んでいる' do + r = Panel.show_include_opt + r.has_key?(:speech_balloons).should be_true + end + it 'フキダシはフキダシ枠を含んでいる' do + r = Panel.show_include_opt + r[:speech_balloons].has_key?(:balloons).should be_true + end + it 'フキダシはセリフを含んでいる' do r = Panel.show_include_opt - r.has_key?(:speech_balloons).should be_true + r[:speech_balloons].has_key?(:speeches).should be_true end - it 'フキダシはフキダシ枠を含んでいる' do + it '景色画像を含んでいる' do + r = Panel.show_include_opt + r.has_key?(:ground_pictures).should be_true + end + it '景色画像は実素材を含んでいる' do + r = Panel.show_include_opt + r[:ground_pictures].has_key?(:picture).should be_true + end + it '実素材は絵師を含んでいる' do r = Panel.show_include_opt - r[:speech_balloons].has_key?(:balloons).should be_true + r[:ground_pictures][:picture].has_key?(:artist).should be_true end - it 'フキダシはセリフを含んでいる' do + it '実素材はライセンスを含んでいる' do r = Panel.show_include_opt - r[:speech_balloons].has_key?(:speeches).should be_true + r[:ground_pictures][:picture].has_key?(:license).should be_true end - it '作家を含んでいる' do + it '間接色を含んでいる' do + r = Panel.show_include_opt + r.has_key?(:ground_colors).should be_true + end + it '間接色は色を含んでいる' do r = Panel.show_include_opt - r.has_key?(:author).should be_true + r[:ground_colors].has_key?(:color).should be_true end + it '景色を含んでいる' do + r = Panel.show_include_opt + r.has_key?(:panel_colors).should be_true end - context 'オプションで原画を含ませたとき' do - it '4つの項目を含んでいる' do - r = Panel.show_include_opt(:include => {:test => {}}) - r.should have(4).items - end - it 'testを含んでいる' do - r = Panel.show_include_opt(:include => {:test => {}}) - r.has_key?(:test).should be_true - end + it '作家を含んでいる' do + r = Panel.show_include_opt + r.has_key?(:author).should be_true end end describe 'json単体出力オプションに於いて' do @@ -368,9 +384,9 @@ describe Panel do r = Panel.show_json_include_opt r.has_key?(:include).should be_true end - it '3つの項目を含んでいる' do + it '6つの項目を含んでいる' do r = Panel.show_json_include_opt[:include] - r.should have(3).items + r.should have(6).items end it 'コマ絵を含んでいる' do r = Panel.show_json_include_opt[:include] @@ -389,17 +405,45 @@ describe Panel do r[:panel_pictures][:picture].has_key?(:license).should be_true end it 'フキダシを含んでいる' do - r = Panel.show_include_opt + r = Panel.show_json_include_opt[:include] r.has_key?(:speech_balloons).should be_true end it 'フキダシはフキダシ枠を含んでいる' do - r = Panel.show_include_opt + r = Panel.show_json_include_opt[:include] r[:speech_balloons].has_key?(:balloons).should be_true end it 'フキダシはセリフを含んでいる' do - r = Panel.show_include_opt + r = Panel.show_json_include_opt[:include] r[:speech_balloons].has_key?(:speeches).should be_true end + it '景色画像を含んでいる' do + r = Panel.show_json_include_opt[:include] + r.has_key?(:ground_pictures).should be_true + end + it '景色画像は実素材を含んでいる' do + r = Panel.show_json_include_opt[:include] + r[:ground_pictures].has_key?(:picture).should be_true + end + it '実素材は絵師を含んでいる' do + r = Panel.show_json_include_opt[:include] + r[:ground_pictures][:picture].has_key?(:artist).should be_true + end + it '実素材はライセンスを含んでいる' do + r = Panel.show_json_include_opt[:include] + r[:ground_pictures][:picture].has_key?(:license).should be_true + end + it '間接色を含んでいる' do + r = Panel.show_json_include_opt[:include] + r.has_key?(:ground_colors).should be_true + end + it '間接色は色を含んでいる' do + r = Panel.show_json_include_opt[:include] + r[:ground_colors].has_key?(:color).should be_true + end + it '景色を含んでいる' do + r = Panel.show_json_include_opt[:include] + r.has_key?(:panel_colors).should be_true + end it '作家を含んでいる' do r = Panel.show_json_include_opt[:include] r.has_key?(:author).should be_true @@ -480,9 +524,9 @@ describe Panel do r = Panel.list_opt r.has_key?(:include).should be_true end - it '3つの項目を含んでいる' do + it '6つの項目を含んでいる' do r = Panel.list_opt[:include] - r.should have(3).items + r.should have(6).items end it 'コマ絵を含んでいる' do r = Panel.list_opt[:include] @@ -501,17 +545,45 @@ describe Panel do r[:panel_pictures][:picture].has_key?(:license).should be_true end it 'フキダシを含んでいる' do - r = Panel.show_include_opt + r = Panel.list_opt[:include] r.has_key?(:speech_balloons).should be_true end it 'フキダシはフキダシ枠を含んでいる' do - r = Panel.show_include_opt + r = Panel.list_opt[:include] r[:speech_balloons].has_key?(:balloons).should be_true end it 'フキダシはセリフを含んでいる' do - r = Panel.show_include_opt + r = Panel.list_opt[:include] r[:speech_balloons].has_key?(:speeches).should be_true end + it '景色画像を含んでいる' do + r = Panel.list_opt[:include] + r.has_key?(:ground_pictures).should be_true + end + it '景色画像は実素材を含んでいる' do + r = Panel.list_opt[:include] + r[:ground_pictures].has_key?(:picture).should be_true + end + it '実素材は絵師を含んでいる' do + r = Panel.list_opt[:include] + r[:ground_pictures][:picture].has_key?(:artist).should be_true + end + it '実素材はライセンスを含んでいる' do + r = Panel.list_opt[:include] + r[:ground_pictures][:picture].has_key?(:license).should be_true + end + it '間接色を含んでいる' do + r = Panel.list_opt[:include] + r.has_key?(:ground_colors).should be_true + end + it '間接色は色を含んでいる' do + r = Panel.list_opt[:include] + r[:ground_colors].has_key?(:color).should be_true + end + it '景色を含んでいる' do + r = Panel.list_opt[:include] + r.has_key?(:panel_colors).should be_true + end it '作家を含んでいる' do r = Panel.list_opt[:include] r.has_key?(:author).should be_true @@ -522,9 +594,9 @@ describe Panel do r = Panel.list_json_opt r.has_key?(:include).should be_true end - it '3つの項目を含んでいる' do + it '6つの項目を含んでいる' do r = Panel.list_json_opt[:include] - r.should have(3).items + r.should have(6).items end it 'コマ絵を含んでいる' do r = Panel.list_json_opt[:include] @@ -543,17 +615,45 @@ describe Panel do r[:panel_pictures][:picture].has_key?(:license).should be_true end it 'フキダシを含んでいる' do - r = Panel.show_include_opt + r = Panel.list_json_opt[:include] r.has_key?(:speech_balloons).should be_true end it 'フキダシはフキダシ枠を含んでいる' do - r = Panel.show_include_opt + r = Panel.list_json_opt[:include] r[:speech_balloons].has_key?(:balloons).should be_true end it 'フキダシはセリフを含んでいる' do - r = Panel.show_include_opt + r = Panel.list_json_opt[:include] r[:speech_balloons].has_key?(:speeches).should be_true end + it '景色画像を含んでいる' do + r = Panel.list_json_opt[:include] + r.has_key?(:ground_pictures).should be_true + end + it '景色画像は実素材を含んでいる' do + r = Panel.list_json_opt[:include] + r[:ground_pictures].has_key?(:picture).should be_true + end + it '実素材は絵師を含んでいる' do + r = Panel.list_json_opt[:include] + r[:ground_pictures][:picture].has_key?(:artist).should be_true + end + it '実素材はライセンスを含んでいる' do + r = Panel.list_json_opt[:include] + r[:ground_pictures][:picture].has_key?(:license).should be_true + end + it '間接色を含んでいる' do + r = Panel.list_json_opt[:include] + r.has_key?(:ground_colors).should be_true + end + it '間接色は色を含んでいる' do + r = Panel.list_json_opt[:include] + r[:ground_colors].has_key?(:color).should be_true + end + it '景色を含んでいる' do + r = Panel.list_json_opt[:include] + r.has_key?(:panel_colors).should be_true + end it '作家を含んでいる' do r = Panel.list_json_opt[:include] r.has_key?(:author).should be_true diff --git a/spec/models/picture_spec.rb b/spec/models/picture_spec.rb index b1d55fae..7177bfc0 100644 --- a/spec/models/picture_spec.rb +++ b/spec/models/picture_spec.rb @@ -181,6 +181,23 @@ describe Picture do @p.should_not be_valid end end + context 'md5を検証するとき' do + before do + @p = FactoryGirl.build :picture + end + it 'テストデータの確認' do + @p.md5 = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @p.should be_valid + end + it 'nullなら失敗する' do + @p.md5 = '' + @p.should_not be_valid + end + it '32文字以上なら失敗する' do + @p.md5 = 'a'*33 + @p.should_not be_valid + end + end context 'license_idを検証するとき' do before do @p = FactoryGirl.build :picture, :original_picture_id => @op.id, :license_id => @license.id @@ -298,6 +315,7 @@ describe Picture do @p.height.should eq 265 @p.filesize.should eq 266 @p.artist_id.should eq @artist.id + @p.md5.should eq @rp.md5 @p.license_id.should eq @license.id @p.original_picture_id.should eq @op.id @p.artist_name.should eq 'tester' @@ -307,6 +325,118 @@ describe Picture do end end + describe 'md5重複リストに於いて' do + before do + @op = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 0, + :original_picture_id => @op.id, :md5 => 'a' * 32 + @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :picture_id => @p.id + @op2 = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p2 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 0, + :original_picture_id => @op2.id, :md5 => 'b' * 32 + @op3 = FactoryGirl.create :original_picture, :artist_id => @artist.id + end + it 'リストを返す' do + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.is_a?(Array).should be_true + end + it 'md5が違えば含まない' do + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.include?(@p2).should be_false + end + it '同一原画は含まない' do + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.empty?.should be_true + end + it '同一原画は旧版でも含まない' do + @p3 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 1, + :original_picture_id => @op.id, :md5 => 'a' * 32 + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.empty?.should be_true + end + it '他所の原画なら含む' do + @p3 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 1, + :original_picture_id => @op2.id, :md5 => 'a' * 32 + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.should eq [@p3] + end + it '他所の原画でもmd5が違えば含まない' do + @p3 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 1, + :original_picture_id => @op2.id, :md5 => 'c' * 32 + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.empty?.should be_true + end + it '更新日時順' do + @p3 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 1, + :original_picture_id => @op2.id, :md5 => 'a' * 32 + @p4 = FactoryGirl.create :picture, :artist_id => @artist.id, :license_id => @license.id, :revision => 1, + :original_picture_id => @op3.id, :md5 => 'a' * 32, :updated_at => Time.now + 100 + res = Picture.list_by_md5(@p.md5, @p.original_picture_id) + res.should eq [@p4, @p3] + end + end + + describe 'md5重複判定に於いて' do + before do + @op = FactoryGirl.create :original_picture, :artist_id => @artist.id + @op2 = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p = FactoryGirl.create :picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :revision => 0 + @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :picture_id => @p.id + end + context '同一原画以外に同じ値があるとき' do + before do + @p2 = FactoryGirl.create :picture, :artist_id => @artist.id, :original_picture_id => @op2.id, :license_id => @license.id + end + it 'trueを返す' do + res = Picture.exist_by_md5(@p.md5, @p.original_picture_id) + res.should be_true + end + end + context '同一原画以外に同じ値がないとき' do + it 'falseを返す' do + res = Picture.exist_by_md5(@p.md5, @p.original_picture_id) + res.should be_false + end + end + context '同一原画に同じ値があるとき' do + before do + @p2 = FactoryGirl.create :picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :revision => 1 + end + it 'falseを返す' do + res = Picture.exist_by_md5(@p.md5, @p.original_picture_id) + res.should be_false + end + end + end + + describe 'head判定に於いて' do + before do + end + context '自身とリンクした素材があるとき' do + before do + @op = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p = FactoryGirl.create :picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id + @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :picture_id => @p.id + end + it 'trueを返す' do + res = @p.head? + res.should be_true + end + end + context '自身とリンクした素材がないとき' do + before do + @op = FactoryGirl.create :original_picture, :artist_id => @artist.id + @p = FactoryGirl.create :picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :revision => 0 + @p2 = FactoryGirl.create :picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :revision => 1 + @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :original_picture_id => @op.id, :license_id => @license.id, :picture_id => @p2.id + end + it 'falseを返す' do + res = @p.head? + res.should be_false + end + end + end + describe '作成に於いて' do before do #RMagickのスタブをおいておく diff --git a/spec/models/resource_picture_spec.rb b/spec/models/resource_picture_spec.rb index 93bf1952..c8d377da 100644 --- a/spec/models/resource_picture_spec.rb +++ b/spec/models/resource_picture_spec.rb @@ -144,6 +144,23 @@ describe ResourcePicture do @rp.should_not be_valid end end + context 'md5を検証するとき' do + before do + @rp = FactoryGirl.build :picture + end + it 'テストデータの確認' do + @rp.md5 = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + @rp.should be_valid + end + it 'nullなら失敗する' do + @rp.md5 = '' + @rp.should_not be_valid + end + it '32文字以上なら失敗する' do + @rp.md5 = 'a'*33 + @rp.should_not be_valid + end + end context 'license_idを検証するとき' do it 'テストデータの確認' do @rp.license_id = @license.id @@ -440,6 +457,7 @@ describe ResourcePicture do @rp.width.should eq 264 @rp.height.should eq 265 @rp.filesize.should eq 266 + @rp.md5.should eq @op.md5 @rp.artist_id.should eq @artist.id end end @@ -682,7 +700,7 @@ describe ResourcePicture do ResourcePicture.stub(:png_to_gif).with(any_args).and_return(@gifmgk) end it '画像ファイルの作成・更新機能で画像を保存している' do - ResourcePicture.any_instance.stub(:filename).with(any_args).and_return('1.png') + ResourcePicture.any_instance.stub(:filename).with(any_args).and_return('1.png') ResourcePicture.any_instance.should_receive(:store_picture).with(@mgk, '1.png').exactly(1) res = @rp.store_picture_with_gif @mgk end @@ -696,7 +714,7 @@ describe ResourcePicture do end it '画像ファイルの作成・更新機能でgif画像を保存している' do #二回目の保存はgif変換の結果を渡す。 - ResourcePicture.any_instance.stub(:gifname).with(any_args).and_return('1.gif') + ResourcePicture.any_instance.stub(:gifname).with(any_args).and_return('1.gif') ResourcePicture.any_instance.should_receive(:store_picture).with(@gifmgk, '1.gif').exactly(1) res = @rp.store_picture_with_gif @mgk end @@ -766,8 +784,8 @@ describe ResourcePicture do end context 'gif画像の保存に失敗したとき' do before do - ResourcePicture.any_instance.stub(:filename).with(any_args).and_return('1.png') - ResourcePicture.any_instance.stub(:gifname).with(any_args).and_return('1.gif') + ResourcePicture.any_instance.stub(:filename).with(any_args).and_return('1.png') + ResourcePicture.any_instance.stub(:gifname).with(any_args).and_return('1.gif') @mgk = Mgk.new ResourcePicture.any_instance.stub(:store_picture).with(@mgk, '1.png').and_return(true) ResourcePicture.any_instance.stub(:to_gif?).with(any_args).and_return(true) @@ -821,20 +839,22 @@ describe ResourcePicture do #すべての処理を正常パターンで通過させ、保存機能をチェックする。 PictureIO.resource_picture_io.stub(:put).with(any_args).and_return(true) ResourcePicture.any_instance.stub(:flag_thumbnail).with(any_args).and_return(1) + ResourcePicture.any_instance.stub(:thumbnail).with(any_args).and_return('tmbdata') end it 'Trueを返す' do -# res = @rp.store_picture(Mgk.new, '1.gif') -# res.should be_true + res = @rp.store_picture(Mgk.new, '1.gif') + res.should be_true end end context '例外ケース' do before do ResourcePicture.any_instance.stub(:flag_thumbnail).with(any_args).and_return(1) + ResourcePicture.any_instance.stub(:thumbnail).with(any_args).and_return('tmbdata') PictureIO.resource_picture_io.stub(:put).with(any_args).and_return(false) end - it 'Falseを返す' do - # res = @rp.store_picture(Mgk.new, '1.gif') - # res.should be_false + it '画像の保存に失敗したならFalseを返す' do + res = @rp.store_picture(Mgk.new, '1.gif') + res.should be_false end end diff --git a/spec/models/story_spec.rb b/spec/models/story_spec.rb index 1ba54ce6..4301a689 100644 --- a/spec/models/story_spec.rb +++ b/spec/models/story_spec.rb @@ -160,7 +160,7 @@ describe Story do @story.own?(nil).should == false end end - describe '単体取得に於いて' do + describe '編集取得に於いて' do before do @comic = FactoryGirl.create :comic, :author_id => @author.id @panel = FactoryGirl.create :panel, :author_id => @author.id -- 2.11.0