From: yasushiito Date: Wed, 6 Aug 2014 23:44:13 +0000 (+0900) Subject: add test X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=65cd4fb912cd3ecd5772dc8581429c44550c941a add test --- diff --git a/Gemfile b/Gemfile index 79ddea3f..3e5920c7 100644 --- a/Gemfile +++ b/Gemfile @@ -71,6 +71,10 @@ end group :test do gem 'autotest' + gem 'spork' + gem 'guard' + gem 'guard-spork' + gem 'guard-rspec' gem 'webmock' gem 'rspec' gem 'rspec-rails' diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000..efa3a361 --- /dev/null +++ b/Guardfile @@ -0,0 +1,44 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do + watch('config/application.rb') + watch('config/environment.rb') + watch('config/environments/test.rb') + watch(%r{^config/initializers/.+\.rb$}) + watch('Gemfile.lock') + watch('spec/spec_helper.rb') { :rspec } + watch('test/test_helper.rb') { :test_unit } + watch(%r{features/support/}) { :cucumber } +end + +# Note: The cmd option is now required due to the increasing number of ways +# rspec may be run, below are examples of the most common uses. +# * bundler: 'bundle exec rspec' +# * bundler binstubs: 'bin/rspec' +# * spring: 'bin/rsspec' (This will use spring if running and you have +# installed the spring binstubs per the docs) +# * zeus: 'zeus rspec' (requires the server to be started separetly) +# * 'just' rspec: 'rspec' +guard :rspec, cmd: 'bundle exec rspec' do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } + + # Rails example + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch('config/routes.rb') { "spec/routing" } + watch('app/controllers/application_controller.rb') { "spec/controllers" } + watch('spec/rails_helper.rb') { "spec" } + + # Capybara features specs + watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } + + # Turnip features and steps + watch(%r{^spec/acceptance/(.+)\.feature$}) + watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } +end + diff --git a/app/assets/javascripts/work/controllers.js.coffee.erb b/app/assets/javascripts/work/controllers.js.coffee.erb index 58a4dca3..dfa08020 100644 --- a/app/assets/javascripts/work/controllers.js.coffee.erb +++ b/app/assets/javascripts/work/controllers.js.coffee.erb @@ -206,9 +206,6 @@ by_story: { type: 'list', }, - by_author: { - type: 'list', - }, show: { type: 'show', }, @@ -224,9 +221,6 @@ count_by_story: { type: 'count', }, - count_by_author: { - type: 'count', - }, new: { type: 'new', }, diff --git a/app/assets/javascripts/work/models.js.coffee.erb b/app/assets/javascripts/work/models.js.coffee.erb index 58a9cb45..4ef7b263 100644 --- a/app/assets/javascripts/work/models.js.coffee.erb +++ b/app/assets/javascripts/work/models.js.coffee.erb @@ -146,13 +146,6 @@ min: 0, } }, - author_id: { - type: 'number', - rules : { - required: true, - number: true, - } - }, }, }, comic: { @@ -237,18 +230,13 @@ min: 0, } }, - author_id: { - type: 'number', - rules : { - required: true, - number: true, - } - }, }, }, story: { associations: { belongs_to: { + author: { + }, }, has_many: { comic_stories: { @@ -336,13 +324,6 @@ min: 0, } }, - author_id: { - type: 'number', - rules : { - required: true, - number: true, - } - }, }, }, sheet: { @@ -534,7 +515,7 @@ source: { type: 'magic_number', args: { - select_item_name: 'panel_visible_items', + select_item_name: 'panel_publish_items', }, }, }, @@ -1716,7 +1697,7 @@ required: true, } }, - author_id: { + user_id: { type: 'number', rules : { required: true, diff --git a/app/assets/javascripts/work/system_resources.js.coffee.erb b/app/assets/javascripts/work/system_resources.js.coffee.erb index c6e52bc5..08d4e824 100644 --- a/app/assets/javascripts/work/system_resources.js.coffee.erb +++ b/app/assets/javascripts/work/system_resources.js.coffee.erb @@ -52,9 +52,9 @@ ['select_items.sheet.visible.private', 0], ['select_items.sheet.visible.public', 1], ], - panel_visible_items: [ - ['select_items.panel.visible.private', 0], - ['select_items.panel.visible.public', 1], + panel_publish_items: [ + ['select_items.panel.publish.private', 0], + ['select_items.panel.publish.public', 1], ], ground_picture_repeat_items: [ ['select_items.ground_pictures.repeat.repeat', 0], diff --git a/public/manifest.json b/public/manifest.json index ffbb8b7a..734953fe 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -231,6 +231,9 @@ }, "edit": { "type": "edit" + }, + "destroy": { + "type": "destroy" } } }, @@ -406,9 +409,6 @@ "by_story": { "type": "list" }, - "by_author": { - "type": "list" - }, "show": { "type": "show" }, @@ -424,9 +424,6 @@ "count_by_story": { "type": "count" }, - "count_by_author": { - "type": "count" - }, "new": { "type": "new" }, @@ -1539,13 +1536,6 @@ "number": true, "min": 0 } - }, - "author_id": { - "type": "number", - "rules": { - "required": true, - "number": true - } } } }, @@ -1624,19 +1614,14 @@ "number": true, "min": 0 } - }, - "author_id": { - "type": "number", - "rules": { - "required": true, - "number": true - } } } }, "story": { "associations": { - "belongs_to": {}, + "belongs_to": { + "author": {} + }, "has_many": { "comic_stories": {}, "comics": { @@ -1715,13 +1700,6 @@ "number": true, "min": 0 } - }, - "author_id": { - "type": "number", - "rules": { - "required": true, - "number": true - } } } }, @@ -1899,7 +1877,7 @@ "source": { "type": "magic_number", "args": { - "select_item_name": "panel_visible_items" + "select_item_name": "panel_publish_items" } } }, @@ -3002,7 +2980,7 @@ "required": true } }, - "author_id": { + "user_id": { "type": "number", "rules": { "required": true, @@ -3917,13 +3895,13 @@ 1 ] ], - "panel_visible_items": [ + "panel_publish_items": [ [ - "select_items.panel.visible.private", + "select_items.panel.publish.private", 0 ], [ - "select_items.panel.visible.public", + "select_items.panel.publish.public", 1 ] ], diff --git a/spec/local_manifests.rb b/spec/local_manifests.rb new file mode 100644 index 00000000..b5d95918 --- /dev/null +++ b/spec/local_manifests.rb @@ -0,0 +1,2 @@ +fs = Dir.glob(File.dirname(__FILE__) + '/local_manifests/*_spec.rb').map {|f| f }.join(' ') + system 'rspec --drb ' + fs diff --git a/spec/local_manifests/artist_spec.rb b/spec/local_manifests/artist_spec.rb new file mode 100644 index 00000000..11e0a1f9 --- /dev/null +++ b/spec/local_manifests/artist_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#絵師 +require 'spec_helper' + +describe Artist do + include LocalManifestsMacros + before do + @model = Artist + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/author_spec.rb b/spec/local_manifests/author_spec.rb new file mode 100644 index 00000000..06aa8abc --- /dev/null +++ b/spec/local_manifests/author_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#作家 +require 'spec_helper' + +describe Author do + include LocalManifestsMacros + before do + @model = Author + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/balloon_spec.rb b/spec/local_manifests/balloon_spec.rb new file mode 100644 index 00000000..3a39dac2 --- /dev/null +++ b/spec/local_manifests/balloon_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#フキダシ枠 +describe Balloon do + include LocalManifestsMacros + before do + @model = Balloon + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/comic_spec.rb b/spec/local_manifests/comic_spec.rb new file mode 100644 index 00000000..45219a66 --- /dev/null +++ b/spec/local_manifests/comic_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コミック + +describe Comic do + include LocalManifestsMacros + before do + @model = Comic + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/comic_story_spec.rb b/spec/local_manifests/comic_story_spec.rb new file mode 100644 index 00000000..0ed6d94a --- /dev/null +++ b/spec/local_manifests/comic_story_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +# マニフェスト + +describe ComicStory do + include LocalManifestsMacros + before do + @model = ComicStory + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/folder_spec.rb b/spec/local_manifests/folder_spec.rb new file mode 100644 index 00000000..1d0b5dcf --- /dev/null +++ b/spec/local_manifests/folder_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +# マニフェスト + +describe Folder do + include LocalManifestsMacros + before do + @model = Folder + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/ground_color_spec.rb b/spec/local_manifests/ground_color_spec.rb new file mode 100644 index 00000000..8aa2fc35 --- /dev/null +++ b/spec/local_manifests/ground_color_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#色地 + +describe GroundColor do + include LocalManifestsMacros + before do + @model = GroundColor + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/ground_picture_spec.rb b/spec/local_manifests/ground_picture_spec.rb new file mode 100644 index 00000000..8bcc66cc --- /dev/null +++ b/spec/local_manifests/ground_picture_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#絵地 + +describe GroundPicture do + include LocalManifestsMacros + before do + @model = GroundPicture + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/license_group_spec.rb b/spec/local_manifests/license_group_spec.rb new file mode 100644 index 00000000..96df06e3 --- /dev/null +++ b/spec/local_manifests/license_group_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#ライセンスグループ +require 'spec_helper' + +describe LicenseGroup do + include LocalManifestsMacros + before do + @model = LicenseGroup + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/license_spec.rb b/spec/local_manifests/license_spec.rb new file mode 100644 index 00000000..c8ade7b8 --- /dev/null +++ b/spec/local_manifests/license_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#ライセンス +require 'spec_helper' + +describe License do + include LocalManifestsMacros + before do + @model = License + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/original_picture_license_group_spec.rb b/spec/local_manifests/original_picture_license_group_spec.rb new file mode 100644 index 00000000..59e9712a --- /dev/null +++ b/spec/local_manifests/original_picture_license_group_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#原画ライセンスグループ +require 'spec_helper' + +describe OriginalPictureLicenseGroup do + include LocalManifestsMacros + before do + @model = OriginalPictureLicenseGroup + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/original_picture_spec.rb b/spec/local_manifests/original_picture_spec.rb new file mode 100644 index 00000000..97a1b64c --- /dev/null +++ b/spec/local_manifests/original_picture_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#原画 +require 'spec_helper' + +describe OriginalPicture do + include LocalManifestsMacros + before do + @model = OriginalPicture + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/panel_picture_spec.rb b/spec/local_manifests/panel_picture_spec.rb new file mode 100644 index 00000000..15a3cc20 --- /dev/null +++ b/spec/local_manifests/panel_picture_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマ絵 +describe PanelPicture do + include LocalManifestsMacros + before do + @model = PanelPicture + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/panel_spec.rb b/spec/local_manifests/panel_spec.rb new file mode 100644 index 00000000..2d2684a3 --- /dev/null +++ b/spec/local_manifests/panel_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマ +describe Panel do + include LocalManifestsMacros + before do + @model = Panel + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/picture_spec.rb b/spec/local_manifests/picture_spec.rb new file mode 100644 index 00000000..00e89f33 --- /dev/null +++ b/spec/local_manifests/picture_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#実素材 +require 'spec_helper' + +describe Picture do + include LocalManifestsMacros + before do + @model = Picture + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/resource_picture_spec.rb b/spec/local_manifests/resource_picture_spec.rb new file mode 100644 index 00000000..12bd0ebf --- /dev/null +++ b/spec/local_manifests/resource_picture_spec.rb @@ -0,0 +1,530 @@ +# -*- encoding: utf-8 -*- +#素材 +require 'spec_helper' + +describe ResourcePicture do + include LocalManifestsMacros + before do + @model = ResourcePicture + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end + diff --git a/spec/local_manifests/scroll_panel_spec.rb b/spec/local_manifests/scroll_panel_spec.rb new file mode 100644 index 00000000..14182ea2 --- /dev/null +++ b/spec/local_manifests/scroll_panel_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#スクコマ +describe ScrollPanel do + include LocalManifestsMacros + before do + @model = ScrollPanel + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/scroll_spec.rb b/spec/local_manifests/scroll_spec.rb index 6a431fab..03d95c0b 100644 --- a/spec/local_manifests/scroll_spec.rb +++ b/spec/local_manifests/scroll_spec.rb @@ -527,3 +527,4 @@ describe Scroll do end end + diff --git a/spec/local_manifests/sheet_panel_spec.rb b/spec/local_manifests/sheet_panel_spec.rb new file mode 100644 index 00000000..05655263 --- /dev/null +++ b/spec/local_manifests/sheet_panel_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#紙コマ +describe SheetPanel do + include LocalManifestsMacros + before do + @model = SheetPanel + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/sheet_spec.rb b/spec/local_manifests/sheet_spec.rb new file mode 100644 index 00000000..5bb51770 --- /dev/null +++ b/spec/local_manifests/sheet_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#用紙 + +describe Sheet do + include LocalManifestsMacros + before do + @model = Sheet + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/speech_balloon_spec.rb b/spec/local_manifests/speech_balloon_spec.rb new file mode 100644 index 00000000..fda55cda --- /dev/null +++ b/spec/local_manifests/speech_balloon_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#フキダシ + +describe SpeechBalloon do + include LocalManifestsMacros + before do + @model = SpeechBalloon + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/speech_balloon_template_spec.rb b/spec/local_manifests/speech_balloon_template_spec.rb new file mode 100644 index 00000000..042dc8da --- /dev/null +++ b/spec/local_manifests/speech_balloon_template_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#フキダシテンプレート +describe SpeechBalloonTemplate do + include LocalManifestsMacros + before do + @model = SpeechBalloonTemplate + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/speech_spec.rb b/spec/local_manifests/speech_spec.rb new file mode 100644 index 00000000..6dc2a23b --- /dev/null +++ b/spec/local_manifests/speech_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +#セリフ +require 'spec_helper' + +describe Speech do + include LocalManifestsMacros + before do + @model = Speech + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/story_sheet_spec.rb b/spec/local_manifests/story_sheet_spec.rb new file mode 100644 index 00000000..92440bad --- /dev/null +++ b/spec/local_manifests/story_sheet_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#スト紙 +describe StorySheet do + include LocalManifestsMacros + before do + @model = StorySheet + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/story_spec.rb b/spec/local_manifests/story_spec.rb new file mode 100644 index 00000000..5e688711 --- /dev/null +++ b/spec/local_manifests/story_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#ストーリー + +describe Story do + include LocalManifestsMacros + before do + @model = Story + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/system_picture_spec.rb b/spec/local_manifests/system_picture_spec.rb new file mode 100644 index 00000000..9332a278 --- /dev/null +++ b/spec/local_manifests/system_picture_spec.rb @@ -0,0 +1,528 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#システム画像 +describe SystemPicture do + include LocalManifestsMacros + before do + @model = SystemPicture + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/local_manifests/writing_format_spec.rb b/spec/local_manifests/writing_format_spec.rb new file mode 100644 index 00000000..8bbc6fcd --- /dev/null +++ b/spec/local_manifests/writing_format_spec.rb @@ -0,0 +1,529 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#スクロールマニフェスト + +describe WritingFormat do + include LocalManifestsMacros + before do + @model = WritingFormat + end + + describe 'ファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.filers[@model.item_name] + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.item_class).to eq @model + expect(@my_local_manifest.item_name).to eq @model.item_name + expect(@my_local_manifest.filer_name).to eq @model.item_name + end + describe 'symbolに於いて' do + before do + @symbol = @my_local_manifest.symbol + end + it 'defaultタイプのsymbolである' do + expect(@symbol.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@symbol.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @symbol.face + end + it 'imageタイプのfaceである' do + expect(@face.type).to eq 'image' + end + it 'マニフェストから設定を取り出している' do + expect(@face.url).to eq '/images/scroll.gif' + end + end + describe 'linkに於いて' do + before do + @link = @symbol.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'show' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/' + end + end + end + describe 'captionに於いて' do + before do + @caption = @my_local_manifest.caption + end + it 'defaultタイプのsymbolである' do + expect(@caption.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@caption.visible?).to be true + end + describe 'faceに於いて' do + before do + @face = @caption.face + end + it 'columnタイプのfaceである' do + expect(@face.type).to eq 'column' + end + it 'マニフェストから設定を取り出している' do + expect(@face.column_name).to eq 'title' + end + end + describe 'linkに於いて' do + before do + @link = @caption.link + end + it 'actionタイプのlinkである' do + expect(@link.type).to eq 'action' + end + it 'マニフェストから設定を取り出している' do + expect(@link.action_name).to eq 'play' + end + it 'サポート機能が動作している' do + expect(@link.action_path).to eq '/scrolls/play/' + end + end + end + describe 'summaryに於いて' do + before do + @summary = @my_local_manifest.summary + end + it 'templateタイプのsymbolである' do + expect(@summary.type).to eq 'template' + end + it 'マニフェストから設定を取り出している' do + expect(@summary.template_name).to eq 'summary' + end + end + describe 'iconに於いて' do + before do + @icon = @my_local_manifest.icon + end + it 'defaultタイプのsymbolである' do + expect(@icon.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@icon.visible?).to be true + end + end + describe 'dateに於いて' do + before do + @date = @my_local_manifest.date + end + it 'defaultタイプのsymbolである' do + expect(@date.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@date.visible?).to be true + end + end + describe 'editに於いて' do + before do + @edit = @my_local_manifest.edit + end + it 'defaultタイプのsymbolである' do + expect(@edit.type).to eq 'default' + end + it 'サポート機能が動作している' do + expect(@edit.visible?).to be true + end + end + end + + describe 'プロファイラーに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.profilers[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'columnsに於いて' do + before do + @columns = @my_local_manifest.columns + @names = ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + it 'これらのカラムが定義されている' do + set_columns? @columns, @names + end + describe 'titleに於いて' do + before do + @column = @columns['title'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'descriptionに於いて' do + before do + @column = @columns['description'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'visibleに於いて' do + before do + @column = @columns['visible'] + end + it 'sourceタイプのcolumnである' do + expect(@column.type).to eq 'source' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + describe 'author_idに於いて' do + before do + @column = @columns['author_id'] + end + it 'defaultタイプのcolumnである' do + expect(@column.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@column.item_name).to eq 'scroll' + end + end + end + describe 'column_namesに於いて' do + before do + @column_names = @my_local_manifest.column_names + end + it '数量が守られている' do + expect(@column_names.size).to eq 4 + 3 + end + it '順序が守られている' do + expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at'] + end + end + describe 'extend_settingsに於いて' do + before do + @extend_settings = @my_local_manifest.extend_settings + end + it '拡張カラムは無い' do + expect(@extend_settings).to be_empty + end + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it '無い' do + expect(@lists).to be_empty + end + end + describe 'associationsに於いて' do + before do + @associations = @my_local_manifest.associations + end + describe 'belongs_toに於いて' do + before do + @belongs_to = @associations.belongs_to + end + it 'これらの所属モデルを取り扱う' do + expect(@belongs_to.map {|a| a.name}).to eq ['author'] + end + describe 'authorに於いて' do + before do + @mani = @belongs_to[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'author' + expect(@mani.model_name).to eq 'author' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @associations.has_many + end + it 'これらの所持モデルを取り扱う' do + expect(@has_many.map {|a| a.table_name}).to eq ['scroll_panels', 'panels'] + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many[0] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'scroll_panels.by_scroll' + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panels.by_scrollに於いて' do + before do + @mani = @has_many[1] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.name).to eq 'panels.by_scroll' + expect(@mani.model_name).to eq 'panel' + expect(@mani.list_name).to eq 'by_scroll' + end + it 'サポート機能が動作している' do + expect(@mani.model).to eq Panel + end + end + end + end + end + + describe 'リストグループに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.item_name).to eq @model.item_name + end + describe 'listsに於いて' do + before do + @lists = @my_local_manifest.lists + end + it 'これらのリストを定義している' do + set_lists? @lists, ['public', 'private', 'by_author', 'by_panel'] + end + describe 'publicに於いて' do + before do + @mani = @lists['public'] + end + it 'マニフェストから設定を取り出している' do + expect(@mani.type).to eq 'public' + end + it 'マニフェストから設定を取り出している' do + expect(@mani.model).to eq Scroll + end + it 'サポート機能が動作している' do + expect(@mani.has_id?).to be nil + expect(@mani.pre_id?).to be true + expect(@mani.item_name).to eq @model.item_name + end + describe 'whereに於いて' do + before do + @where = @mani.where + end + it 'autoタイプである' do + expect(@where.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@where.item_name).to eq @model.item_name + expect(@where.list_name).to eq 'public' + expect(@where.model).to eq Scroll + end + it 'method_name' do + expect(@where.method_name).to eq 'public_list_where' + end + end + describe 'includesに於いて' do + before do + @includes = @mani.includes + end + it 'autoタイプである' do + expect(@includes.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@includes.item_name).to eq @model.item_name + expect(@includes.list_name).to eq 'public' + expect(@includes.model).to eq Scroll + end + it 'includes' do + expect(@includes.includes).to be_empty + end + end + describe 'orderに於いて' do + before do + @order = @mani.order + end + it 'autoタイプである' do + expect(@order.type).to eq 'auto' + end + it 'サポート機能が動作している' do + expect(@order.item_name).to eq @model.item_name + expect(@order.list_name).to eq 'public' + expect(@order.model).to eq Scroll + end + it 'order' do + expect(@order.order).to eq 'list_order' + end + end + end + end + end + + describe '入力フォームに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.forms[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.name).to eq @model.item_name + end + describe 'fieldsに於いて' do + before do + @fields = @my_local_manifest.fields + end + # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。 + it '数量が守られている' do + expect(@fields.size).to eq 5 + end + end + describe 'field_namesに於いて' do + before do + @field_names = @my_local_manifest.field_names + end + it '数量が守られている' do + expect(@field_names.size).to eq 5 + end + it '順序が守られている' do + expect(@field_names).to eq ['title', 'description', 'visible', 'id', 'author_id'] + end + end + # 処理順に並べられたフィールドのこと + # 本来fieldsでテストするべき内容だが、並び替えもテストしたいのでこちらで行う。 + describe 'ordered_fieldsに於いて' do + before do + @ordered_fields = @my_local_manifest.ordered_fields + @names = ['title', 'description', 'visible', 'id', 'author_id'] + end + it 'これらのフィールドを取り扱う' do + expect(@ordered_fields.map {|f| f.name }).to eq @names + end + describe 'titleに於いて' do + before do + @field = @ordered_fields[0] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'title' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'title' + expect(@field.model_name).to eq @model.item_name + end + describe 'labelに於いて' do + before do + @label = @field.label + end + it 'defaultタイプである' do + expect(@label.type).to eq 'default' + end + it 'マニフェストから設定を取り出している' do + expect(@label.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@label.form_name).to eq @model.item_name + expect(@label.field_name).to eq 'title' + expect(@label.model_name).to eq @model.item_name + expect(@label.column_name).to eq 'title' + end + end + describe 'tagに於いて' do + before do + @tag = @field.tag + end + it 'textタイプである' do + expect(@tag.type).to eq 'text' + end + it 'マニフェストから設定を取り出している' do + expect(@tag.options).to_not be_empty + expect(@tag.options['size']).to eq 20 + end + it 'サポート機能が動作している' do + expect(@tag.form_name).to eq @model.item_name + expect(@tag.field_name).to eq 'title' + end + end + end + describe 'descriptionに於いて' do + before do + @field = @ordered_fields[1] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'description' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'description' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'visibleに於いて' do + before do + @field = @ordered_fields[2] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'visible' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'visible' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'idに於いて' do + before do + @field = @ordered_fields[3] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'id' + expect(@field.model_name).to eq @model.item_name + end + end + describe 'author_idに於いて' do + before do + @field = @ordered_fields[4] + end + it 'マニフェストから設定を取り出している' do + expect(@field.name).to eq 'author_id' + expect(@field.row_break).to be true + end + it 'サポート機能が動作している' do + expect(@field.part?).to be false + expect(@field.form_name).to eq @model.item_name + expect(@field.column_name).to eq 'author_id' + expect(@field.model_name).to eq @model.item_name + end + end + end + end + + describe 'bucketに於いて' do + before do + @my_local_manifest = LocalManifest.manifest.buckets[@model.item_name] + end + it 'マニフェストから設定を取り出している' do + expect(@my_local_manifest.members).to be_empty + expect(@my_local_manifest.form_field_names).to be_empty + end + it 'サポート機能が動作している' do + expect(@my_local_manifest.has_member?).to be false + expect(@my_local_manifest.item_name).to eq @model.item_name + end + end + +end diff --git a/spec/m.bat b/spec/m.bat new file mode 100644 index 00000000..40becdd2 --- /dev/null +++ b/spec/m.bat @@ -0,0 +1 @@ +rspec --drb C:/Sites/ss/spec/manifests/artist_spec.rb C:/Sites/ss/spec/manifests/author_spec.rb C:/Sites/ss/spec/manifests/balloon_spec.rb C:/Sites/ss/spec/manifests/comic_spec.rb C:/Sites/ss/spec/manifests/comic_story_spec.rb C:/Sites/ss/spec/manifests/folder_spec.rb C:/Sites/ss/spec/manifests/ground_color_spec.rb C:/Sites/ss/spec/manifests/ground_picture_spec.rb C:/Sites/ss/spec/manifests/license_group_spec.rb C:/Sites/ss/spec/manifests/license_spec.rb C:/Sites/ss/spec/manifests/original_picture_license_group_spec.rb C:/Sites/ss/spec/manifests/original_picture_spec.rb C:/Sites/ss/spec/manifests/panel_picture_spec.rb C:/Sites/ss/spec/manifests/panel_spec.rb C:/Sites/ss/spec/manifests/picture_spec.rb C:/Sites/ss/spec/manifests/resource_picture_spec.rb C:/Sites/ss/spec/manifests/scroll_panel_spec.rb C:/Sites/ss/spec/manifests/scroll_spec.rb C:/Sites/ss/spec/manifests/sheet_panel_spec.rb C:/Sites/ss/spec/manifests/sheet_spec.rb C:/Sites/ss/spec/manifests/speech_balloon_spec.rb C:/Sites/ss/spec/manifests/speech_balloon_template_spec.rb C:/Sites/ss/spec/manifests/speech_spec.rb C:/Sites/ss/spec/manifests/story_sheet_spec.rb C:/Sites/ss/spec/manifests/story_spec.rb C:/Sites/ss/spec/manifests/system_picture_spec.rb C:/Sites/ss/spec/manifests/writing_format_spec.rb diff --git a/spec/manifests.rb b/spec/manifests.rb new file mode 100644 index 00000000..a39cfd66 --- /dev/null +++ b/spec/manifests.rb @@ -0,0 +1,3 @@ +# -*- encoding: utf-8 -*- +fs = Dir.glob(File.dirname(__FILE__) + '/manifests/*_spec.rb').map {|f| f }.join(' ') +puts 'rspec --drb ' + fs diff --git a/spec/manifests/artist_spec.rb b/spec/manifests/artist_spec.rb new file mode 100644 index 00000000..87f6ed94 --- /dev/null +++ b/spec/manifests/artist_spec.rb @@ -0,0 +1,212 @@ +# -*- encoding: utf-8 -*- +#絵師 +require 'spec_helper' + +describe Artist do + include ManifestsMacros + before do + @model = Artist + end + + describe 'ペタナイズに於いて' do + it 'オーナーである' do + expect(@model.ancestors.include?(Peta::Owner)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it '絵師のためのコントローラである' do + expect(@model.item_name).to eq 'artist' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'show', + 'count', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # 絵師の公開リストを返すように定義している + set_list_action? @action, 'artist', 'public' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #絵師の公開リストのカウントを返すように定義している + set_list_action? @action, 'artist', 'public' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'artist' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'artist' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'artist' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'artist' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'artist' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'artist' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'artists' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = [] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['resource_pictures'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'resource_picturesに於いて' do + before do + @mani = @has_many['resource_pictures'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'resource_picture' + expect(@mani.foreign_key).to eq 'artist_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ResourcePicture + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'name', 'user_id', + 'created_at', 'updated_at'] + end + describe 'nameに於いて' do + before do + @attribute = @attributes['name'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'user_idに於いて' do + before do + @attribute = @attributes['user_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/author_spec.rb b/spec/manifests/author_spec.rb new file mode 100644 index 00000000..b4fbad5a --- /dev/null +++ b/spec/manifests/author_spec.rb @@ -0,0 +1,276 @@ +# -*- encoding: utf-8 -*- +#作家 +require 'spec_helper' + +describe Author do + include ManifestsMacros + before do + @model = Author + end + + describe 'ペタナイズに於いて' do + it 'オーナーである' do + expect(@model.ancestors.include?(Peta::Owner)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it '作家のためのコントローラである' do + expect(@model.item_name).to eq 'author' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'show', + 'count', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # 作家の公開リストを返すように定義している + set_list_action? @action, 'author', 'public' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #作家の公開リストのカウントを返すように定義している + set_list_action? @action, 'author', 'public' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'author' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'author' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'author' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'author' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'author' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'author' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'authors' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = [] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scrolls', 'comics', 'stories', 'sheets', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scrollsに於いて' do + before do + @mani = @has_many['scrolls'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll' + expect(@mani.foreign_key).to eq 'author_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq Scroll + end + end + describe 'comicsに於いて' do + before do + @mani = @has_many['comics'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'comic' + expect(@mani.foreign_key).to eq 'author_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq Comic + end + end + describe 'storiesに於いて' do + before do + @mani = @has_many['stories'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'story' + expect(@mani.foreign_key).to eq 'author_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq Story + end + end + describe 'sheetsに於いて' do + before do + @mani = @has_many['sheets'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'sheet' + expect(@mani.foreign_key).to eq 'author_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq Sheet + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'author_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'name', 'user_id', + 'created_at', 'updated_at'] + end + describe 'nameに於いて' do + before do + @attribute = @attributes['name'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['user_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/balloon_spec.rb b/spec/manifests/balloon_spec.rb new file mode 100644 index 00000000..91b36c04 --- /dev/null +++ b/spec/manifests/balloon_spec.rb @@ -0,0 +1,301 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#フキダシ枠 +describe Balloon do + include ManifestsMacros + before do + @model = Balloon + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/comic_spec.rb b/spec/manifests/comic_spec.rb new file mode 100644 index 00000000..69ba69c3 --- /dev/null +++ b/spec/manifests/comic_spec.rb @@ -0,0 +1,310 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コミック + +describe Comic do + include ManifestsMacros + before do + @model = Comic + end + + describe 'ペタナイズに於いて' do + it 'コミストを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'コミックのためのコントローラである' do + expect(@model.item_name).to eq 'comic' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_story', 'play', 'show', + 'count', 'count_by_author', 'count_by_story', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コミックの公開リストを返すように定義している + set_list_action? @action, 'comic', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コミックの作家フィルタリストを返すように定義している + set_list_action? @action, 'comic', 'by_author' + end + end + describe 'by_storyに於いて' do + before do + @action = @actions['by_story'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コミックのコマフィルタリストを返すように定義している + set_list_action? @action, 'comic', 'by_story' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #コミックの公開リストのカウントを返すように定義している + set_list_action? @action, 'comic', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コミックの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'comic', 'by_author' + end + end + describe 'count_by_storyに於いて' do + before do + @action = @actions['count_by_story'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コミックのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'comic', 'by_story' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'comic' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'comic' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'comic' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'comic' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'comic' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'comic' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'comics' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['comic_stories', 'stories'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'comic_storiesに於いて' do + before do + @mani = @has_many['comic_stories'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'comic_story' + expect(@mani.foreign_key).to eq 'comic_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ComicStory + end + end + describe 'storiesに於いて' do + before do + @mani = @has_many['stories'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'story' + expect(@mani.foreign_key).to eq 'comic_id' + expect(@mani.through).to eq 'comic_stories' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Story + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'comic_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/comic_story_spec.rb b/spec/manifests/comic_story_spec.rb new file mode 100644 index 00000000..d63bc7ad --- /dev/null +++ b/spec/manifests/comic_story_spec.rb @@ -0,0 +1,280 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +# コミスト + +describe ComicStory do + include ManifestsMacros + before do + @model = ComicStory + end + + describe 'ペタナイズに於いて' do + it 'コミックにストーリーを差し込むためのリーフである' do + expect(@model.ancestors.include?(Peta::Leaf)).to eq true + end + it '親モデルはコミックである' do + expect(@model.my_peta.parent_model_name).to eq 'comic' + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'コミストのためのコントローラである' do + expect(@model.item_name).to eq 'comic_story' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_comic', 'by_story', 'show', + 'count', 'count_by_comic', 'count_by_story', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コミストの公開リストを返すように定義している + set_list_action? @action, 'comic_story', 'public' + end + end + describe 'by_comicに於いて' do + before do + @action = @actions['by_comic'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コミストの作家フィルタリストを返すように定義している + set_list_action? @action, 'comic_story', 'by_comic' + end + end + describe 'by_storyに於いて' do + before do + @action = @actions['by_story'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コミストのコマフィルタリストを返すように定義している + set_list_action? @action, 'comic_story', 'by_story' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #コミストの公開リストのカウントを返すように定義している + set_list_action? @action, 'comic_story', 'public' + end + end + describe 'count_by_comicに於いて' do + before do + @action = @actions['count_by_comic'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コミストの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'comic_story', 'by_comic' + end + end + describe 'count_by_storyに於いて' do + before do + @action = @actions['count_by_story'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コミストのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'comic_story', 'by_story' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'comic_story' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'comic_story' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'comic_story' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'comic_story' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'comic_story' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'comic_story' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'comic_stories' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['comic', 'story'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'comicに於いて' do + before do + @mani = @belongs_to['comic'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'comic' + expect(@mani.id_column).to eq 'comic_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Comic + end + end + describe 'storyに於いて' do + before do + @mani = @belongs_to['story'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'story' + expect(@mani.id_column).to eq 'story_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Story + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'comic_id', 'story_id', 't', + 'created_at', 'updated_at'] + end + describe 'comic_idに於いて' do + before do + @attribute = @attributes['comic_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'story_idに於いて' do + before do + @attribute = @attributes['story_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/folder_spec.rb b/spec/manifests/folder_spec.rb new file mode 100644 index 00000000..b407db48 --- /dev/null +++ b/spec/manifests/folder_spec.rb @@ -0,0 +1,239 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +# フォルダ + +describe Folder do + include ManifestsMacros + before do + @model = Folder + end + + describe 'ペタナイズに於いて' do + it 'アイテムである' do + expect(@model.ancestors.include?(Peta::Item)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'フォルダのためのコントローラである' do + expect(@model.item_name).to eq 'folder' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['root', 'index', 'show', + 'count', + 'new', 'edit', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'rootに於いて' do + before do + @action = @actions['root'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # フォルダの公開リストを返すように定義している + set_list_action? @action, 'folder', 'public' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #フォルダの公開リストのカウントを返すように定義している + set_list_action? @action, 'folder', 'public' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'folder' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'folder' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'folder' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'folder' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'folders' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = [] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'name', 'controller_name', 'action_name', 'category_id', + 't', 'parent_id', 'lft', 'rgt', 'depth', + 'created_at', 'updated_at'] + end + describe 'nameに於いて' do + before do + @attribute = @attributes['name'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'controller_nameに於いて' do + before do + @attribute = @attributes['controller_name'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'action_nameに於いて' do + before do + @attribute = @attributes['action_name'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'category_idに於いて' do + before do + @attribute = @attributes['category_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'parent_idに於いて' do + before do + @attribute = @attributes['parent_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'lftに於いて' do + before do + @attribute = @attributes['lft'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'rgtに於いて' do + before do + @attribute = @attributes['rgt'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'depthに於いて' do + before do + @attribute = @attributes['depth'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/ground_color_spec.rb b/spec/manifests/ground_color_spec.rb new file mode 100644 index 00000000..fc9e716a --- /dev/null +++ b/spec/manifests/ground_color_spec.rb @@ -0,0 +1,278 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#色地 + +describe GroundColor do + include ManifestsMacros + before do + @model = GroundColor + end + + describe 'ペタナイズに於いて' do + it 'パネルの要素として利用されるエレメントである' do + expect(@model.ancestors.include?(Peta::Element)).to eq true + end + it '親モデルはパネルである' do + expect(@model.my_peta.parent_model_name).to eq 'panel' + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it '色地のためのコントローラである' do + expect(@model.item_name).to eq 'ground_color' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # 絵地の公開リストを返すように定義している + set_list_action? @action, 'ground_color', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # 絵地の作家フィルタリストを返すように定義している + set_list_action? @action, 'ground_color', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #絵地のコマフィルタリストを返すように定義している + set_list_action? @action, 'ground_color', 'by_panel' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #絵地の公開リストのカウントを返すように定義している + set_list_action? @action, 'ground_color', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # 絵地の作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'ground_color', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # 絵地のコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'ground_color', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'ground_color' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'ground_color' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'ground_color' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'ground_colors' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['panel'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'panelに於いて' do + before do + @mani = @belongs_to['panel'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.id_column).to eq 'panel_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Panel + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'panel_id', 'caption', 'code', 'orientation', 'xy', 'wh', + 'z', 't', + 'created_at', 'updated_at'] + end + describe 'panel_idに於いて' do + before do + @attribute = @attributes['panel_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'captionに於いて' do + before do + @attribute = @attributes['caption'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'codeに於いて' do + before do + @attribute = @attributes['code'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'orientationに於いて' do + before do + @attribute = @attributes['orientation'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'ground_color_orientation_items' + end + end + describe 'xyに於いて' do + before do + @attribute = @attributes['xy'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'whに於いて' do + before do + @attribute = @attributes['wh'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'zに於いて' do + before do + @attribute = @attributes['z'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/ground_picture_spec.rb b/spec/manifests/ground_picture_spec.rb new file mode 100644 index 00000000..7c0f8817 --- /dev/null +++ b/spec/manifests/ground_picture_spec.rb @@ -0,0 +1,278 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#絵地 + +describe GroundPicture do + include ManifestsMacros + before do + @model = GroundPicture + end + + describe 'ペタナイズに於いて' do + it 'パネルの要素として利用されるエレメントである' do + expect(@model.ancestors.include?(Peta::Element)).to eq true + end + it '親モデルはパネルである' do + expect(@model.my_peta.parent_model_name).to eq 'panel' + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it '絵地のためのコントローラである' do + expect(@model.item_name).to eq 'ground_picture' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # 絵地の公開リストを返すように定義している + set_list_action? @action, 'ground_picture', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # 絵地の作家フィルタリストを返すように定義している + set_list_action? @action, 'ground_picture', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #絵地のコマフィルタリストを返すように定義している + set_list_action? @action, 'ground_picture', 'by_panel' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #絵地の公開リストのカウントを返すように定義している + set_list_action? @action, 'ground_picture', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # 絵地の作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'ground_picture', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # 絵地のコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'ground_picture', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'ground_picture' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'ground_picture' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'ground_picture' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'ground_pictures' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['panel'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'panelに於いて' do + before do + @mani = @belongs_to['panel'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.id_column).to eq 'panel_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Panel + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'panel_id', 'picture_id', 'caption', 'repeat', 'x', 'y', + 'z', 't', + 'created_at', 'updated_at'] + end + describe 'panel_idに於いて' do + before do + @attribute = @attributes['panel_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'picture_idに於いて' do + before do + @attribute = @attributes['picture_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'captionに於いて' do + before do + @attribute = @attributes['caption'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'repeatに於いて' do + before do + @attribute = @attributes['repeat'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'ground_picture_repeat_items' + end + end + describe 'xに於いて' do + before do + @attribute = @attributes['x'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'yに於いて' do + before do + @attribute = @attributes['y'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'zに於いて' do + before do + @attribute = @attributes['z'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/license_group_spec.rb b/spec/manifests/license_group_spec.rb new file mode 100644 index 00000000..f20c5571 --- /dev/null +++ b/spec/manifests/license_group_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#ライセンスグループ +require 'spec_helper' + +describe LicenseGroup do + include ManifestsMacros + before do + @model = LicenseGroup + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/license_spec.rb b/spec/manifests/license_spec.rb new file mode 100644 index 00000000..cc30eeb2 --- /dev/null +++ b/spec/manifests/license_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#ライセンス +require 'spec_helper' + +describe License do + include ManifestsMacros + before do + @model = License + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/original_picture_license_group_spec.rb b/spec/manifests/original_picture_license_group_spec.rb new file mode 100644 index 00000000..b8e7b068 --- /dev/null +++ b/spec/manifests/original_picture_license_group_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#原画ライセンスグループ +require 'spec_helper' + +describe OriginalPictureLicenseGroup do + include ManifestsMacros + before do + @model = OriginalPictureLicenseGroup + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/original_picture_spec.rb b/spec/manifests/original_picture_spec.rb new file mode 100644 index 00000000..32f78848 --- /dev/null +++ b/spec/manifests/original_picture_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#原画 +require 'spec_helper' + +describe OriginalPicture do + include ManifestsMacros + before do + @model = OriginalPicture + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/panel_picture_spec.rb b/spec/manifests/panel_picture_spec.rb new file mode 100644 index 00000000..f09fc4ba --- /dev/null +++ b/spec/manifests/panel_picture_spec.rb @@ -0,0 +1,289 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマ絵 +describe PanelPicture do + include ManifestsMacros + before do + @model = PanelPicture + end + + describe 'ペタナイズに於いて' do + it 'パネルの要素として利用されるエレメントである' do + expect(@model.ancestors.include?(Peta::Element)).to eq true + end + it '親モデルはパネルである' do + expect(@model.my_peta.parent_model_name).to eq 'panel' + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'コマ絵のためのコントローラである' do + expect(@model.item_name).to eq 'panel_picture' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマ絵の公開リストを返すように定義している + set_list_action? @action, 'panel_picture', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマ絵の作家フィルタリストを返すように定義している + set_list_action? @action, 'panel_picture', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コマ絵のコマフィルタリストを返すように定義している + set_list_action? @action, 'panel_picture', 'by_panel' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #コマ絵の公開リストのカウントを返すように定義している + set_list_action? @action, 'panel_picture', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマ絵の作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'panel_picture', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマ絵のコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'panel_picture', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'panel_picture' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'panel_picture' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'panel_picture' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'panel_pictures' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['panel'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'panelに於いて' do + before do + @mani = @belongs_to['panel'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.id_column).to eq 'panel_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Panel + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'panel_id', 'picture_id', 'caption', 'x', 'y', 'width', 'height', + 'link', 'z', 't', + 'created_at', 'updated_at'] + end + describe 'panel_idに於いて' do + before do + @attribute = @attributes['panel_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'picture_idに於いて' do + before do + @attribute = @attributes['picture_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'captionに於いて' do + before do + @attribute = @attributes['caption'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'xに於いて' do + before do + @attribute = @attributes['x'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'yに於いて' do + before do + @attribute = @attributes['y'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'widthに於いて' do + before do + @attribute = @attributes['width'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'heightに於いて' do + before do + @attribute = @attributes['height'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'linkに於いて' do + before do + @attribute = @attributes['link'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'zに於いて' do + before do + @attribute = @attributes['z'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/panel_spec.rb b/spec/manifests/panel_spec.rb new file mode 100644 index 00000000..f6a9de0a --- /dev/null +++ b/spec/manifests/panel_spec.rb @@ -0,0 +1,471 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#コマ + +describe Panel do + include ManifestsMacros + before do + @model = Panel + end + + describe 'ペタナイズに於いて' do + it 'ルートである' do + expect(@model.ancestors.include?(Peta::Root)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'コマのためのコントローラである' do + expect(@model.item_name).to eq 'panel' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_scroll', 'by_sheet', 'by_speech_balloon_template', 'show', + 'count', 'count_by_author', 'count_by_scroll', 'count_by_sheet', 'count_by_speech_balloon_template', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマの公開リストを返すように定義している + set_list_action? @action, 'panel', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマの作家フィルタリストを返すように定義している + set_list_action? @action, 'panel', 'by_author' + end + end + describe 'by_scrollに於いて' do + before do + @action = @actions['by_scroll'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コマのコマフィルタリストを返すように定義している + set_list_action? @action, 'panel', 'by_scroll' + end + end + describe 'by_sheetに於いて' do + before do + @action = @actions['by_sheet'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コマのコマフィルタリストを返すように定義している + set_list_action? @action, 'panel', 'by_sheet' + end + end + describe 'by_speech_balloon_templateに於いて' do + before do + @action = @actions['by_speech_balloon_template'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コマのコマフィルタリストを返すように定義している + set_list_action? @action, 'panel', 'by_speech_balloon_template' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #コマの公開リストのカウントを返すように定義している + set_list_action? @action, 'panel', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'panel', 'by_author' + end + end + describe 'count_by_scrollに於いて' do + before do + @action = @actions['count_by_scroll'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'panel', 'by_scroll' + end + end + describe 'count_by_sheetに於いて' do + before do + @action = @actions['count_by_sheet'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'panel', 'by_sheet' + end + end + describe 'count_by_speech_balloon_templateに於いて' do + before do + @action = @actions['count_by_speech_balloon_template'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'panel', 'by_speech_balloon_template' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'panel' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'panel' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'panel' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'panel' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'panel' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'panel' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'panels' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'scrolls', 'sheet_panels', 'sheets', + 'panel_pictures', 'speech_balloons', 'ground_pictures', 'ground_colors'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'scrollsに於いて' do + before do + @mani = @has_many['scrolls'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Scroll + end + end + describe 'sheet_panelsに於いて' do + before do + @mani = @has_many['sheet_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'sheet_panel' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq SheetPanel + end + end + describe 'sheetsに於いて' do + before do + @mani = @has_many['sheets'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'sheet' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to eq 'sheet_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Sheet + end + end + describe 'panel_picturesに於いて' do + before do + @mani = @has_many['panel_pictures'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel_picture' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq PanelPicture + end + end + describe 'speech_balloonsに於いて' do + before do + @mani = @has_many['speech_balloons'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'speech_balloon' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq SpeechBalloon + end + end + describe 'ground_picturesに於いて' do + before do + @mani = @has_many['ground_pictures'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'ground_picture' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq GroundPicture + end + end + describe 'ground_colorsに於いて' do + before do + @mani = @has_many['ground_colors'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'ground_color' + expect(@mani.foreign_key).to eq 'panel_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq GroundColor + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'width', 'height', 'border', 'caption', 'publish', 'author_id', + 'created_at', 'updated_at'] + end + describe 'widthに於いて' do + before do + @attribute = @attributes['width'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'heightに於いて' do + before do + @attribute = @attributes['height'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'borderに於いて' do + before do + @attribute = @attributes['border'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'captionに於いて' do + before do + @attribute = @attributes['caption'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'publishに於いて' do + before do + @attribute = @attributes['publish'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'panel_publish_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/picture_spec.rb b/spec/manifests/picture_spec.rb new file mode 100644 index 00000000..bc7802e3 --- /dev/null +++ b/spec/manifests/picture_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#実素材 +require 'spec_helper' + +describe Picture do + include ManifestsMacros + before do + @model = Picture + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/resource_picture_spec.rb b/spec/manifests/resource_picture_spec.rb new file mode 100644 index 00000000..309fdd87 --- /dev/null +++ b/spec/manifests/resource_picture_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#素材 +require 'spec_helper' + +describe ResourcePicture do + include ManifestsMacros + before do + @model = ResourcePicture + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/scroll_panel_spec.rb b/spec/manifests/scroll_panel_spec.rb new file mode 100644 index 00000000..4182cc3d --- /dev/null +++ b/spec/manifests/scroll_panel_spec.rb @@ -0,0 +1,303 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#スクコマ +describe ScrollPanel do + include ManifestsMacros + before do + @model = ScrollPanel + end + + describe 'ペタナイズに於いて' do + it 'スクロールにコマを差し込むためのリーフである' do + expect(@model.ancestors.include?(Peta::Leaf)).to eq true + end + it '親モデルはスクロールである' do + expect(@model.my_peta.parent_model_name).to eq 'scroll' + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクコマのためのコントローラである' do + expect(@model.item_name).to eq 'scroll_panel' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'by_scroll', 'show', + 'count', 'count_by_author', 'count_by_panel', 'count_by_scroll', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクコマの公開リストを返すように定義している + set_list_action? @action, 'scroll_panel', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクコマの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll_panel', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクコマのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll_panel', 'by_panel' + end + end + describe 'by_scrollに於いて' do + before do + @action = @actions['by_scroll'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクコマの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll_panel', 'by_scroll' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクコマの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll_panel', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクコマの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll_panel', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクコマのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll_panel', 'by_panel' + end + end + describe 'count_by_scrollに於いて' do + before do + @action = @actions['count_by_scroll'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクコマのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll_panel', 'by_scroll' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll_panel' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll_panel' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll_panel' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll_panel' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll_panel' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll_panel' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scroll_panels' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['panel', 'scroll'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'panelに於いて' do + before do + @mani = @belongs_to['panel'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.id_column).to eq 'panel_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Panel + end + end + describe 'scrollに於いて' do + before do + @mani = @belongs_to['scroll'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll' + expect(@mani.id_column).to eq 'scroll_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Scroll + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'scroll_id', 'panel_id', 't', + 'created_at', 'updated_at'] + end + describe 'scroll_idに於いて' do + before do + @attribute = @attributes['scroll_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'panel_idに於いて' do + before do + @attribute = @attributes['panel_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/scroll_spec.rb b/spec/manifests/scroll_spec.rb index b9a8b9ee..b5763529 100644 --- a/spec/manifests/scroll_spec.rb +++ b/spec/manifests/scroll_spec.rb @@ -78,6 +78,14 @@ describe Scroll do set_list_action? @action, 'scroll', 'by_panel' end end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end describe 'countに於いて' do before do @action = @actions['count'] diff --git a/spec/manifests/sheet_panel_spec.rb b/spec/manifests/sheet_panel_spec.rb new file mode 100644 index 00000000..d3a7bd93 --- /dev/null +++ b/spec/manifests/sheet_panel_spec.rb @@ -0,0 +1,301 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#紙コマ +describe SheetPanel do + include ManifestsMacros + before do + @model = SheetPanel + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/sheet_spec.rb b/spec/manifests/sheet_spec.rb new file mode 100644 index 00000000..1ef6d52d --- /dev/null +++ b/spec/manifests/sheet_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#用紙 + +describe Sheet do + include ManifestsMacros + before do + @model = Sheet + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/speech_balloon_spec.rb b/spec/manifests/speech_balloon_spec.rb new file mode 100644 index 00000000..149767dd --- /dev/null +++ b/spec/manifests/speech_balloon_spec.rb @@ -0,0 +1,355 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#フキダシ + +describe SpeechBalloon do + include ManifestsMacros + before do + @model = SpeechBalloon + end + + describe 'ペタナイズに於いて' do + it 'パネルの要素として利用されるエレメントである' do + expect(@model.ancestors.include?(Peta::Element)).to eq true + end + it '親モデルはパネルである' do + expect(@model.my_peta.parent_model_name).to eq 'panel' + end + describe 'ブーストに於いて' do + before do + @boosts = @model.my_peta.boost + @boosts_names = ['speech_balloon_template'] + end + it 'これらのブーストが定義されている' do + set_boosts? @boosts, @boosts_names + end + describe 'フキダシテンプレートに於いて' do + before do + @mani = @boosts['speech_balloon_template'] + end + it 'フキダシテンプレート' do + expect(@mani.level).to eq 'post' + expect(@mani.template_name).to eq 'speech_balloon_template' + expect(@mani.column_name_for_template_module).to eq 'speech_balloon_template_module_name' + expect(@mani.settings_column_name).to eq 'speech_balloon_template_settings' + expect(@mani.foreign_key).to eq 'speech_balloon_template_id' + end + it 'フキダシテンプレート' do + expect(@mani.item_name_for_extend_model).to eq 'speech_balloon' + expect(@mani.setter_method_name).to eq 'speech_balloon_extend=' + expect(@mani.getter_method_name).to eq 'speech_balloon_extend' + expect(@mani.extend_model_class_name).to eq 'SpeechBalloon' + expect(@mani.extend_module_name).to eq 'SpeechBalloonModule' + end + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'コマ絵のためのコントローラである' do + expect(@model.item_name).to eq 'speech_balloon' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'by_speech_balloon_template', 'show', + 'count', 'count_by_author', 'count_by_panel', 'count_by_speech_balloon_template', + 'new', 'edit'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマ絵の公開リストを返すように定義している + set_list_action? @action, 'speech_balloon', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマ絵の作家フィルタリストを返すように定義している + set_list_action? @action, 'speech_balloon', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #コマ絵のコマフィルタリストを返すように定義している + set_list_action? @action, 'speech_balloon', 'by_panel' + end + end + describe 'by_speech_balloon_templateに於いて' do + before do + @action = @actions['by_speech_balloon_template'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # コマ絵のフキダシテンプレートフィルタリストを返すように定義している + set_list_action? @action, 'speech_balloon', 'by_speech_balloon_template' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #コマ絵の公開リストのカウントを返すように定義している + set_list_action? @action, 'speech_balloon', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマ絵の作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'speech_balloon', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマ絵のコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'speech_balloon', 'by_panel' + end + end + describe 'count_by_speech_balloon_templateに於いて' do + before do + @action = @actions['count_by_speech_balloon_template'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # コマ絵のフキダシテンプレートフィルタリストのカウントを返すように定義している + set_list_action? @action, 'speech_balloon', 'by_speech_balloon_template' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'speech_balloon' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'speech_balloon' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'speech_balloon' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'speech_balloons' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['panel', 'speech_balloon_template'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'panelに於いて' do + before do + @mani = @belongs_to['panel'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.id_column).to eq 'panel_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Panel + end + end + describe 'speech_balloon_templateに於いて' do + before do + @mani = @belongs_to['speech_balloon_template'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'speech_balloon_template' + expect(@mani.id_column).to eq 'speech_balloon_template_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq SpeechBalloonTemplate + end + end + end + describe 'has_oneに於いて' do + before do + @has_one = @model.my_manifest.associations.has_one + @names = ['balloon', 'speech'] + end + it 'これらのモデルを所持している' do + set_associations? @has_one, @names + end + describe 'balloonに於いて' do + before do + @mani = @has_one['balloon'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'balloon' + expect(@mani.foreign_key).to eq 'speech_balloon_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Balloon + end + end + describe 'speechに於いて' do + before do + @mani = @has_one['speech'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'speech' + expect(@mani.foreign_key).to eq 'speech_balloon_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Speech + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'panel_id', 'speech_balloon_template_id', 'speech_balloon_template_module_name', + 'caption', 'speech_balloon_template_settings', 'z', 't', + 'created_at', 'updated_at'] + end + describe 'panel_idに於いて' do + before do + @attribute = @attributes['panel_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'speech_balloon_template_idに於いて' do + before do + @attribute = @attributes['speech_balloon_template_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'speech_balloon_template_module_nameに於いて' do + before do + @attribute = @attributes['speech_balloon_template_module_name'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'captionに於いて' do + before do + @attribute = @attributes['caption'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'speech_balloon_template_settingsに於いて' do + before do + @attribute = @attributes['speech_balloon_template_settings'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'zに於いて' do + before do + @attribute = @attributes['z'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/speech_balloon_template_spec.rb b/spec/manifests/speech_balloon_template_spec.rb new file mode 100644 index 00000000..c3024f07 --- /dev/null +++ b/spec/manifests/speech_balloon_template_spec.rb @@ -0,0 +1,301 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#フキダシテンプレート +describe SpeechBalloonTemplate do + include ManifestsMacros + before do + @model = SpeechBalloonTemplate + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/speech_spec.rb b/spec/manifests/speech_spec.rb new file mode 100644 index 00000000..a3983273 --- /dev/null +++ b/spec/manifests/speech_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +#セリフ +require 'spec_helper' + +describe Speech do + include ManifestsMacros + before do + @model = Speech + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/story_sheet_spec.rb b/spec/manifests/story_sheet_spec.rb new file mode 100644 index 00000000..f5529a87 --- /dev/null +++ b/spec/manifests/story_sheet_spec.rb @@ -0,0 +1,303 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#スト紙 +describe StorySheet do + include ManifestsMacros + before do + @model = StorySheet + end + + describe 'ペタナイズに於いて' do + it 'スト紙に用紙を差し込むためのリーフである' do + expect(@model.ancestors.include?(Peta::Leaf)).to eq true + end + it '親モデルはストーリーである' do + expect(@model.my_peta.parent_model_name).to eq 'story' + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スト紙のためのコントローラである' do + expect(@model.item_name).to eq 'story_sheet' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_story', 'by_sheet', 'show', + 'count', 'count_by_author', 'count_by_story', 'count_by_sheet', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スト紙の公開リストを返すように定義している + set_list_action? @action, 'story_sheet', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スト紙の作家フィルタリストを返すように定義している + set_list_action? @action, 'story_sheet', 'by_author' + end + end + describe 'by_storyに於いて' do + before do + @action = @actions['by_story'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スト紙のコマフィルタリストを返すように定義している + set_list_action? @action, 'story_sheet', 'by_story' + end + end + describe 'by_sheetに於いて' do + before do + @action = @actions['by_sheet'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スト紙のコマフィルタリストを返すように定義している + set_list_action? @action, 'story_sheet', 'by_sheet' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スト紙の公開リストのカウントを返すように定義している + set_list_action? @action, 'story_sheet', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スト紙の作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'story_sheet', 'by_author' + end + end + describe 'count_by_storyに於いて' do + before do + @action = @actions['count_by_story'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スト紙のコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'story_sheet', 'by_story' + end + end + describe 'count_by_sheetに於いて' do + before do + @action = @actions['count_by_sheet'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スト紙のコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'story_sheet', 'by_sheet' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'story_sheet' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'story_sheet' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'story_sheet' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'story_sheet' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'story_sheet' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'story_sheet' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'story_sheets' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['story', 'sheet'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'storyに於いて' do + before do + @mani = @belongs_to['story'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'story' + expect(@mani.id_column).to eq 'story_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Story + end + end + describe 'sheetに於いて' do + before do + @mani = @belongs_to['sheet'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'sheet' + expect(@mani.id_column).to eq 'sheet_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Sheet + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = [] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'story_id', 'sheet_id', 't', + 'created_at', 'updated_at'] + end + describe 'story_idに於いて' do + before do + @attribute = @attributes['story_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'sheet_idに於いて' do + before do + @attribute = @attributes['sheet_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/story_spec.rb b/spec/manifests/story_spec.rb new file mode 100644 index 00000000..1a298495 --- /dev/null +++ b/spec/manifests/story_spec.rb @@ -0,0 +1,374 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#ストーリー + +describe Story do + include ManifestsMacros + before do + @model = Story + end + + describe 'ペタナイズに於いて' do + it 'スト紙を閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'ストーリーのためのコントローラである' do + expect(@model.item_name).to eq 'story' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_comic', 'by_sheet', 'play', 'show', + 'count', 'count_by_author', 'count_by_comic', 'count_by_sheet', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # ストーリーの公開リストを返すように定義している + set_list_action? @action, 'story', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # ストーリーの作家フィルタリストを返すように定義している + set_list_action? @action, 'story', 'by_author' + end + end + describe 'by_comicに於いて' do + before do + @action = @actions['by_comic'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #ストーリーのコマフィルタリストを返すように定義している + set_list_action? @action, 'story', 'by_comic' + end + end + describe 'by_sheetに於いて' do + before do + @action = @actions['by_sheet'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #ストーリーのコマフィルタリストを返すように定義している + set_list_action? @action, 'story', 'by_sheet' + end + end + describe 'showに於いて' do + before do + @action = @actions['show'] + end + it 'showタイプのアクションである' do + expect(@action.type).to eq 'show' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #ストーリーの公開リストのカウントを返すように定義している + set_list_action? @action, 'story', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # ストーリーの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'story', 'by_author' + end + end + describe 'count_by_comicに於いて' do + before do + @action = @actions['count_by_comic'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # ストーリーのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'story', 'by_comic' + end + end + describe 'count_by_sheetに於いて' do + before do + @action = @actions['count_by_sheet'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # ストーリーのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'story', 'by_sheet' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'story' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'story' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'story' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'story' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'story' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'story' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'stories' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['comic_stories', 'comics', 'comic_stories', 'comics'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'comic_storiesに於いて' do + before do + @mani = @has_many['comic_stories'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'comic_story' + expect(@mani.foreign_key).to eq 'story_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ComicStory + end + end + describe 'comicsに於いて' do + before do + @mani = @has_many['comics'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'comic' + expect(@mani.foreign_key).to eq 'story_id' + expect(@mani.through).to eq 'comic_stories' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Comic + end + end + describe 'story_sheetsに於いて' do + before do + @mani = @has_many['story_sheets'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'story_sheet' + expect(@mani.foreign_key).to eq 'story_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq StorySheet + end + end + describe 'sheetsに於いて' do + before do + @mani = @has_many['sheets'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'sheet' + expect(@mani.foreign_key).to eq 'story_id' + expect(@mani.through).to eq 'story_sheets' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Sheet + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 't', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'tに於いて' do + before do + @attribute = @attributes['t'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'story_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/system_picture_spec.rb b/spec/manifests/system_picture_spec.rb new file mode 100644 index 00000000..ad42676c --- /dev/null +++ b/spec/manifests/system_picture_spec.rb @@ -0,0 +1,301 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#システム画像 +describe SystemPicture do + include ManifestsMacros + before do + @model = SystemPicture + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/manifests/writing_format_spec.rb b/spec/manifests/writing_format_spec.rb new file mode 100644 index 00000000..7f6ac4a6 --- /dev/null +++ b/spec/manifests/writing_format_spec.rb @@ -0,0 +1,302 @@ +# -*- encoding: utf-8 -*- +require 'spec_helper' +#シ + +describe WritingFormat do + include ManifestsMacros + before do + @model = WritingFormat + end + + describe 'ペタナイズに於いて' do + it 'スクコマを閉じるためのバインダーである' do + expect(@model.ancestors.include?(Peta::Binder)).to eq true + end + it '親モデルは持たない' do + expect(@model.my_peta.parent_model_name).to be_blank + end + describe 'ブーストに於いて' do + it '特筆すべき注意事項はない' do + expect(@model.my_peta.boost.keys).to be_empty + end + end + + end + + describe 'コントローラに於いて' do + before do + @controller = @model.my_controller + end + it 'スクロールのためのコントローラである' do + expect(@model.item_name).to eq 'scroll' + end + describe 'actionに於いて' do + before do + @actions = @controller.actions + @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', + 'count', 'count_by_author', 'count_by_panel', + 'new', 'edit', 'create', 'update', 'destroy'] + end + it 'これらのアクションが定義されている' do + set_actions? @actions, @actions_names + end + describe 'baseに於いて' do + end + describe 'indexに於いて' do + before do + @action = @actions['index'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの公開リストを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'by_authorに於いて' do + before do + @action = @actions['by_author'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'by_panelに於いて' do + before do + @action = @actions['by_panel'] + end + it 'listタイプのアクションである' do + expect(@action.type).to eq 'list' + end + it 'マニフェストから設定を取り出している' do + #スクロールのコマフィルタリストを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'countに於いて' do + before do + @action = @actions['count'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + #スクロールの公開リストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'public' + end + end + describe 'count_by_authorに於いて' do + before do + @action = @actions['count_by_author'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールの作家フィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_author' + end + end + describe 'count_by_panelに於いて' do + before do + @action = @actions['count_by_panel'] + end + it 'countタイプのアクションである' do + expect(@action.type).to eq 'count' + end + it 'マニフェストから設定を取り出している' do + # スクロールのコマフィルタリストのカウントを返すように定義している + set_list_action? @action, 'scroll', 'by_panel' + end + end + describe 'newに於いて' do + before do + @action = @actions['new'] + end + it 'newタイプのアクションである' do + expect(@action.type).to eq 'new' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'editに於いて' do + before do + @action = @actions['edit'] + end + it 'editタイプのアクションである' do + expect(@action.type).to eq 'edit' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'createに於いて' do + before do + @action = @actions['create'] + end + it 'createタイプのアクションである' do + expect(@action.type).to eq 'create' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'updateに於いて' do + before do + @action = @actions['update'] + end + it 'updateタイプのアクションである' do + expect(@action.type).to eq 'update' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + describe 'destroyに於いて' do + before do + @action = @actions['destroy'] + end + it 'destroyタイプのアクションである' do + expect(@action.type).to eq 'destroy' + end + it 'type' do + expect(@action.item_name).to eq 'scroll' + end + end + end + + end + + describe 'モデルに於いて' do + before do + @my_manifest = @model.my_manifest + end + it 'サポート機能が動作している' do + expect(@my_manifest.model_name).to eq 'scroll' + expect(@my_manifest.classify).to eq @model + expect(@my_manifest.table_name).to eq 'scrolls' + end + + describe 'associationsに於いて' do + describe 'belongs_toに於いて' do + before do + @belongs_to = @my_manifest.associations.belongs_to + @names = ['author'] + end + it 'これらのモデルに所属している' do + set_associations? @belongs_to, @names + end + describe 'authorに於いて' do + before do + @mani = @belongs_to['author'] + end + it 'マニフェストから設定を取り出している' do + # モデル名と外部キーが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'author' + expect(@mani.id_column).to eq 'author_id' + end + it 'サポート機能が動作している' do + # モデルを再現できている + expect(@mani.model).to eq Author + end + end + end + describe 'has_manyに於いて' do + before do + @has_many = @model.my_manifest.associations.has_many + @names = ['scroll_panels', 'panels'] + end + it 'これらのモデルを所持している' do + set_associations? @has_many, @names + end + describe 'scroll_panelsに於いて' do + before do + @mani = @has_many['scroll_panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'scroll_panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to be nil + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be false + expect(@mani.model).to eq ScrollPanel + end + end + describe 'panelsに於いて' do + before do + @mani = @has_many['panels'] + end + it 'マニフェストから設定を取り出している' do + # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている + expect(@mani.model_name).to eq 'panel' + expect(@mani.foreign_key).to eq 'scroll_id' + expect(@mani.through).to eq 'scroll_panels' + end + it 'サポート機能が動作している' do + # モデルを再現できている, 中間モデルフラグ + expect(@mani.through?).to be true + expect(@mani.model).to eq Panel + end + end + end + end + + describe 'attributesに於いて' do + before do + @attributes = @model.my_manifest.attributes + end + it 'これらのカラムを定義している' do + set_attributes? @attributes, + ['id', 'title', 'description', 'visible', 'author_id', + 'created_at', 'updated_at'] + end + describe 'titleに於いて' do + before do + @attribute = @attributes['title'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'descriptionに於いて' do + before do + @attribute = @attributes['description'] + end + it 'textタイプである' do + expect(@attribute.type).to eq 'text' + end + end + describe 'visibleに於いて' do + before do + @attribute = @attributes['visible'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + it '選択肢を定数から取得できるように定義している' do + expect(@attribute.source.type).to eq 'magic_number' + expect(@attribute.source.select_item_name).to eq 'scroll_visible_items' + end + end + describe 'author_idに於いて' do + before do + @attribute = @attributes['author_id'] + end + it 'numberタイプである' do + expect(@attribute.type).to eq 'number' + end + end + end + + end + +end diff --git a/spec/models/scroll_spec.rb b/spec/models/scroll_spec.rb index 97daf721..f3fa0b2c 100644 --- a/spec/models/scroll_spec.rb +++ b/spec/models/scroll_spec.rb @@ -3,7 +3,6 @@ require 'spec_helper' #スクロール describe Scroll do - before do @admin =FactoryGirl.create :admin @user_yas = FactoryGirl.create :user_yas_with_owner diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fb8d32b2..200d739a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,41 +1,90 @@ -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' -require File.dirname(__FILE__) + '/support/controller_macros' - -# Requires supporting ruby files with custom matchers and macros, etc, -# in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} -Dir.glob(File.dirname(__FILE__) + '/factories/*.rb').each {|f| require f } - -RSpec.configure do |config| - config.deprecation_stream = File.open(File.dirname(__FILE__) + '/deprecations.txt', 'w') - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.mock_with :rspec - - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" - - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true - - # If true, the base class of anonymous controllers will be inferred - # automatically. This will be the default behavior in future versions of - # rspec-rails. - config.infer_base_class_for_anonymous_controllers = false - config.include Devise::TestHelpers, :type => :controller -# config.extend ControllerMacros, :type => :controller - config.infer_spec_type_from_file_location! - config.raise_errors_for_deprecations! - - config.include ControllerMacros +require 'rubygems' +require 'spork' +#uncomment the following line to use spork with the debugger +#require 'spork/ext/ruby-debug' + +Spork.prefork do + # Loading more in this block will cause your tests to run faster. However, + # if you change any configuration or code from libraries loaded here, you'll + # need to restart spork for it take effect. + # This file is copied to spec/ when you run 'rails generate rspec:install' + ENV["RAILS_ENV"] ||= 'test' + require File.expand_path("../../config/environment", __FILE__) + require 'rspec/rails' + require File.dirname(__FILE__) + '/support/controller_macros' + + # Requires supporting ruby files with custom matchers and macros, etc, + # in spec/support/ and its subdirectories. + Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} + Dir.glob(File.dirname(__FILE__) + '/factories/*.rb').each {|f| require f } + + RSpec.configure do |config| + config.deprecation_stream = File.open(File.dirname(__FILE__) + '/deprecations.txt', 'w') + # == Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + config.mock_with :rspec + + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # If true, the base class of anonymous controllers will be inferred + # automatically. This will be the default behavior in future versions of + # rspec-rails. + config.infer_base_class_for_anonymous_controllers = false + config.include Devise::TestHelpers, :type => :controller + # config.extend ControllerMacros, :type => :controller + config.infer_spec_type_from_file_location! + config.raise_errors_for_deprecations! + + config.include ControllerMacros + end + end + +Spork.each_run do + # This code will be run each time you run your specs. + +end + +# --- Instructions --- +# Sort the contents of this file into a Spork.prefork and a Spork.each_run +# block. +# +# The Spork.prefork block is run only once when the spork server is started. +# You typically want to place most of your (slow) initializer code in here, in +# particular, require'ing any 3rd-party gems that you don't normally modify +# during development. +# +# The Spork.each_run block is run each time you run your specs. In case you +# need to load files that tend to change during development, require them here. +# With Rails, your application modules are loaded automatically, so sometimes +# this block can remain empty. +# +# Note: You can modify files loaded *from* the Spork.each_run block without +# restarting the spork server. However, this file itself will not be reloaded, +# so if you change any of the code inside the each_run block, you still need to +# restart the server. In general, if you have non-trivial code in this file, +# it's advisable to move it into a separate file so you can easily edit it +# without restarting spork. (For example, with RSpec, you could move +# non-trivial code into a file spec/support/my_helper.rb, making sure that the +# spec/support/* files are require'd from inside the each_run block.) +# +# Any code that is left outside the two blocks will be run during preforking +# *and* during each_run -- that's probably not what you want. +# +# These instructions should self-destruct in 10 seconds. If they don't, feel +# free to delete them. + + + + diff --git a/spec/support/manifests_macros.rb b/spec/support/manifests_macros.rb index 52aa7f34..867e11e5 100644 --- a/spec/support/manifests_macros.rb +++ b/spec/support/manifests_macros.rb @@ -1,10 +1,17 @@ module ManifestsMacros + def set_boosts? boosts, names + names.each do |name| + expect(boosts.keys).to include name + end + expect(boosts.keys.size).to eq names.size + end + # コントローラのアクションのマニフェストが期待通りに記述されているか。数量と名称でチェックする。 def set_actions? actions, names - expect(actions.keys.size).to eq names.size names.each do |name| expect(actions.keys).to include name end + expect(actions.keys.size).to eq names.size end def set_list_action? action, item_name, list_name @@ -14,18 +21,18 @@ module ManifestsMacros # モデルのassociationのマニフェストが期待通りに記述されているか。数量と名称でチェックする。 def set_associations? association, names - expect(association.keys.size).to eq names.size names.each do |name| expect(association.keys).to include name end + expect(association.keys.size).to eq names.size end # モデルのカラムのマニフェストが期待通りに記述されているか。数量と名称でチェックする。 def set_attributes? attributes, names - expect(attributes.keys.size).to eq names.size names.each do |name| expect(attributes.keys).to include name end + expect(attributes.keys.size).to eq names.size end end