locomotive_plugins 1.0.0.beta4 → 1.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +0,0 @@
1
-
2
- require 'spec_helper'
3
-
4
- describe LocomotivePlugins do
5
-
6
- before(:each) do
7
- LocomotivePlugins.clear_registered_plugins
8
- end
9
-
10
- it 'should register plugins under a given id' do
11
- LocomotivePlugins.register_plugin(Locomotive::MyPlugin, 'my_amazing_plugin')
12
- registered = LocomotivePlugins.registered_plugins
13
- registered.count.should == 1
14
- registered['my_amazing_plugin'].should == Locomotive::MyPlugin
15
- end
16
-
17
- it 'should register plugins under the default id' do
18
- default_id = LocomotivePlugins.default_id(Locomotive::MyPlugin)
19
- LocomotivePlugins.register_plugin(Locomotive::MyPlugin)
20
- registered = LocomotivePlugins.registered_plugins
21
- registered.count.should == 1
22
- registered[default_id].should == Locomotive::MyPlugin
23
- end
24
-
25
- it 'should use the underscorized class name without any modules as the default id' do
26
- LocomotivePlugins.default_id(Locomotive::MyPlugin).should == 'my_plugin'
27
- end
28
-
29
- end
@@ -1,19 +0,0 @@
1
-
2
- module Locomotive
3
- class PluginWithDBModel
4
- include Locomotive::Plugin
5
-
6
- class VisitCount < Locomotive::Plugin::DBModel
7
- field :count, default: 0
8
- end
9
-
10
- class Item < Locomotive::Plugin::DBModel
11
- field :name
12
- validates_presence_of :name
13
- end
14
-
15
- has_one :visit_count, VisitCount
16
- has_many :items, Item
17
-
18
- end
19
- end
@@ -1,22 +0,0 @@
1
-
2
- module Locomotive
3
- class PluginWithDBModelRelationships
4
- include Locomotive::Plugin
5
-
6
- class Teacher < Locomotive::Plugin::DBModel
7
- field :name
8
- has_many :students,
9
- class_name: 'Locomotive::PluginWithDBModelRelationships::Student'
10
- end
11
-
12
- class Student < Locomotive::Plugin::DBModel
13
- field :name
14
- belongs_to :teacher,
15
- class_name: 'Locomotive::PluginWithDBModelRelationships::Teacher'
16
- end
17
-
18
- has_many :teachers, Teacher
19
- has_many :students, Student
20
-
21
- end
22
- end