<&= file_item.edit.render_column().el.innerHTML &>\r
</script>\r
<script type="text/template" id="templates-filer-item_column-show">\r
- <%= render item_column.item_template_name, :item_column => item_column %>\r
+ <&= render item_column.item_template_name, :item_column => item_column &>\r
</script>\r
<script type="text/template" id="templates-filer-item_column-none">\r
</script>\r
require 'picture_io'
require 'pettan_imager'
-require 'ar_helper'
require 'operator'
require 'import_result'
require 'common'
+++ /dev/null
-
-module ActiveRecord
- class Base
- module ActiveRecordHelper
- def self.included(base)
- base.extend(ClassMethods)
- base.__send__ :include, InstanceMethods
- end
-
- module ClassMethods
- def get_author_from_roles roles
- roles.each do |role|
- return role if role.is_a?(Author)
- return role.author if role.is_a?(User)
- return role.author if role.is_a?(Artist) and role.author
- end
- nil
- end
-
- def get_artist_from_roles roles
- roles.each do |role|
- return role.artist if role.is_a?(Author) and role.artist
- return role.author.artist if role.is_a?(User) and role.author and role.author.artist
- return role if role.is_a?(Artist)
- end
- nil
- end
-
- def get_admin_from_roles roles
- roles.each do |role|
- return role if role.is_a?(Admin)
- end
- nil
- end
-
- end
-
- module InstanceMethods
- private
-
- public
-
- def guest_role_check roles
- true
- end
-
- def reader_role_check roles
- roles = [roles] unless roles.respond_to?(:each)
- roles.each do |role|
- return true if role.is_a?(Author) or role.is_a?(Artist) or role.is_a?(Admin) or role.is_a?(User)
- end
- false
- end
-
- def resource_reader_role_check roles
- roles = [roles] unless roles.respond_to?(:each)
- roles.each do |role|
- return true if role.is_a?(Author) or role.is_a?(Artist) or role.is_a?(Admin) or role.is_a?(User) or role.is_a?(DemandUser)
- end
- false
- end
-
- def admin_role_check roles
- roles = [roles] unless roles.respond_to?(:each)
- roles.each do |role|
- return true if role.is_a?(Admin)
- end
- false
- end
-
- end
-
- end
- include ActiveRecordHelper
- end
-end
-
end
def field_name
- @parent.field_name
+ @parent.name
end
end
@type =~ /filter/
end
+ # url format
+ # true: /path/id/action
+ # nil: /path/action/id
def pre_id?
if @name =~ /^by_/
false
end
def list_name
- @parent.list_name
+ @parent.name
end
def model
end
def list_name
- @parent.list_name
+ @parent.name
end
def model
end
def list_name
- @parent.list_name
+ @parent.name
end
def model
end
def association_name
- @parent.name
+ @parent.profiler_name
end
end
module ProfilerModule
module AssociationModule
class HasMany < ManifestBase::Names
- attr :model_name, :list_name
+ attr :model_name, :list_name, :table_name
def set_default
super
end
def association_name
- @parent.association_name
+ @parent.profiler_name
end
def profiler
end
def association_name
- @parent.association_name
+ @parent.profiler_name
end
def profiler
#InstanceMethods
+ def singular
+ self.class.singular
+ end
+
+ def plural
+ self.class.plural
+ end
+
def item_name
self.class.item_name
end
#スクロールマニフェスト
describe Scroll do
+ include LocalManifestsMacros
before do
@model = Scroll
end
before do
@my_local_manifest = LocalManifest.manifest.filers[@model.item_name]
end
- it ' 項はない' do
+ 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
before do
@symbol = @my_local_manifest.symbol
end
- it 'type' do
+ it 'defaultタイプのsymbolである' do
expect(@symbol.type).to eq 'default'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@symbol.visible?).to be true
end
describe 'faceに於いて' do
before do
@face = @symbol.face
end
- it 'type' do
+ it 'imageタイプのfaceである' do
expect(@face.type).to eq 'image'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@face.url).to eq '/images/scroll.gif'
end
end
before do
@link = @symbol.link
end
- it 'type' do
+ it 'actionタイプのlinkである' do
expect(@link.type).to eq 'action'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@link.action_name).to eq 'show'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@link.action_path).to eq '/scrolls/'
end
end
before do
@caption = @my_local_manifest.caption
end
- it 'type' do
+ it 'defaultタイプのsymbolである' do
expect(@caption.type).to eq 'default'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@caption.visible?).to be true
end
describe 'faceに於いて' do
before do
@face = @caption.face
end
- it 'type' do
+ it 'columnタイプのfaceである' do
expect(@face.type).to eq 'column'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@face.column_name).to eq 'title'
end
end
before do
@link = @caption.link
end
- it 'type' do
+ it 'actionタイプのlinkである' do
expect(@link.type).to eq 'action'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@link.action_name).to eq 'play'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@link.action_path).to eq '/scrolls/play/'
end
end
before do
@summary = @my_local_manifest.summary
end
- it 'type' do
+ it 'templateタイプのsymbolである' do
expect(@summary.type).to eq 'template'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@summary.template_name).to eq 'summary'
end
end
before do
@icon = @my_local_manifest.icon
end
- it 'type' do
+ it 'defaultタイプのsymbolである' do
expect(@icon.type).to eq 'default'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@icon.visible?).to be true
end
end
before do
@date = @my_local_manifest.date
end
- it 'type' do
+ it 'defaultタイプのsymbolである' do
expect(@date.type).to eq 'default'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@date.visible?).to be true
end
end
before do
@edit = @my_local_manifest.edit
end
- it 'type' do
+ it 'defaultタイプのsymbolである' do
expect(@edit.type).to eq 'default'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@edit.visible?).to be true
end
end
before do
@my_local_manifest = LocalManifest.manifest.profilers[@model.item_name]
end
- it ' 項はない' do
+ 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 'type' do
- expect(@columns.size).to eq 4 + 3
- expect(@columns.keys).to include 'title'
- expect(@columns.keys).to include 'description'
- expect(@columns.keys).to include 'visible'
- expect(@columns.keys).to include 'author_id'
+ it 'これらのカラムが定義されている' do
+ set_columns? @columns, @names
end
describe 'titleに於いて' do
before do
@column = @columns['title']
end
- it 'type' do
+ it 'defaultタイプのcolumnである' do
expect(@column.type).to eq 'default'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@column.item_name).to eq 'scroll'
end
end
before do
@column = @columns['description']
end
- it 'type' do
+ it 'defaultタイプのcolumnである' do
expect(@column.type).to eq 'default'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@column.item_name).to eq 'scroll'
end
end
before do
@column = @columns['visible']
end
- it 'type' do
+ it 'sourceタイプのcolumnである' do
expect(@column.type).to eq 'source'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@column.item_name).to eq 'scroll'
end
end
before do
@column = @columns['author_id']
end
- it 'type' do
+ it 'defaultタイプのcolumnである' do
expect(@column.type).to eq 'default'
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@column.item_name).to eq 'scroll'
end
end
before do
@column_names = @my_local_manifest.column_names
end
- it 'type' do
+ it '数量が守られている' do
expect(@column_names.size).to eq 4 + 3
end
- it 'type' do
+ it '順序が守られている' do
expect(@column_names).to eq ['id', 'title', 'description', 'visible', 'author_id', 'created_at', 'updated_at']
end
end
before do
@extend_settings = @my_local_manifest.extend_settings
end
- it 'type' do
+ it '拡張カラムは無い' do
expect(@extend_settings).to be_empty
end
end
before do
@lists = @my_local_manifest.lists
end
- it 'type' do
+ it '無い' do
expect(@lists).to be_empty
end
end
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 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@mani.name).to eq 'author'
expect(@mani.model_name).to eq 'author'
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@mani.model).to eq Author
end
end
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 'type' do
+ 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 'type' do
+ it 'サポート機能が動作している' do
expect(@mani.model).to eq ScrollPanel
end
end
before do
@mani = @has_many[1]
end
- it 'type' do
+ 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 'type' do
+ it 'サポート機能が動作している' do
expect(@mani.model).to eq Panel
end
end
before do
@my_local_manifest = LocalManifest.manifest.list_groups[@model.item_name]
end
- it ' 項はない' do
+ 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 'type' do
- expect(@lists.size).to eq 4
- expect(@lists.keys).to include 'public'
- expect(@lists.keys).to include 'private'
- expect(@lists.keys).to include 'by_author'
- expect(@lists.keys).to include 'by_panel'
+ it 'これらのリストを定義している' do
+ set_lists? @lists, ['public', 'private', 'by_author', 'by_panel']
end
describe 'publicに於いて' do
before do
@mani = @lists['public']
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@mani.type).to eq 'public'
+ end
+ it 'マニフェストから設定を取り出している' do
expect(@mani.model).to eq Scroll
end
- it 'base' do
- expect(@mani.has_id?).to eq true
- expect(@mani.pre_id?).to eq false
+ 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 'type' do
+ 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 'type' do
+ it 'method_name' do
expect(@where.method_name).to eq 'public_list_where'
end
end
before do
@includes = @mani.includes
end
- it 'type' do
+ 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 'type' do
- expect(@includes.includes).to eq {}
+ it 'includes' do
+ expect(@includes.includes).to be_empty
end
end
describe 'orderに於いて' do
before do
@order = @mani.order
end
- it 'type' do
+ 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 'type' do
+ it 'order' do
expect(@order.order).to eq 'list_order'
end
end
before do
@my_local_manifest = LocalManifest.manifest.forms[@model.item_name]
end
- it ' 項はない' do
+ 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 'type' do
+ # 細かいチェックは後でやるので、大雑把に数量だけチェックしておく。
+ it '数量が守られている' do
expect(@fields.size).to eq 5
- expect(@fields.keys).to include 'title'
- expect(@fields.keys).to include 'description'
- expect(@fields.keys).to include 'visible'
- expect(@fields.keys).to include 'id'
- expect(@fields.keys).to include 'author_id'
end
end
describe 'field_namesに於いて' do
before do
@field_names = @my_local_manifest.field_names
end
- it 'type' do
+ 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 'type' do
- expect(@ordered_fields.size).to eq 5
+ it 'これらのフィールドを取り扱う' do
+ expect(@ordered_fields.map {|f| f.name }).to eq @names
end
describe 'titleに於いて' do
before do
@field = @ordered_fields[0]
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@field.name).to eq 'title'
expect(@field.row_break).to be true
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@field.part?).to be false
expect(@field.form_name).to eq @model.item_name
expect(@field.column_name).to eq 'title'
before do
@label = @field.label
end
- it 'type' do
+ it 'defaultタイプである' do
expect(@label.type).to eq 'default'
+ end
+ it 'マニフェストから設定を取り出している' do
expect(@label.row_break).to be true
end
- it 'type' do
+ 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
before do
@tag = @field.tag
end
- it 'type' do
+ 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 'type' do
+ it 'サポート機能が動作している' do
expect(@tag.form_name).to eq @model.item_name
expect(@tag.field_name).to eq 'title'
end
before do
@field = @ordered_fields[1]
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@field.name).to eq 'description'
expect(@field.row_break).to be true
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@field.part?).to be false
expect(@field.form_name).to eq @model.item_name
expect(@field.column_name).to eq 'description'
before do
@field = @ordered_fields[2]
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@field.name).to eq 'visible'
expect(@field.row_break).to be true
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@field.part?).to be false
expect(@field.form_name).to eq @model.item_name
expect(@field.column_name).to eq 'visible'
before do
@field = @ordered_fields[3]
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@field.name).to eq 'id'
expect(@field.row_break).to be true
end
- it 'type' do
+ it 'サポート機能が動作している' do
expect(@field.part?).to be false
expect(@field.form_name).to eq @model.item_name
expect(@field.column_name).to eq 'id'
before do
@field = @ordered_fields[4]
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
expect(@field.name).to eq 'author_id'
expect(@field.row_break).to be true
end
- it 'type' do
+ 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'
before do
@my_local_manifest = LocalManifest.manifest.buckets[@model.item_name]
end
- it ' 項はない' do
+ it 'マニフェストから設定を取り出している' do
expect(@my_local_manifest.members).to be_empty
expect(@my_local_manifest.form_field_names).to be_empty
end
- it ' 項はない' do
+ it 'サポート機能が動作している' do
expect(@my_local_manifest.has_member?).to be false
expect(@my_local_manifest.item_name).to eq @model.item_name
end
#スクロールマニフェスト
describe Scroll do
+ include ManifestsMacros
before do
@model = Scroll
end
it 'スクコマを閉じるためのバインダーである' do
expect(@model.ancestors.include?(Peta::Binder)).to eq true
end
- it ' 項はない' do
+ it '親モデルは持たない' do
expect(@model.my_peta.parent_model_name).to be_blank
end
describe 'ブーストに於いて' do
- it 'ブースト特筆すべき注意事項はない' do
+ it '特筆すべき注意事項はない' do
expect(@model.my_peta.boost.keys).to be_empty
end
end
before do
@controller = @model.my_controller
end
- it 'ã\83¼である' do
+ it 'ã\82¹ã\82¯ã\83ã\83¼ã\83«ã\81®ã\81\9fã\82\81ã\81®ã\82³ã\83³ã\83\88ã\83ã\83¼ã\83©である' 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
- expect(@actions.keys.size).to eq 13
- expect(@actions.keys).to include 'index'
- expect(@actions.keys).to include 'by_author'
- expect(@actions.keys).to include 'by_panel'
- expect(@actions.keys).to include 'play'
- expect(@actions.keys).to include 'show'
- expect(@actions.keys).to include 'count'
- expect(@actions.keys).to include 'count_by_author'
- expect(@actions.keys).to include 'count_by_panel'
- expect(@actions.keys).to include 'new'
- expect(@actions.keys).to include 'edit'
- expect(@actions.keys).to include 'create'
- expect(@actions.keys).to include 'update'
- expect(@actions.keys).to include 'destroy'
+ it 'これらのアクションが定義されている' do
+ set_actions? @actions, @actions_names
end
- describe 'index actionに於いて' do
+ describe 'baseに於いて' do
+ end
+ describe 'indexに於いて' do
before do
@action = @actions['index']
end
- it 'type' do
+ it 'listタイプのアクションである' do
expect(@action.type).to eq 'list'
end
- it 'type' do
- expect(@action.item_name).to eq 'scroll'
- expect(@action.list_name).to eq 'public'
+ it 'マニフェストから設定を取り出している' do
+ # スクロールの公開リストを返すように定義している
+ set_list_action? @action, 'scroll', 'public'
end
end
- describe 'by_author actionに於いて' do
+ describe 'by_authorに於いて' do
before do
@action = @actions['by_author']
end
- it 'type' do
+ it 'listタイプのアクションである' do
expect(@action.type).to eq 'list'
end
- it 'type' do
- expect(@action.item_name).to eq 'scroll'
- expect(@action.list_name).to eq 'by_author'
+ it 'マニフェストから設定を取り出している' do
+ # スクロールの作家フィルタリストを返すように定義している
+ set_list_action? @action, 'scroll', 'by_author'
end
end
- describe 'count actionに於いて' do
+ 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 'type' do
+ it 'countタイプのアクションである' do
expect(@action.type).to eq 'count'
end
- it 'type' do
- expect(@action.item_name).to eq 'scroll'
- expect(@action.list_name).to eq 'public'
+ 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 actionに於いて' do
+ describe 'newに於いて' do
before do
@action = @actions['new']
end
- it 'type' do
+ it 'newタイプのアクションである' do
expect(@action.type).to eq 'new'
end
it 'type' do
expect(@action.item_name).to eq 'scroll'
end
end
- describe 'edit actionに於いて' do
+ describe 'editに於いて' do
before do
@action = @actions['edit']
end
- it 'type' do
+ it 'editタイプのアクションである' do
expect(@action.type).to eq 'edit'
end
it 'type' do
expect(@action.item_name).to eq 'scroll'
end
end
- describe 'create actionに於いて' do
+ describe 'createに於いて' do
before do
@action = @actions['create']
end
- it 'type' do
+ it 'createタイプのアクションである' do
expect(@action.type).to eq 'create'
end
it 'type' do
expect(@action.item_name).to eq 'scroll'
end
end
- describe 'update actionに於いて' do
+ describe 'updateに於いて' do
before do
@action = @actions['update']
end
- it 'type' do
+ it 'updateタイプのアクションである' do
expect(@action.type).to eq 'update'
end
it 'type' do
expect(@action.item_name).to eq 'scroll'
end
end
- describe 'destroy actionに於いて' do
+ describe 'destroyに於いて' do
before do
@action = @actions['destroy']
end
- it 'type' do
+ it 'destroyタイプのアクションである' do
expect(@action.type).to eq 'destroy'
end
it 'type' do
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 = @model.my_manifest.associations.belongs_to
+ @belongs_to = @my_manifest.associations.belongs_to
+ @names = ['author']
end
- it ' である' do
- expect(@belongs_to.keys).to include 'author'
+ it 'これらのモデルに所属している' do
+ set_associations? @belongs_to, @names
end
describe 'authorに於いて' do
before do
@mani = @belongs_to['author']
end
- it 'type' do
+ it 'マニフェストから設定を取り出している' do
+ # モデル名と外部キーが定義あるいはデフォルト値補充されている
expect(@mani.model_name).to eq 'author'
expect(@mani.id_column).to eq 'author_id'
end
- it 'type' do
+ it 'サポート機能が動作している' do
+ # モデルを再現できている
expect(@mani.model).to eq Author
end
end
describe 'has_manyに於いて' do
before do
@has_many = @model.my_manifest.associations.has_many
+ @names = ['scroll_panels', 'panels']
end
- it ' である' do
- expect(@has_many.keys).to include 'scroll_panels'
- expect(@has_many.keys).to include 'panels'
+ it 'これらのモデルを所持している' do
+ set_associations? @has_many, @names
end
describe 'scroll_panelsに於いて' do
before do
@mani = @has_many['scroll_panels']
end
- it 'type' do
+ 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 'type' do
+ it 'サポート機能が動作している' do
+ # モデルを再現できている, 中間モデルフラグ
expect(@mani.through?).to be false
expect(@mani.model).to eq ScrollPanel
end
before do
@mani = @has_many['panels']
end
- it 'type' do
+ 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 'type' do
+ it 'サポート機能が動作している' do
+ # モデルを再現できている, 中間モデルフラグ
expect(@mani.through?).to be true
expect(@mani.model).to eq Panel
end
before do
@attributes = @model.my_manifest.attributes
end
- it ' である' do
- expect(@attributes.keys).to include 'id'
- expect(@attributes.keys).to include 'title'
- expect(@attributes.keys).to include 'description'
- expect(@attributes.keys).to include 'visible'
- expect(@attributes.keys).to include 'author_id'
- expect(@attributes.keys).to include 'created_at'
- expect(@attributes.keys).to include 'updated_at'
+ 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 'type' do
+ it 'textタイプである' do
expect(@attribute.type).to eq 'text'
end
end
before do
@attribute = @attributes['description']
end
- it 'type' do
+ it 'textタイプである' do
expect(@attribute.type).to eq 'text'
end
end
before do
@attribute = @attributes['visible']
end
- it 'type' do
+ it 'numberタイプである' do
expect(@attribute.type).to eq 'number'
end
- it 'source' do
+ it '選択肢を定数から取得できるように定義している' do
expect(@attribute.source.type).to eq 'magic_number'
expect(@attribute.source.select_item_name).to eq 'scroll_visible_items'
end
before do
@attribute = @attributes['author_id']
end
- it 'type' do
+ it 'numberタイプである' do
expect(@attribute.type).to eq 'number'
end
end
end
- describe 'shortcutに於いて' do
- before do
- @my_manifest = @model.my_manifest
- end
- it 'type' 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
- end
-
end
end
#スクロール
describe Scroll do
- include BinderMacros
before do
- SpeechBalloonTemplate.delete_all
- @admin = FactoryGirl.create :admin
- @demand_user = FactoryGirl.create :demand_user
- @sp = FactoryGirl.create :system_picture
- @lg = FactoryGirl.create :license_group
- @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
- @user = FactoryGirl.create( :user_yas)
- @author = FactoryGirl.create :author, :user_id => @user.id
- @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
- @other_user = FactoryGirl.create( :user_yas)
- @other_author = FactoryGirl.create :author, :user_id => @other_user.id
- @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
- end
-
- describe 'ペタナイズに於いて' do
- it 'スクコマを閉じるためのバインダーである' do
- expect(@item.is_a?(Peta::Binder)).to be true
- end
- it 'ブースト特筆すべき注意事項はない' do
- expect(self.class.my_peta.boost.keys).to be true
- end
- context 'バインダー' do
- it '' do
- define_leaf_items?
- end
- it '' do
- define_leafs_items?
- end
- end
-
- end
-
- describe 'マニフェストに於いて' do
- context 'オーソドックスなデータのとき' do
- it 'スクコマを閉じるためのバインダーである' do
- expect(@item.is_a?(Peta::Binder)).to be true
- end
- it 'ブースト特筆すべき注意事項はない' do
- expect(self.class.my_peta.boost.keys).to be true
- end
- end
-
- end
-
- describe 'ローカルマニフェストに於いて' do
- context 'ファイラーのとき' do
- it 'スクコマを閉じるためのバインダーである' do
- expect(@item.is_a?(Peta::Binder)).to be true
- end
- it 'ブースト特筆すべき注意事項はない' do
- expect(self.class.my_peta.boost.keys).to be true
- end
- end
-
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
end
describe '検証に於いて' do
before do
- @scroll = FactoryGirl.build :scroll, :author_id => @author.id
+ @item = FactoryGirl.build :scroll_hello, author: @author_yas
end
context 'オーソドックスなデータのとき' do
it '下限データが通る' do
- @scroll.title = 'a'
- @scroll.visible = 0
- @scroll.should be_valid
+ @item.title = 'a'
+ @item.visible = 0
+ expect(@item).to be_valid
end
it '上限データが通る' do
- @scroll.title = 'a'*100
- @scroll.visible = 1
- @scroll.should be_valid
+ @item.title = 'a'*100
+ @item.visible = 1
+ expect(@item).to be_valid
end
end
context 'titleを検証するとき' do
it 'nullなら失敗する' do
- @scroll.title = nil
- @scroll.should_not be_valid
+ @item.title = nil
+ expect(@item).to_not be_valid
end
it '100文字以上なら失敗する' do
- @scroll.title = 'a'*101
- @scroll.should_not be_valid
+ @item.title = 'a'*101
+ expect(@item).to_not be_valid
end
end
context 'visibleを検証するとき' do
it 'nullなら失敗する' do
- @scroll.visible = nil
- @scroll.should_not be_valid
+ @item.visible = nil
+ expect(@item).to_not be_valid
end
it '負なら失敗する' do
- @scroll.visible = -1
- @scroll.should_not be_valid
+ @item.visible = -1
+ expect(@item).to_not be_valid
end
it '2以上なら失敗する' do
- @scroll.visible = 2
- @scroll.should_not be_valid
+ @item.visible = 2
+ expect(@item).to_not be_valid
end
end
context 'author_idを検証するとき' do
it 'nullなら失敗する' do
- @scroll.author_id = nil
- @scroll.should_not be_valid
+ @item.author_id = nil
+ expect(@item).to_not be_valid
end
it '数値でなければ失敗する' do
- @scroll.author_id = 'a'
- @scroll.should_not be_valid
+ @item.author_id = 'a'
+ expect(@item).to_not be_valid
end
it '存在する作家でなければ失敗する' do
- @scroll.author_id = 0
- @scroll.should_not be_valid
- end
- end
- end
-
- describe '文字コード検証に於いて' do
- before do
- @scroll = FactoryGirl.build :scroll, :author_id => @author.id
- end
-
- context 'titleを検証するとき' do
- it 'Shift JISなら失敗する' do
- @scroll.title = "\x83G\x83r\x83]\x83D"
- lambda{
- @scroll.valid_encode
- }.should raise_error(Pettanr::BadRequest)
- end
- end
-
- context 'descriptionを検証するとき' do
- it 'Shift JISなら失敗する' do
- @scroll.description = "\x83G\x83r\x83]\x83D"
- lambda{
- @scroll.valid_encode
- }.should raise_error(Pettanr::BadRequest)
+ @item.author_id = 0
+ expect(@item).to_not be_valid
end
end
end
describe 'デフォルト値補充に於いて' do
it 'visibleが0になっている' do
- @scroll = FactoryGirl.build :scroll, :visible => nil
- @scroll.supply_default
- @scroll.visible.should eq 0
+ @item = FactoryGirl.build :scroll_hello, author: @author_yas
+ @item.supply_default
+ expect(@item.visible).to eq 0
end
end
describe '上書き補充に於いて' do
it '作家idが設定されている' do
- @scroll = FactoryGirl.build :scroll, :author_id => nil
- @scroll.overwrite @author
- @scroll.author_id.should eq @author.id
- end
- end
-
- describe 'ロールリストからの作家取得に於いて' do
- context 'ロールがユーザのとき' do
- it 'ユーザから作家を取得して、それを返す' do
- r = Scroll.get_author_from_roles([@user])
- r.should eq @author
- end
- end
- context 'ロールが作家のとき' do
- it '作家を返す' do
- r = Scroll.get_author_from_roles([@author])
- r.should eq @author
- end
- end
- context 'ロールが絵師のとき' do
- it '絵師から作家を取得できれば、それをを返す' do
- r = Scroll.get_author_from_roles([@artist])
- r.should eq @author
- end
- it '絵師から作家を取得できないときnilを返す' do
- @artist.author_id = nil
- @artist.save!
- r = Scroll.get_author_from_roles([@artist])
- r.should be_nil
- end
- end
- context 'ロールが管理者のとき' do
- it 'nilを返す' do
- r = Scroll.get_author_from_roles([@admin])
- r.should be_nil
- end
- end
- end
-
- describe 'ロールリストからの絵師取得に於いて' do
- context 'ロールがユーザのとき' do
- it 'ユーザから作家を取得して、そこから絵師を取得できれば、それを返す' do
- r = Scroll.get_artist_from_roles([@user])
- r.should eq @artist
- end
- it '作家から絵師を取得できないときnilを返す' do
- @artist.author_id = nil
- @artist.save!
- r = Scroll.get_artist_from_roles([@user])
- r.should be_nil
- end
- end
- context 'ロールが作家のとき' do
- it 'そこから絵師を取得できれば、それを返す' do
- r = Scroll.get_artist_from_roles([@author])
- r.should eq @artist
- end
- it '作家から絵師を取得できないときnilを返す' do
- @artist.author_id = nil
- @artist.save!
- r = Scroll.get_artist_from_roles([@author])
- r.should be_nil
- end
- end
- context 'ロールが絵師のとき' do
- it 'それを返す' do
- r = Scroll.get_artist_from_roles([@artist])
- r.should eq @artist
- end
- end
- context 'ロールが管理者のとき' do
- it 'nilを返す' do
- r = Scroll.get_artist_from_roles([@admin])
- r.should be_nil
- end
+ @item = FactoryGirl.build :scroll_hello, author: @author_yas
+ @item.overwrite @author
+ expect(@item.author_id).to eq @author.id
end
end
describe '所持判定に於いて' do
before do
- @scroll = FactoryGirl.build :scroll, :author_id => @author.id
- end
- context '事前チェックする' do
- it '自身にロールリストからの作家取得を依頼している' do
- Scroll.should_receive(:get_author_from_roles).with(any_args).exactly(1)
- r = @scroll.own?([@author])
- end
+ @item = FactoryGirl.build :scroll_hello, author: @author_yas
end
context 'ロール内作家が取得できるとき' do
before do
end
it 'ロール内作家のidが自身の作家idと一致するなら許可する' do
Scroll.stub(:get_author_from_roles).with(any_args).and_return(@author)
- r = @scroll.own?([@author])
+ r = @item.own?([@author])
r.should be_true
end
it 'ロール内作家のidが自身の作家idと一致しないならno' do
Scroll.stub(:get_author_from_roles).with(any_args).and_return(@other_author)
- @scroll.own?(@other_author).should be_false
+ @item.own?(@other_author).should be_false
end
end
context 'ロール内作家が取得できないとき' do
Scroll.stub(:get_author_from_roles).with(any_args).and_return(nil)
end
it 'Falseを返す' do
- r = @scroll.own?([@author])
- r.should be_false
- end
- end
- end
-
- describe '読者用ロールチェックに於いて' do
- before do
- @scroll = FactoryGirl.build :scroll, :author_id => @author.id
- end
- context 'ロールリストに作家が含まれるとき' do
- it 'ロールリストがリストではないとき、リストにする trueを返す' do
- r = @scroll.reader_role_check(@author)
- r.should be_true
- end
- it 'trueを返す' do
- r = @scroll.reader_role_check([@author])
- r.should be_true
- end
- end
- context 'ロールリストに絵師が含まれるとき' do
- it 'trueを返す' do
- r = @scroll.reader_role_check([@artist])
- r.should be_true
- end
- end
- context 'ロールリストにユーザが含まれるとき' do
- it 'trueを返す' do
- r = @scroll.reader_role_check([@user])
- r.should be_true
- end
- end
- context 'ロールリストに管理者が含まれるとき' do
- it 'trueを返す' do
- r = @scroll.reader_role_check([@admin])
- r.should be_true
- end
- end
- context 'ロールリストにユーザ、管理者、作家、絵師が含まれないとき' do
- it 'falseを返す' do
- r = @scroll.reader_role_check([nil])
- r.should be_false
- end
- end
- end
-
- describe '素材読者用ロールチェックに於いて' do
- before do
- @scroll = FactoryGirl.build :scroll, :author_id => @author.id
- end
- context 'ロールリストに作家が含まれるとき' do
- it 'ロールリストがリストではないとき、リストにする trueを返す' do
- r = @scroll.resource_reader_role_check(@author)
- r.should be_true
- end
- it 'trueを返す' do
- r = @scroll.resource_reader_role_check([@author])
- r.should be_true
- end
- end
- context 'ロールリストに絵師が含まれるとき' do
- it 'trueを返す' do
- r = @scroll.resource_reader_role_check([@artist])
- r.should be_true
- end
- end
- context 'ロールリストにユーザが含まれるとき' do
- it 'trueを返す' do
- r = @scroll.resource_reader_role_check([@user])
- r.should be_true
- end
- end
- context 'ロールリストに管理者が含まれるとき' do
- it 'trueを返す' do
- r = @scroll.resource_reader_role_check([@admin])
- r.should be_true
- end
- end
- context 'ロールリストに借手が含まれるとき' do
- it 'trueを返す' do
- r = @scroll.resource_reader_role_check([@demand_user])
- r.should be_true
- end
- end
- context 'ロールリストにユーザ、管理者、作家、絵師、借手が含まれないとき' do
- it 'falseを返す' do
- r = @scroll.resource_reader_role_check([nil])
+ r = @item.own?([@author])
r.should be_false
end
end
describe '閲覧許可に於いて' do
before do
- @scroll = FactoryGirl.build :scroll, :author_id => @author.id
+ @item = FactoryGirl.build :scroll_hello, author: @author_yas
end
context 'オープンモードのとき' do
before do
MagicNumber['run_mode'] = 0
end
- it '自身にゲスト用ロールチェックを問い合わせしている' do
- Scroll.any_instance.stub(:guest_role_check).and_return(true)
- Scroll.any_instance.should_receive(:guest_role_check).with(any_args).exactly(1)
- r = @scroll.visible?([@author])
+ context 'ゲストのとき' do
+ it '他人のの非公開スクロールでも許可する' do
+ end
end
- it 'ゲスト用ロールチェックが失敗したとき、falseを返す' do
- Scroll.any_instance.stub(:guest_role_check).and_return(false)
- r = @scroll.visible?([@author])
- r.should be_false
+ context 'yasのとき' do
+ it '自分のスクロールなら許可する' do
+ Scroll.any_instance.stub(:own?).and_return(true)
+ Scroll.any_instance.stub(:visible).and_return(0)
+ r = @item.visible?([@author])
+ r.should be_true
+ end
+ it '他人の非公開スクロールなら許可しない' do
+ end
+ it '他人のスクロールでも公開なら許可する' do
+ end
+ end
+ context 'adminのとき' do
+ it '他人のの非公開スクロールでも許可する' do
+ end
end
end
context 'クローズドモードのとき' do
before do
MagicNumber['run_mode'] = 1
end
- it '自身に読者用ロールチェックを問い合わせしている' do
- Scroll.any_instance.stub(:reader_role_check).and_return(true)
- Scroll.any_instance.should_receive(:reader_role_check).with(any_args).exactly(1)
- r = @scroll.visible?([@author])
+ context 'ゲストのとき' do
+ it '他人のの非公開スクロールでも許可する' do
+ end
end
- it '読者用ロールチェックが失敗したとき、falseを返す' do
- Scroll.any_instance.stub(:reader_role_check).and_return(false)
- r = @scroll.visible?([@author])
- r.should be_false
+ context 'yasのとき' do
+ it '自分のスクロールなら許可する' do
+ Scroll.any_instance.stub(:own?).and_return(true)
+ Scroll.any_instance.stub(:visible).and_return(0)
+ r = @item.visible?([@author])
+ r.should be_true
+ end
+ it '他人の非公開スクロールなら許可しない' do
+ end
+ it '他人のスクロールでも公開なら許可する' do
+ end
end
- end
- context '事前チェックする' do
- before do
- MagicNumber['run_mode'] = 1
- Scroll.any_instance.stub(:reader_role_check).and_return(true)
- Scroll.any_instance.stub(:own?).and_return(true)
- end
- it '自身に所持判定を問い合わせしている' do
- Scroll.any_instance.should_receive(:own?).with(any_args).exactly(1)
- r = @scroll.visible?([@author])
+ context 'adminのとき' do
+ it '他人のの非公開スクロールでも許可する' do
+ end
end
end
- context 'つつがなく終わるとき' do
- before do
- MagicNumber['run_mode'] = 1
- Scroll.any_instance.stub(:reader_role_check).and_return(true)
- end
- it '自分のスクロールなら許可する' do
- Scroll.any_instance.stub(:own?).and_return(true)
- Scroll.any_instance.stub(:visible).and_return(0)
- r = @scroll.visible?([@author])
- r.should be_true
- end
- it '他人の非公開スクロールなら許可しない' do
- Scroll.any_instance.stub(:own?).and_return(false)
- Scroll.any_instance.stub(:visible).and_return(0)
- r = @scroll.visible?([@author])
- r.should be_false
- end
- it '他人のスクロールでも公開なら許可する' do
- Scroll.any_instance.stub(:own?).and_return(false)
- Scroll.any_instance.stub(:visible).and_return(1)
- r = @scroll.visible?([@author])
- r.should be_true
- end
- end
- end
-
- describe '一覧取得に於いて' do
- before do
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id
- end
- context 'page補正について' do
- it '文字列から数値に変換される' do
- Scroll.page('8').should eq 8
- end
- it 'nilの場合は1になる' do
- Scroll.page().should eq 1
- end
- it '0以下の場合は1になる' do
- Scroll.page('0').should eq 1
- end
- end
- context 'page_size補正について' do
- it '文字列から数値に変換される' do
- Scroll.page_size('7').should eq 7
- end
- it 'nilの場合はScroll.default_page_sizeになる' do
- Scroll.page_size().should eq Scroll.default_page_size
- end
- it '0以下の場合はScroll.default_page_sizeになる' do
- Scroll.page_size('0').should eq Scroll.default_page_size
- end
- it 'Scroll.max_page_sizeを超えた場合はScroll.max_page_sizeになる' do
- Scroll.page_size('1000').should eq Scroll.max_page_size
- end
- end
- context 'つつがなく終わるとき' do
- it '一覧取得オプションを利用している' do
- Scroll.stub(:list_opt).with(any_args).and_return({})
- Scroll.should_receive(:list_opt).with(any_args).exactly(1)
- r = Scroll.list
- end
- end
- it 'リストを返す' do
- c = Scroll.list
- c.should eq [@scroll]
- end
- it '非公開スクロールは(自分のスクロールであっても)含んでいない' do
- FactoryGirl.create :scroll, :author_id => @author.id, :visible => 0
- c = Scroll.list
- c.should eq [@scroll]
- end
- it '時系列で並んでいる' do
- #公開スクロールは(他人のスクロールであっても)含んでいる
- v = FactoryGirl.create :scroll, :author_id => @other_author.id, :updated_at => Time.now + 100
- c = Scroll.list
- c.should eq [v, @scroll]
- end
- context 'DBに5件あって1ページの件数を2件に変えたとして' do
- before do
- @scroll2 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 100
- @scroll3 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 200
- @scroll4 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 300
- @scroll5 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 400
- Scroll.stub(:default_page_size).and_return(2)
- end
- it '通常は2件を返す' do
- c = Scroll.list
- c.should have(2).items
- end
- it 'page=1なら末尾2件を返す' do
- #時系列で並んでいる
- c = Scroll.list(1)
- c.should eq [@scroll5, @scroll4]
- end
- it 'page=2なら中間2件を返す' do
- c = Scroll.list(2)
- c.should eq [@scroll3, @scroll2]
- end
- it 'page=3なら先頭1件を返す' do
- c = Scroll.list(3)
- c.should eq [@scroll]
- end
- end
- end
-
- describe '自分のスクロール一覧取得に於いて' do
- before do
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id
- end
- context 'つつがなく終わるとき' do
- it '一覧取得オプションを利用している' do
- Scroll.stub(:list_opt).with(any_args).and_return({})
- Scroll.should_receive(:list_opt).with(any_args).exactly(1)
- r = Scroll.mylist @author
- end
- end
- it 'リストを返す' do
- c = Scroll.mylist @author
- c.should eq [@scroll]
- end
- it '時系列で並んでいる' do
- nc = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 100
- cl = Scroll.mylist @author
- cl.should eq [nc, @scroll]
- end
- it '他人のスクロールは公開でも含まない' do
- nc = FactoryGirl.create :scroll, :author_id => @other_author.id, :visible => 1
- cl = Scroll.mylist @author
- cl.should eq [@scroll]
- end
- it '自分のスクロールは非公開でも含んでいる' do
- nc = FactoryGirl.create :scroll, :author_id => @author.id, :visible => 0, :updated_at => Time.now + 100
- cl = Scroll.mylist @author
- cl.should eq [nc, @scroll]
- end
- context 'DBに5件あって1ページの件数を2件に変えたとして' do
- before do
- @scroll2 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 100
- @scroll3 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 200
- @scroll4 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 300
- @scroll5 = FactoryGirl.create :scroll, :author_id => @author.id, :updated_at => Time.now + 400
- end
- it '通常は2件を返す' do
- c = Scroll.mylist @author, 1, 2
- c.should have(2).items
- end
- it 'page=1なら末尾2件を返す' do
- #時系列で並んでいる
- c = Scroll.mylist(@author, 1, 2)
- c.should eq [@scroll5, @scroll4]
- end
- it 'page=2なら中間2件を返す' do
- c = Scroll.mylist(@author, 2, 2)
- c.should eq [@scroll3, @scroll2]
- end
- it 'page=3なら先頭1件を返す' do
- c = Scroll.mylist(@author, 3, 2)
- c.should eq [@scroll]
- end
- end
- end
-
- describe '他作家のスクロール一覧取得に於いて' do
- before do
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id
- @other_scroll = FactoryGirl.create :scroll, :author_id => @other_author.id, :visible => 1
- end
- context 'つつがなく終わるとき' do
- it '一覧取得オプションを利用している' do
- Scroll.stub(:list_opt).with(any_args).and_return({})
- Scroll.should_receive(:list_opt).with(any_args).exactly(1)
- r = Scroll.himlist @other_author
- end
- end
- it '指定した作家のリストを返す' do
- r = Scroll.himlist @other_author
- r.should eq [@other_scroll]
- end
- it '時系列で並んでいる' do
- nc = FactoryGirl.create :scroll, :author_id => @other_author.id, :updated_at => Time.now + 100
- r = Scroll.himlist @other_author
- r.should eq [nc, @other_scroll]
- end
- it '公開スクロールに限る ' do
- hidden = FactoryGirl.create :scroll, :author_id => @other_author.id, :visible => 0
- r = Scroll.himlist @other_author
- r.should eq [@other_scroll]
- end
- context 'DBに5件あって1ページの件数を2件に変えたとして' do
- before do
- @other_scroll2 = FactoryGirl.create :scroll, :author_id => @other_author.id, :updated_at => Time.now + 100
- @other_scroll3 = FactoryGirl.create :scroll, :author_id => @other_author.id, :updated_at => Time.now + 200
- @other_scroll4 = FactoryGirl.create :scroll, :author_id => @other_author.id, :updated_at => Time.now + 300
- @other_scroll5 = FactoryGirl.create :scroll, :author_id => @other_author.id, :updated_at => Time.now + 400
- end
- it '通常は2件を返す' do
- c = Scroll.himlist @other_author, 1, 2
- c.should have(2).items
- end
- it 'page=1なら末尾2件を返す' do
- #時系列で並んでいる
- c = Scroll.himlist(@other_author, 1, 2)
- c.should eq [@other_scroll5, @other_scroll4]
- end
- it 'page=2なら中間2件を返す' do
- c = Scroll.himlist(@other_author, 2, 2)
- c.should eq [@other_scroll3, @other_scroll2]
- end
- it 'page=3なら先頭1件を返す' do
- c = Scroll.himlist(@other_author, 3, 2)
- c.should eq [@other_scroll]
- end
- end
- end
-
- describe 'スクロール一覧ページ制御に於いて' do
- before do
- Scroll.stub(:count).with(any_args).and_return(100)
- end
- it 'ページ制御を返す' do
- r = Scroll.list_paginate
- r.is_a?(Kaminari::PaginatableArray).should be_true
- end
- it 'スクロール一覧の取得条件を利用している' do
- Scroll.stub(:list_where).with(any_args).and_return('')
- Scroll.should_receive(:list_where).with(any_args).exactly(1)
- r = Scroll.list_paginate
- end
- it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do
- r = Scroll.list_paginate 3, 10
- r.limit_value.should eq 10
- r.offset_value.should eq 20
- end
- end
-
- describe '自分のスクロール一覧ページ制御に於いて' do
- before do
- Scroll.stub(:count).with(any_args).and_return(100)
- end
- it 'ページ制御を返す' do
- r = Scroll.mylist_paginate @author
- r.is_a?(Kaminari::PaginatableArray).should be_true
- end
- it '自分のスクロール一覧の取得条件を利用している' do
- Scroll.stub(:mylist_where).with(any_args).and_return('')
- Scroll.should_receive(:mylist_where).with(any_args).exactly(1)
- r = Scroll.mylist_paginate @author
- end
- it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do
- r = Scroll.mylist_paginate @author, 3, 10
- r.limit_value.should eq 10
- r.offset_value.should eq 20
- end
- end
-
- describe '他作家のスクロール一覧ページ制御に於いて' do
- before do
- Scroll.stub(:count).with(any_args).and_return(100)
- end
- it 'ページ制御を返す' do
- r = Scroll.himlist_paginate @other_author
- r.is_a?(Kaminari::PaginatableArray).should be_true
- end
- it '他作家のスクロール一覧の取得条件を利用している' do
- Scroll.stub(:himlist_where).with(any_args).and_return('')
- Scroll.should_receive(:himlist_where).with(any_args).exactly(1)
- r = Scroll.himlist_paginate @other_author
- end
- it 'ページ件数10のとき、3ページ目のオフセットは20から始まる' do
- r = Scroll.himlist_paginate @other_author, 3, 10
- r.limit_value.should eq 10
- r.offset_value.should eq 20
- end
- end
-
- describe '一覧取得オプションに於いて' do
- it '2つの項目を含んでいる' do
- r = Scroll.list_opt
- r.should have(2).items
- end
- it 'スクコマを含んでいる' do
- r = Scroll.list_opt
- r.has_key?(:scroll_panels).should be_true
- end
- it 'スクコマはコマを含んでいる' do
- r = Scroll.list_opt
- r[:scroll_panels].has_key?(:panel).should be_true
- end
- it '作家を含んでいる' do
- r = Scroll.list_opt
- r.has_key?(:author).should be_true
- end
- end
- describe 'json一覧出力オプションに於いて' do
- before do
- @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
- @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
- @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
- @sbt = FactoryGirl.create :speech_balloon_template
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id, :visible => 1
- @panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
- @scroll_panel = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id
- end
- it 'スクコマを含んでいる' do
- r = Scroll.list.to_json Scroll.list_json_opt
- j = JSON.parse r
- i = j.first
- i.has_key?('scroll_panels').should be_true
- end
- it 'スクコマはコマを含んでいる' do
- r = Scroll.list.to_json Scroll.list_json_opt
- j = JSON.parse r
- i = j.first
- s = i['scroll_panels'].first
- s.has_key?('panel').should be_true
- end
- it '作家を含んでいる' do
- r = Scroll.list.to_json Scroll.list_json_opt
- j = JSON.parse r
- i = j.first
- i.has_key?('author').should be_true
- end
end
describe '単体取得に於いて' do
before do
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id
- end
- context 'つつがなく終わるとき' do
- it '単体取得オプションを利用している' do
- Scroll.stub(:show_opt).with(any_args).and_return({})
- Scroll.should_receive(:show_opt).with(any_args).exactly(1)
- r = Scroll.show @scroll.id, @author
- end
- it '閲覧許可を問い合わせている' do
- Scroll.any_instance.stub(:visible?).with(any_args).and_return(true)
- Scroll.any_instance.should_receive(:visible?).with(any_args).exactly(1)
- r = Scroll.show @scroll.id, @author
- end
+ @item = FactoryGirl.create :scroll, :author_id => @author.id
end
it '指定のスクロールを返す' do
- c = Scroll.show @scroll.id, @author
- c.should eq @scroll
+ c = Scroll.show @item.id, @author
+ c.should eq @item
end
context '閲覧許可が出なかったとき' do
it '403Forbidden例外を返す' do
Scroll.any_instance.stub(:visible?).and_return(false)
lambda{
- Scroll.show @scroll.id, @author
+ Scroll.show @item.id, @author
}.should raise_error(ActiveRecord::Forbidden)
end
end
describe '編集取得に於いて' do
before do
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id
+ @item = FactoryGirl.create :scroll, :author_id => @author.id
end
context 'つつがなく終わるとき' do
it '単体取得オプションを利用している' do
Scroll.stub(:show_opt).with(any_args).and_return({})
Scroll.should_receive(:show_opt).with(any_args).exactly(1)
- r = Scroll.edit @scroll.id, @author
+ r = Scroll.edit @item.id, @author
end
it '所持判定を問い合わせている' do
Scroll.any_instance.stub(:own?).with(any_args).and_return(true)
Scroll.any_instance.should_receive(:own?).with(any_args).exactly(1)
- r = Scroll.edit @scroll.id, @author
+ r = Scroll.edit @item.id, @author
end
end
it '指定のスクロールを返す' do
Scroll.any_instance.stub(:own?).and_return(true)
- c = Scroll.edit @scroll.id, @author.id
- c.should eq @scroll
+ c = Scroll.edit @item.id, @author.id
+ c.should eq @item
end
context '他人のスクロールを開こうとしたとき' do
it '403Forbidden例外を返す' do
Scroll.any_instance.stub(:own?).and_return(false)
lambda{
- Scroll.edit @scroll.id, @author
+ Scroll.edit @item.id, @author
}.should raise_error(ActiveRecord::Forbidden)
end
end
end
end
end
- describe '単体取得オプションに於いて' do
- it 'includeキーを含んでいる' do
- r = Scroll.show_opt
- r.has_key?(:include).should be_true
- end
- it '2つの項目を含んでいる' do
- r = Scroll.show_opt[:include]
- r.should have(2).items
- end
- it '作家を含んでいる' do
- r = Scroll.show_opt[:include]
- r.has_key?(:author).should be_true
- end
- it 'スクコマを含んでいる' do
- r = Scroll.show_opt[:include]
- r.has_key?(:scroll_panels).should be_true
- end
- it 'スクコマはコマを含んでいる' do
- r = Scroll.show_opt[:include]
- r[:scroll_panels].has_key?(:panel).should be_true
- end
- end
- describe 'json単体出力オプションに於いて' do
- before do
- @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
- @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
- @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
- @sbt = FactoryGirl.create :speech_balloon_template
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id, :visible => 1
- @panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
- @scroll_panel = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id
- end
- it 'スクコマを含んでいる' do
- r = Scroll.show(@scroll.id, @author).to_json Scroll.show_json_opt
- j = JSON.parse r
- i = j
- i.has_key?('scroll_panels').should be_true
- end
- it 'スクコマはコマを含んでいる' do
- r = Scroll.show(@scroll.id, @author).to_json Scroll.show_json_opt
- j = JSON.parse r
- i = j
- s = i['scroll_panels'].first
- s.has_key?('panel').should be_true
- end
- it '作家を含んでいる' do
- r = Scroll.show(@scroll.id, @author).to_json Scroll.show_json_opt
- j = JSON.parse r
- i = j
- i.has_key?('author').should be_true
- end
- end
describe '削除に於いて' do
before do
- @scroll = FactoryGirl.create :scroll, :author_id => @author.id
+ @item = FactoryGirl.create :scroll, :author_id => @author.id
@panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
- @scroll_panel = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id
+ @item_panel = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @item.id, :panel_id => @panel.id
@other_scroll = FactoryGirl.create :scroll, :author_id => @author.id
@other_scroll_panel = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @other_scroll.id, :panel_id => @panel.id
end
context 'つつがなく終わるとき' do
it '自身を削除する' do
lambda {
- r = @scroll.destroy_with_scroll_panel
+ r = @item.destroy_with_scroll_panel
}.should change(Scroll, :count).by(-1)
lambda {
- r = Scroll.find @scroll.id
+ r = Scroll.find @item.id
}.should raise_error
end
it '自身にリンクしているスクコマをすべて削除する' do
lambda {
- r = @scroll.destroy_with_scroll_panel
+ r = @item.destroy_with_scroll_panel
}.should change(ScrollPanel, :count).by(-1)
lambda {
- r = ScrollPanel.find @scroll_panel.id
+ r = ScrollPanel.find @item_panel.id
}.should raise_error
end
it 'Trueを返す' do
- r = @scroll.destroy_with_scroll_panel
+ r = @item.destroy_with_scroll_panel
r.should be_true
end
end
ScrollPanel.any_instance.stub(:destroy).with(any_args).and_return(false)
end
it 'Falseを返す' do
- r = @scroll.destroy_with_scroll_panel
+ r = @item.destroy_with_scroll_panel
r.should be_false
end
it 'ロールバックしている' do
lambda {
- r = @scroll.destroy_with_scroll_panel
+ r = @item.destroy_with_scroll_panel
}.should_not change(Scroll, :count)
lambda {
- r = @scroll.destroy_with_scroll_panel
+ r = @item.destroy_with_scroll_panel
}.should_not change(ScrollPanel, :count)
end
end
#スクロール
describe Scroll do
+ include BinderMacros
before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
end
- describe '文字コード検証に於いて' do
+ describe '生成メソッドに於いて' do
before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
end
- context 'titleを検証するとき' do
- it 'Shift JISなら失敗する' do
- expect(Scroll.new.respond_to?(:leafs_items)).to be true
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
end
end
- context 'titleを検証するとき' do
- it 'Shift JISなら失敗する' do
- expect(Scroll.new.respond_to?(:leafs_)).to be true
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
end
end
end
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
end
+
describe Comic do
+ include BinderMacros
before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
end
- describe '文字コード検証に於いて' do
- before do
- end
-
- context 'titleを検証するとき' do
- it 'Shift JISなら失敗する' do
- @scroll.title = 'a'
- @scroll.should be_valid
- end
- end
-
+end
+
+describe Story do
+ include BinderMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
end
end
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe Scroll do
+ include ContentMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+
+describe Comic do
+ include BinderMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ComicStory]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ComicStory]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe Scroll do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+end
+
+describe SheetPanel do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe PanelPicture do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe SpeechBalloon do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe Balloon do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe Speech do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe GroundPicture do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe GroundColor do
+ include ElementMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe Scroll do
+ include ItemMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+
+ @model = Scroll
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ end
+
+ describe '文字コード検証に於いて' do
+ it 'Shift JISなら失敗する' do
+ @text_column_names = ['title', 'description']
+ valid_encode? @item, @text_column_names
+ end
+ end
+
+ describe 'child_modelsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_child_models? @model, [ScrollPanel]
+ end
+ end
+
+ describe 'child_element_namesに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_child_element_names? @model, ['scroll_panels']
+ end
+ end
+
+ end
+
+ describe 'myに於いて' do
+ it '自分のマニフェストを取得するためのショートカットが設定できている' do
+ define_my_manifest? @model
+ end
+
+ it 'アイテムの種別を判定するためのフラグが設定できている' do
+ @subjects = {
+ :item? => true,
+ :content? => true,
+ :element? => false,
+ :root? => false,
+ }
+ set_name? @model, @subjects
+ end
+
+ it '名前の活用に於いて' do
+ @subjects = {
+ :singular => 'Scroll',
+ :plural => 'Scrolls',
+ :item_name => 'scroll',
+ #:model_name => 'Scroll',
+ :path_name => 'scrolls',
+ :table_name => 'scrolls',
+ :pickup_item_name => 'scroll',
+ :pickup_column_name => 'id',
+ }
+ # クラスメソッドで名前の活用ができているか
+ set_name? @model, @subjects
+ # インスタンスメソッドからクラスメソッドを呼び出すショートカットが利用できるか
+ set_name? @item, @subjects
+ end
+ end
+
+ describe 'listに於いて' do
+ it 'list' do
+ expect(@model.parent_model).to be nil
+ expect(@model.list_where).to be_blank
+ expect(@model.list_order).to eq 'scrolls.updated_at desc'
+ end
+ end
+
+ describe 'extendに於いて' do
+ before do
+ end
+
+ it 'それぞれのカラムは拡張カラムなのか' do
+ @subjects = {
+ :title => false,
+ :description => false,
+ :visible => false,
+ :author_id => false,
+ }
+ set_extend_column? @model, @subjects
+ set_extend_column? @item, @subjects
+ end
+
+ it 'カラム名からブーストマニフェストを取得できている' do
+ @subjects = {
+ }
+ set_extend_column? @model, @subjects
+ end
+
+ it 'Postレベルでブーストしてブースターを確認する' do
+ @names = []
+ set_boosters? @item, @names
+ end
+
+ it '拡張データを畳み込める' do
+ @extend_column_names = []
+ @attr = {}
+ fold_extend_settings? @model, @attr, @extend_column_names
+ end
+
+ end
+
+ describe 'めんどいからチェックしない機能に於いて' do
+ it 'とりあえず呼び出すところまでは確認しておく' do
+ define_test @item
+ end
+ #
+ # list_opt, list_json_opt, show_opt, show_json_opt, form_template, form_name
+ # supply_default, overwrite, visible?
+ end
+
+end
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe ScrollPanel do
+ include LeafMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+end
+
+describe SheetPanel do
+ include LeafMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe ComicStory do
+ include LeafMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
+describe StorySheet do
+ include LeafMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+end
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe Author do
+ include OwnerMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+
+describe Artist do
+ include OwnerMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ComicStory]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ComicStory]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe Sheet do
+ include RootMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+
+describe Panel do
+ include RootMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ComicStory]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ComicStory]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe License do
+ include SystemResourceMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+
+describe SystemPicture do
+ include SystemResourceMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ComicStory]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ComicStory]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
--- /dev/null
+# -*- encoding: utf-8 -*-
+require 'spec_helper'
+#スクロール
+
+describe SpeechBalloonTemplate do
+ include TemplateMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+
+describe LicenseGroup do
+ include TemplateMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ScrollPanel]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ScrollPanel]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+
+describe WritingFormat do
+ include TemplateMacros
+ before do
+ @admin =FactoryGirl.create :admin
+ @user_yas = FactoryGirl.create :user_yas_with_owner
+ @user_rom = FactoryGirl.create :user_rom
+ @author_yas = @user_yas.author
+ end
+
+ describe '生成メソッドに於いて' do
+ before do
+ end
+
+ describe 'leaf_itemsに於いて' do
+ it 'ぶら下がるそれぞれのリーフを取得できる' do
+ define_leaf_items? @item, [ComicStory]
+ end
+ end
+
+ describe 'leafs_itemsに於いて' do
+ it 'すべてのリーフを取得できる' do
+ define_leafs_items? @item, [ComicStory]
+ end
+ end
+
+ end
+
+ describe 'boostに於いて' do
+ before do
+ @item = FactoryGirl.create :scroll_hello_with_scroll_panels, author: @author_yas
+ end
+
+ it 'ブーストメッセージをリーフに伝搬する' do
+ end
+ end
+
+end
+++ /dev/null
-module BinderMacros\r
- def define_leaf_items?\r
- # ステータス OKを返す\r
- expect(response).to be_success\r
- end\r
- \r
- def render_json?\r
- # jsonデータを返す\r
- expect {JSON.parse(response.body)}.not_to raise_error\r
- end\r
- \r
- def render_filer?\r
- # filerテンプレートを描画する\r
- expect(response).to render_template("templates/r/filer/filer")\r
- end\r
- \r
- def render_profiler?\r
- # profilerテンプレートを描画する\r
- expect(response).to render_template("templates/r/profiler/profiler")\r
- end\r
- \r
- def render_form?\r
- # formテンプレートを描画する\r
- expect(response).to render_template("templates/r/form/form")\r
- end\r
- \r
- def redirect? url\r
- # html形式: ステータスコード302 Foundを返す\r
- expect(response.status).to eq(302)\r
- expect(response).to redirect_to url\r
- end\r
- \r
- # ゲストがapiからコンテンツにアクセスしようとした時の動作を確認する\r
- def render_unauthorized?\r
- # json形式: ステータスコード401 Unauthorizedを返す\r
- expect(response.status).to eq(401)\r
- expect(response.message).to match(/Unauthorized/)\r
- end\r
- \r
- # 処理不能を返す\r
- def render_unprocessable?\r
- expect(response.status).to eq(422)\r
- expect(response.message).to match(/Unprocessable/)\r
- end\r
- \r
- def render_complated?\r
- expect(response.message).to match /./\r
- end\r
- \r
- def set_model? model_class, var_name = :my_model_class\r
- expect(assigns(var_name)).to be model_class\r
- end\r
- \r
- def set_list_model? model_class, var_name = :my_list_model_class\r
- expect(assigns(var_name)).to be model_class\r
- end\r
- \r
- def set_list? item_name, list_name, var_name = :list\r
- expect(assigns(var_name).item_name).to eq(item_name)\r
- expect(assigns(var_name).list_name).to eq(list_name)\r
- end\r
- \r
- def set_play_list? model_class\r
- expect(assigns(:items).size).to be >= 3\r
- expect(assigns(:count)).to be >= 3\r
- expect(assigns(:pager)).not_to be nil\r
- expect(assigns(:items).first.class).to be model_class\r
- end\r
- \r
- def let_filer? var_name = :filer\r
- expect(assigns(var_name).class).to eq(Locmare::Filer)\r
- end\r
- \r
- def let_profiler? var_name = :profiler\r
- expect(assigns(var_name).class).to eq(Locmare::Profiler)\r
- end\r
- \r
- def set_bucket? item, var_name = :form\r
- # @filerにファイラーを取得している\r
- expect(assigns(var_name).item).to eq(item)\r
- expect(assigns(var_name).mounted).to eq(true)\r
- expect(assigns(var_name).submit).to eq(true)\r
- end\r
- \r
- def boost? names, var_name = :item\r
- if names.empty?\r
- assigns(var_name).boosters.empty?\r
- else\r
- names.each do |boost_name|\r
- expect(assigns(var_name).boosters[boost_name]).to_not be nil\r
- end\r
- end\r
- end\r
- \r
- # 作家活動していないユーザーがAPIから創作活動をしようとしたとき、例外を発生させる。\r
- # 暫定的な仕様なので、良い方法があれば変えるかもしれない。メンテしやすいように切り分けてある。\r
- # リクエストして例外が発生したところとらえるので、リクエストと検証を同時に行う\r
- def announce_regist_author_for_json method, params = {}, action = :create\r
- expect {__send__(method, action, params.merge(:format => :json))}.to raise_error(ActiveRecord::Forbidden)\r
- end\r
- \r
- # 保存処理を成功したことにしてスキップする\r
- def allow_save my_model_class\r
- allow_any_instance_of(my_model_class).to receive(:save).and_return(true)\r
- end\r
- \r
- # 保存処理を失敗したことにしてスキップする\r
- def reject_save my_model_class\r
- allow_any_instance_of(my_model_class).to receive(:save).and_return(false)\r
- end\r
- \r
- # 削除処理を成功したことにしてスキップする\r
- def allow_destroy my_model_class\r
- allow_any_instance_of(my_model_class).to receive(:destroy).and_return(true)\r
- end\r
- \r
- # 削除処理を失敗したことにしてスキップする\r
- def reject_destroy my_model_class\r
- allow_any_instance_of(my_model_class).to receive(:destroy).and_return(false)\r
- end\r
- \r
- def factory_contents factory_name, author, count = 5\r
- FactoryGirl.create_list(factory_name, count, author: author)\r
- end\r
- \r
-end\r
-\r
--- /dev/null
+module LocalManifestsMacros\r
+ # プロファイラーのカラムのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_columns? columns, names\r
+ expect(columns.keys.size).to eq names.size\r
+ names.each do |name|\r
+ expect(columns.keys).to include name\r
+ end\r
+ end\r
+ \r
+ # プロファイラーのassociationのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_associations? association, names\r
+ expect(association.map {|a| a.association_name}).to eq names\r
+ end\r
+ \r
+ # リストグループのlistsのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_lists? lists, names\r
+ expect(lists.keys.size).to eq names.size\r
+ names.each do |name|\r
+ expect(lists.keys).to include name\r
+ end\r
+ end\r
+ \r
+ # 入力フォームのフィールドのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_fields? fields, names\r
+ expect(fields.keys.size).to eq names.size\r
+ names.each do |name|\r
+ expect(fields.keys).to include name\r
+ end\r
+ end\r
+ \r
+end\r
+\r
--- /dev/null
+module ManifestsMacros\r
+ # コントローラのアクションのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_actions? actions, names\r
+ expect(actions.keys.size).to eq names.size\r
+ names.each do |name|\r
+ expect(actions.keys).to include name\r
+ end\r
+ end\r
+ \r
+ def set_list_action? action, item_name, list_name\r
+ expect(action.item_name).to eq item_name\r
+ expect(action.list_name).to eq list_name\r
+ end\r
+ \r
+ # モデルのassociationのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_associations? association, names\r
+ expect(association.keys.size).to eq names.size\r
+ names.each do |name|\r
+ expect(association.keys).to include name\r
+ end\r
+ end\r
+ \r
+ # モデルのカラムのマニフェストが期待通りに記述されているか。数量と名称でチェックする。\r
+ def set_attributes? attributes, names\r
+ expect(attributes.keys.size).to eq names.size\r
+ names.each do |name|\r
+ expect(attributes.keys).to include name\r
+ end\r
+ end\r
+ \r
+end\r
+\r
--- /dev/null
+module ItemMacros\r
+ # 文字コード検証\r
+ def valid_encode? item, text_column_names\r
+ text_column_names.each do |name|\r
+ expect(item.class.valid_encode_columns).to include name\r
+ item.attributes[name] = "\x83G\x83r\x83]\x83D"\r
+ # バージョンが上がって問題なくなったかもしれない\r
+ #expect { item.valid_encode }.to raise_error(Pettanr::BadRequest)\r
+ end\r
+ end\r
+ \r
+ def define_child_models? model, models\r
+ expect(model.child_models.size).to eq models.size\r
+ models.each do |m|\r
+ expect(model.child_models).to include m\r
+ end\r
+ end\r
+ \r
+ def define_child_element_names? model, item_names\r
+ expect(model.child_models.size).to eq item_names.size\r
+ item_names.each do |m|\r
+ expect(model.child_element_names).to include m\r
+ end\r
+ end\r
+ \r
+ def define_my_manifest? model\r
+ expect(model.my_peta).to eq Manifest.manifest.items[model.item_name]\r
+ expect(model.my_controller).to eq Manifest.manifest.controllers[model.table_name]\r
+ expect(model.my_manifest).to eq Manifest.manifest.models[model.item_name]\r
+ end\r
+ \r
+ # マニフェストを取得するためのショートカット\r
+ def define_my_manifest? model\r
+ expect(model.my_peta).to eq Manifest.manifest.items[model.item_name]\r
+ expect(model.my_controller).to eq Manifest.manifest.controllers[model.table_name]\r
+ expect(model.my_manifest).to eq Manifest.manifest.models[model.item_name]\r
+ end\r
+ \r
+ # 名前の活用が正しく変化していることを確認している\r
+ def set_name? item, subjects\r
+ subjects.each do |name, value|\r
+ expect(item.__send__(name)).to eq value\r
+ end\r
+ end\r
+ \r
+ # 拡張カラムなのかを確認している\r
+ def set_extend_column? model, subjects\r
+ subjects.each do |name, value|\r
+ expect(model.extend_column?(name)).to eq value\r
+ end\r
+ end\r
+ \r
+ # ブースターが用意されているか、名前だけでも確認する\r
+ def set_boosters? item, names\r
+ item.boosts 'post'\r
+ item.boosters.keys.each do |name|\r
+ expect(name).to include names\r
+ end\r
+ end\r
+ \r
+ # 拡張データを畳み込めるか確認する\r
+ def fold_extend_settings? model, attr, extend_column_names\r
+ model.fold_extend_settings attr\r
+ extend_column_names.each do |name|\r
+ expect(attr[name]).to be_kind_of String\r
+ end\r
+ end\r
+ \r
+ def define_test item\r
+ expect {expect(item.dom_id)}.not_to raise_error\r
+ expect {expect(item.editize?)}.not_to raise_error\r
+ expect {expect(item.dom_pool_type)}.not_to raise_error\r
+ expect {expect(item.merge_dom_item_id({}))}.not_to raise_error\r
+ expect {expect(item.tag_attributes)}.not_to raise_error\r
+ expect {expect(item.field_tag_attributes(:hoge))}.not_to raise_error\r
+ expect {expect(item.post_attribute_key)}.not_to raise_error\r
+ end\r
+ \r
+end\r
+\r
+module ContentMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module BinderMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module LeafMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module RootMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module ElementMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module OwnerMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module SystemResourceMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r
+module TemplateMacros\r
+ # ぶら下がるそれぞれのリーフを取得\r
+ def define_leaf_items? item, leaf_models\r
+ expect(item.respond_to?(:leaf_items)).to be true\r
+ leaf_models.each do |model|\r
+ expect(item.leaf_items(model)).to_not be_empty\r
+ expect(item.leaf_items(model).first.class).to eq model\r
+ end\r
+ end\r
+ \r
+ def define_leafs_items? item, leaf_models\r
+ expect(item.respond_to?(:leafs_items)).to be true\r
+ expect(item.leafs_items).to_not be_empty\r
+ item.leafs_items.map {|i| i.class }.each do |model|\r
+ expect(leaf_models).to include model\r
+ end\r
+ end\r
+ \r
+end\r
+\r