lolita 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/{GUIDELINE → GUIDELINES} +0 -0
  2. data/History.rdoc +70 -0
  3. data/LICENSE.txt +3 -1
  4. data/README.rdoc +5 -1
  5. data/Rakefile +2 -2
  6. data/VERSION +1 -1
  7. data/app/controllers/lolita/rest_controller.rb +1 -1
  8. data/app/views/components/lolita/configuration/field/array/filter/_display.html.erb +1 -0
  9. data/app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb +2 -0
  10. data/app/views/components/lolita/configuration/field/date_time/_display.html.erb +1 -0
  11. data/app/views/components/lolita/configuration/field/date_time/date/_display.html.erb +1 -0
  12. data/app/views/components/lolita/configuration/field/date_time/time/_display.html.erb +1 -0
  13. data/app/views/components/lolita/configuration/field/time/_display.html.erb +1 -1
  14. data/app/views/components/lolita/configuration/list/_filter.html.erb +2 -2
  15. data/config/locales/en.yml +4 -1
  16. data/lib/lolita.rb +18 -11
  17. data/lib/lolita/adapter/abstract_adapter.rb +1 -1
  18. data/lib/lolita/adapter/active_record.rb +28 -1
  19. data/lib/lolita/adapter/mongoid.rb +25 -2
  20. data/lib/lolita/configuration/field/array.rb +1 -0
  21. data/lib/lolita/configuration/field/date.rb +1 -1
  22. data/lib/lolita/configuration/field/date_time.rb +13 -0
  23. data/lib/lolita/configuration/filter.rb +24 -0
  24. data/lib/lolita/configuration/list.rb +4 -1
  25. data/lib/lolita/configuration/page.rb +18 -2
  26. data/lib/lolita/controllers/internal_helpers.rb +1 -0
  27. data/lib/lolita/hooks.rb +22 -22
  28. data/lib/lolita/hooks/named_hook.rb +7 -3
  29. data/lib/lolita/navigation/branch.rb +7 -0
  30. data/lib/lolita/navigation/tree.rb +7 -0
  31. data/lolita.gemspec +22 -12
  32. data/public/stylesheets/lolita/style.css +16 -0
  33. data/spec/adapter_helper.rb +1 -1
  34. data/spec/configuration/filter_spec.rb +63 -1
  35. data/spec/controllers/internal_helpers_spec.rb +7 -0
  36. data/spec/controllers/lolita_rest_spec.rb +1 -0
  37. data/spec/hooks_spec.rb +16 -15
  38. data/spec/navigation/tree_spec.rb +41 -18
  39. data/spec/orm/mongoid.rb +4 -7
  40. data/spec/rails_app/app/mongoid/address.rb +1 -1
  41. data/spec/rails_app/app/mongoid/category.rb +6 -0
  42. data/spec/rails_app/app/mongoid/comment.rb +2 -2
  43. data/spec/rails_app/app/mongoid/post.rb +10 -6
  44. data/spec/rails_app/app/mongoid/preference.rb +1 -1
  45. data/spec/rails_app/app/mongoid/profile.rb +3 -3
  46. data/spec/rails_app/app/mongoid/tag.rb +4 -0
  47. data/spec/support/factories/category.rb +3 -0
  48. data/spec/support/factories/post.rb +1 -0
  49. data/spec/support/factories/tag.rb +3 -0
  50. metadata +23 -14
  51. data/.project +0 -17
  52. data/lib/lolita/navigation.rb +0 -48
  53. data/log/development.log +0 -0
  54. data/test/cells/form_cell_test.rb +0 -15
  55. data/test/test_helper.rb +0 -2
@@ -47,6 +47,7 @@ module Lolita
47
47
  end
48
48
 
49
49
  def resource_with_attributes(current_resource,attributes={})
50
+ #TODO: detect rails date_select and datetime_select special attributes
50
51
  attributes||=resource_attributes
51
52
  attributes.each{|key,value|
52
53
  current_resource.send(:"#{key}=",value)
@@ -4,7 +4,7 @@ module Lolita
4
4
  # Hooks are stored in class <i>@hooks</i> variable, that is Hash and each key is hook name
5
5
  # and each hook also is Hash that have <em>:methods</em> and <em>:blocks</em>
6
6
  # keys. Both of those are Array, and each time you call callback method, like <i>before_save</i> and so on, block
7
- # and/or methods is stored. <b>Each time</b> #fire is called all blocks and methods will be executed.
7
+ # and/or methods is stored. <b>Each time</b> #run is called all blocks and methods will be executed.
8
8
  # It may look like this.
9
9
  # class MyClass
10
10
  # include Lolita::Hooks
@@ -19,7 +19,7 @@ module Lolita
19
19
  # ==Scopes
20
20
  # Most times hook callbacks are defined for class like in previous example, but also it's possible to do it
21
21
  # on class instances. Difference between calling it on class or on instance is that instance callbacks will
22
- # be called only when event is fired on instance. Class callbacks will be called on class and also on instance
22
+ # be called only when event is runned on instance. Class callbacks will be called on class and also on instance
23
23
  # callbacks.
24
24
  # my_object=MyClass.new
25
25
  # MyClass.before_save do
@@ -29,25 +29,25 @@ module Lolita
29
29
  # puts "instance callback"
30
30
  # end
31
31
  #
32
- # MyClass.fire(:before_save) #=>
32
+ # MyClass.run(:before_save) #=>
33
33
  # class_callback
34
34
  #
35
- # my_object.fire(:before_save) #=>
35
+ # my_object.run(:before_save) #=>
36
36
  # class_callback
37
37
  # instance_callback
38
38
  # # As you can see, first class callbacks is called and after that instance callbacks.
39
39
  #
40
40
  # ==Firing events
41
- # To execute callbacks, events should be called on object. Event names is same hooks names. #fire can be called
42
- # on class or on instance. Also it is possible to pass block to fire event, that will replace callback block
41
+ # To execute callbacks, events should be called on object. Event names is same hooks names. #run can be called
42
+ # on class or on instance. Also it is possible to pass block to run event, that will replace callback block
43
43
  # or if #let_content is called than it will work like wrapper, like this
44
44
  # # this is continuation of previous code
45
- # MyClass.fire(:before_save) do
45
+ # MyClass.run(:before_save) do
46
46
  # puts "replaced text"
47
47
  # end
48
48
  # # will produce #=> replaced text
49
49
  #
50
- # MyClass.fire(:before_save) do
50
+ # MyClass.run(:before_save) do
51
51
  # puts "before callback"
52
52
  # let_content
53
53
  # puts "after callback"
@@ -108,7 +108,7 @@ module Lolita
108
108
  @given_callback_content=content
109
109
  end
110
110
 
111
- # Callback content is used to let callback content executed insede of fire block.
111
+ # Callback content is used to let callback content executed insede of run block.
112
112
  def given_callback_content
113
113
  @given_callback_content
114
114
  end
@@ -147,13 +147,13 @@ module Lolita
147
147
  }
148
148
  end
149
149
 
150
- # Fire is used to execute callback. Method accept one or more <i>hook_names</i> and optional block.
150
+ # run is used to execute callback. Method accept one or more <i>hook_names</i> and optional block.
151
151
  # It will raise error if hook don't exist for this class. Also it accept <em>:scope</em> options, that
152
152
  # is used to #get_callbacks and #run_callbacks.
153
153
  # ====Example
154
- # MyClass.fire(:before_save,:after_save,:scope=>MyClass.new)
154
+ # MyClass.run(:before_save,:after_save,:scope=>MyClass.new)
155
155
  # # this will call callbacks in MyClass instance scope, that means that self will be MyClass instance.
156
- def fire(*hook_names,&block)
156
+ def run(*hook_names,&block)
157
157
  options=hook_names.extract_options!
158
158
  (hook_names || []).each do |hook_name|
159
159
  raise Lolita::HookNotFound, "Hook #{hook_name} is not defined for #{self}." unless self.has_hook?(hook_name)
@@ -169,19 +169,19 @@ module Lolita
169
169
  self.hooks.include?(name.to_sym)
170
170
  end
171
171
 
172
- # Try to recognize named fire methods like
173
- # MyClass.fire_after_save # will call MyClass.fire(:after_save)
172
+ # Try to recognize named run methods like
173
+ # MyClass.run_after_save # will call MyClass.run(:after_save)
174
174
  def method_missing(*args, &block)
175
175
  unless self.recognize_hook_methods(*args,&block)
176
176
  super
177
177
  end
178
178
  end
179
179
 
180
- # Call callback block inside of fire block.
180
+ # Call callback block inside of run block.
181
181
  # ====Example
182
- # MyClass.fire(:before_save) do
182
+ # MyClass.run(:before_save) do
183
183
  # do_stuff
184
- # let_content # execute callback block(-s) in same scope as fire is executed.
184
+ # let_content # execute callback block(-s) in same scope as run is executed.
185
185
  # end
186
186
  def let_content
187
187
  if content=self.given_callback_content
@@ -191,8 +191,8 @@ module Lolita
191
191
 
192
192
  # Set #method_missing
193
193
  def recognize_hook_methods method_name, *args, &block
194
- if method_name.to_s.match(/^fire_(\w+)/)
195
- self.fire($1,&block)
194
+ if method_name.to_s.match(/^run_(\w+)/)
195
+ self.run($1,&block)
196
196
  true
197
197
  end
198
198
  end
@@ -276,9 +276,9 @@ module Lolita
276
276
  # Methods for instance.
277
277
  module InstanceMethods
278
278
 
279
- # See Lolita::Hooks::ClassMethods#fire
280
- def fire(*hook_names)
281
- self.class.fire(*hook_names,:scope=>self)
279
+ # See Lolita::Hooks::ClassMethods#run
280
+ def run(*hook_names)
281
+ self.class.run(*hook_names,:scope=>self)
282
282
  end
283
283
 
284
284
  # See Lolita::Hooks::ClassMethods#let_content
@@ -11,7 +11,7 @@ module Lolita
11
11
  # go_to_honeymoon
12
12
  # end
13
13
  # john=Person.new("John")
14
- # john.fire(:get_merried) # and now john will go to honeymoon
14
+ # john.run(:get_merried) # and now john will go to honeymoon
15
15
  # Hooks are added for pluralized hook name, even if you pass like #add(:person), it will create named hook
16
16
  # with <i>people</i> name. This will be class, and when you call #person it will create instance for that class.
17
17
  class NamedHook
@@ -30,6 +30,7 @@ module Lolita
30
30
  named_hooks.keys
31
31
  end
32
32
 
33
+ # Detect that named hook exist with given name.
33
34
  def exist?(name)
34
35
  self.names.include?(name)
35
36
  end
@@ -44,6 +45,9 @@ module Lolita
44
45
  end
45
46
  end
46
47
 
48
+ # Find named hook filter.
49
+ # ====Example
50
+ # Lolita::Hooks::NamedHook.find(:components,:"list")
47
51
  def find(hook_name,filter_name)
48
52
  if named_hook=self.by_name(hook_name)
49
53
  named_hook[filter_name.to_sym]
@@ -99,14 +103,14 @@ module Lolita
99
103
  @hook_name
100
104
  end
101
105
 
102
- # def self.fire(*hook_names,&block)
106
+ # def self.run(*hook_names,&block)
103
107
  # hook_names||=[]
104
108
  # hook_names.extract_options!
105
109
  # super(*hook_names,&block)
106
110
  # if named_hook=self.by_name(self.hook_name)
107
111
  # named_hook.each{|filter_name, filter|
108
112
  # unless filter_name.to_sym==:"_class"
109
- # self.fire(*(hook_names + [{:scope=>filter}]),&block)
113
+ # self.run(*(hook_names + [{:scope=>filter}]),&block)
110
114
  # end
111
115
  # }
112
116
  # end
@@ -0,0 +1,7 @@
1
+ module Lolita
2
+ module Navigation
3
+ class Branch
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Lolita
2
+ module Navigation
3
+ class Tree
4
+
5
+ end
6
+ end
7
+ end
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lolita}
8
- s.version = "3.1.0"
8
+ s.version = "3.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["ITHouse", "Arturs Meisters"]
12
- s.date = %q{2011-04-12}
13
- s.description = %q{Great Rails CMS that allow you to start working with models right when you add this to your project.}
11
+ s.authors = ["ITHouse (Latvia) and Arturs Meisters"]
12
+ s.date = %q{2011-04-13}
13
+ s.description = %q{Great Rails CMS, that turns your business logic into good-looking, fully functional workspace. }
14
14
  s.email = %q{support@ithouse.lv}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".project",
22
21
  ".rspec",
23
- "GUIDELINE",
22
+ "GUIDELINES",
24
23
  "Gemfile",
24
+ "History.rdoc",
25
25
  "IDEA",
26
26
  "LICENSE.txt",
27
27
  "README.rdoc",
@@ -34,11 +34,16 @@ Gem::Specification.new do |s|
34
34
  "app/views/components/lolita/configuration/field/_label.html.erb",
35
35
  "app/views/components/lolita/configuration/field/_object.html.erb",
36
36
  "app/views/components/lolita/configuration/field/array/_display.html.erb",
37
+ "app/views/components/lolita/configuration/field/array/filter/_display.html.erb",
37
38
  "app/views/components/lolita/configuration/field/array/habtm/_display.html.erb",
38
39
  "app/views/components/lolita/configuration/field/array/select/_display.html.erb",
39
40
  "app/views/components/lolita/configuration/field/big_decimal/_display.html.erb",
40
41
  "app/views/components/lolita/configuration/field/boolean/_display.html.erb",
42
+ "app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb",
41
43
  "app/views/components/lolita/configuration/field/date/_display.html.erb",
44
+ "app/views/components/lolita/configuration/field/date_time/_display.html.erb",
45
+ "app/views/components/lolita/configuration/field/date_time/date/_display.html.erb",
46
+ "app/views/components/lolita/configuration/field/date_time/time/_display.html.erb",
42
47
  "app/views/components/lolita/configuration/field/float/_display.html.erb",
43
48
  "app/views/components/lolita/configuration/field/integer/_display.html.erb",
44
49
  "app/views/components/lolita/configuration/field/string/_display.html.erb",
@@ -101,6 +106,7 @@ Gem::Specification.new do |s|
101
106
  "lib/lolita/configuration/field/big_decimal.rb",
102
107
  "lib/lolita/configuration/field/boolean.rb",
103
108
  "lib/lolita/configuration/field/date.rb",
109
+ "lib/lolita/configuration/field/date_time.rb",
104
110
  "lib/lolita/configuration/field/integer.rb",
105
111
  "lib/lolita/configuration/field/string.rb",
106
112
  "lib/lolita/configuration/field/time.rb",
@@ -126,14 +132,14 @@ Gem::Specification.new do |s|
126
132
  "lib/lolita/mapping.rb",
127
133
  "lib/lolita/modules.rb",
128
134
  "lib/lolita/modules/rest.rb",
129
- "lib/lolita/navigation.rb",
135
+ "lib/lolita/navigation/branch.rb",
136
+ "lib/lolita/navigation/tree.rb",
130
137
  "lib/lolita/observed_array.rb",
131
138
  "lib/lolita/rails.rb",
132
139
  "lib/lolita/rails/all.rb",
133
140
  "lib/lolita/rails/routes.rb",
134
141
  "lib/lolita/ruby_ext/accessors.rb",
135
142
  "lib/lolita/test/matchers.rb",
136
- "log/development.log",
137
143
  "lolita.gemspec",
138
144
  "public/images/lolita/plus.png",
139
145
  "public/javascripts/jquery-1.5.1.min.js",
@@ -216,10 +222,12 @@ Gem::Specification.new do |s|
216
222
  "spec/rails_app/app/controllers/application_controller.rb",
217
223
  "spec/rails_app/app/helpers/application_helper.rb",
218
224
  "spec/rails_app/app/mongoid/address.rb",
225
+ "spec/rails_app/app/mongoid/category.rb",
219
226
  "spec/rails_app/app/mongoid/comment.rb",
220
227
  "spec/rails_app/app/mongoid/post.rb",
221
228
  "spec/rails_app/app/mongoid/preference.rb",
222
229
  "spec/rails_app/app/mongoid/profile.rb",
230
+ "spec/rails_app/app/mongoid/tag.rb",
223
231
  "spec/rails_app/app/views/components/lolita/configuration/list/_body_cell.html.erb",
224
232
  "spec/rails_app/config/application.rb",
225
233
  "spec/rails_app/config/boot.rb",
@@ -295,9 +303,9 @@ Gem::Specification.new do |s|
295
303
  "spec/routing/routes_spec.rb",
296
304
  "spec/simple_spec_helper.rb",
297
305
  "spec/spec_helper.rb",
306
+ "spec/support/factories/category.rb",
298
307
  "spec/support/factories/post.rb",
299
- "test/cells/form_cell_test.rb",
300
- "test/test_helper.rb"
308
+ "spec/support/factories/tag.rb"
301
309
  ]
302
310
  s.homepage = %q{http://github.com/ithouse/lolita}
303
311
  s.licenses = ["MIT"]
@@ -328,10 +336,12 @@ Gem::Specification.new do |s|
328
336
  "spec/rails_app/app/controllers/application_controller.rb",
329
337
  "spec/rails_app/app/helpers/application_helper.rb",
330
338
  "spec/rails_app/app/mongoid/address.rb",
339
+ "spec/rails_app/app/mongoid/category.rb",
331
340
  "spec/rails_app/app/mongoid/comment.rb",
332
341
  "spec/rails_app/app/mongoid/post.rb",
333
342
  "spec/rails_app/app/mongoid/preference.rb",
334
343
  "spec/rails_app/app/mongoid/profile.rb",
344
+ "spec/rails_app/app/mongoid/tag.rb",
335
345
  "spec/rails_app/config/application.rb",
336
346
  "spec/rails_app/config/boot.rb",
337
347
  "spec/rails_app/config/environment.rb",
@@ -348,9 +358,9 @@ Gem::Specification.new do |s|
348
358
  "spec/routing/routes_spec.rb",
349
359
  "spec/simple_spec_helper.rb",
350
360
  "spec/spec_helper.rb",
361
+ "spec/support/factories/category.rb",
351
362
  "spec/support/factories/post.rb",
352
- "test/cells/form_cell_test.rb",
353
- "test/test_helper.rb"
363
+ "spec/support/factories/tag.rb"
354
364
  ]
355
365
 
356
366
  if s.respond_to? :specification_version then
@@ -189,6 +189,22 @@ a.create {
189
189
  box-shadow: inset 0px 1px 1px #ddd;
190
190
  }
191
191
 
192
+ /* filter */
193
+ #main form.filter {
194
+ background: #F3F3F3;
195
+ padding: 10px;
196
+ }
197
+ #main form.filter select {
198
+ margin-right: 15px;
199
+ margin-bottom: 3px;
200
+ }
201
+ #main form.filter input {
202
+ vertical-align: middle;
203
+ margin: 0 10px 2px 3px;
204
+ }
205
+ #main form.filter label {
206
+ color: #666;
207
+ }
192
208
  /* --------------------------------------------- */
193
209
 
194
210
  /* TinyMCE advanced theme's skin "Cirkuit" overrides */
@@ -28,13 +28,13 @@ else
28
28
  class Comment < ActiveRecord::Base
29
29
  belongs_to :test_class1, :class_name=>"Post"
30
30
  end
31
+
31
32
  class Post < ActiveRecord::Base
32
33
  has_many :pages
33
34
  include Lolita::Configuration
34
35
  lolita
35
36
  end
36
37
 
37
-
38
38
  class Profile < ActiveRecord::Base
39
39
  include Lolita::Configuration
40
40
  lolita do
@@ -8,7 +8,6 @@ describe Lolita::Configuration::Filter do
8
8
 
9
9
  it "should create new filter with block" do
10
10
  Lolita::Configuration::Filter.new(@dbi) do
11
-
12
11
  end
13
12
  end
14
13
 
@@ -57,4 +56,67 @@ describe Lolita::Configuration::Filter do
57
56
  filter.fields[1].type.should == "integer"
58
57
  filter.fields[2].type.should == "time"
59
58
  end
59
+
60
+ it "should generate correct field_name" do
61
+ filter=Lolita::Configuration::Filter.new(@dbi)
62
+ filter.fields :name, :not_public
63
+ filter.field_name(filter.fields.first).should == "f_name"
64
+ filter.field_name(filter.fields.last).should == "f_not_public"
65
+ end
66
+
67
+ it "should return right options_for_select" do
68
+ 3.times{ Factory.create(:category)}
69
+ filter=Lolita::Configuration::Filter.new(@dbi) do
70
+ field :category
71
+ field :some_type, :array, :options_for_select => %w(a b c)
72
+ end
73
+ options = filter.options_for_select(filter.fields.first)
74
+ options.size.should == 3
75
+ options.first.first.should be_an(String)
76
+ options.first.last.should be_an(BSON::ObjectId)
77
+ options = filter.options_for_select(filter.fields.last)
78
+ options.size.should == 3
79
+ options.should == %w(a b c)
80
+ end
81
+
82
+ it "should filter results for boolean" do
83
+ Factory.create(:post, :is_public => true)
84
+ Factory.create(:post, :is_public => true)
85
+ Factory.create(:post, :is_public => false)
86
+
87
+ filter=Lolita::Configuration::Filter.new(@dbi) do
88
+ field :is_public
89
+ end
90
+
91
+ @dbi.filter(:is_public => 1).size.should == 2
92
+ @dbi.filter(:is_public => 0).size.should == 1
93
+ end
94
+
95
+ it "should filter results for belongs_to" do
96
+ c1 = Factory.create(:category, :name => "Linux")
97
+ c2 = Factory.create(:category, :name => "Android")
98
+ p1=Factory.create(:post, :category => c1)
99
+ p2=Factory.create(:post, :category => c1)
100
+ p3=Factory.create(:post, :category => c2)
101
+
102
+ filter=Lolita::Configuration::Filter.new(@dbi) do
103
+ field :tags
104
+ end
105
+ @dbi.filter(:category => c1.id).size.should == 2
106
+ @dbi.filter(:category => c2.id).size.should == 1
107
+ end
108
+
109
+ it "should filter results for has_and_belongs_to_many" do
110
+ tag1 = Factory.create(:tag, :name => "Linux")
111
+ tag2 = Factory.create(:tag, :name => "Android")
112
+ p1=Factory.create(:post, :tags => [tag1,tag2])
113
+ p2=Factory.create(:post, :tags => [tag1,tag2])
114
+ p3=Factory.create(:post, :tags => [tag1])
115
+
116
+ filter=Lolita::Configuration::Filter.new(@dbi) do
117
+ field :tags
118
+ end
119
+ @dbi.filter(:tags => tag1.id).size.should == 3
120
+ @dbi.filter(:tags => tag2.id).size.should == 2
121
+ end
60
122
  end
@@ -32,5 +32,12 @@ describe MyController do
32
32
  @controller.send(:resource=,nil)
33
33
  @controller.resource.should be_nil
34
34
  end
35
+
36
+ it "should convert rails date_select and datetime_select values" do
37
+ resource=Post.new
38
+ sample_date = Date.civil(2011,1,1)
39
+ attributes={:published_at => {}}
40
+ @controller.send(:resource_with_attributes,resource,attributes)
41
+ end
35
42
  end
36
43
 
@@ -13,6 +13,7 @@ describe Lolita::RestController do
13
13
  end
14
14
 
15
15
  it "should overwrite list component body_cell" do
16
+ Factory.create(:post)
16
17
  get :index
17
18
  response.body.should =~/overwritten cell/
18
19
  end
@@ -9,11 +9,11 @@ class MyClass
9
9
 
10
10
  attr_accessor :name
11
11
  def initialize
12
- self.fire(:after_init)
12
+ self.run(:after_init)
13
13
  end
14
14
 
15
15
  def save
16
- self.fire(:before_save)
16
+ self.run(:before_save)
17
17
  end
18
18
  end
19
19
 
@@ -91,17 +91,17 @@ describe Lolita::Hooks do
91
91
  MyClass.after_load do
92
92
  value(true)
93
93
  end
94
- MyClass.fire(:after_load)
94
+ MyClass.run(:after_load)
95
95
  MyClass.value.should be_true
96
96
  end
97
97
 
98
- it "should have named fire method" do
98
+ it "should have named run method" do
99
99
  MyClass.after_load {
100
100
  MyClass.value(MyClass.value()+1)
101
101
  }
102
102
  object=MyClass.new
103
- MyClass.fire_after_load
104
- object.fire_after_load
103
+ MyClass.run_after_load
104
+ object.run_after_load
105
105
  MyClass.value.should == 2
106
106
  end
107
107
 
@@ -110,22 +110,22 @@ describe Lolita::Hooks do
110
110
  MyClass.after_load do
111
111
  value(value()+1)
112
112
  end
113
- MyClass.fire(:after_load)
114
- MyClass.fire(:after_load)
113
+ MyClass.run(:after_load)
114
+ MyClass.run(:after_load)
115
115
  MyClass.value.should == 2
116
116
  end
117
117
 
118
118
 
119
119
  context "wrap around" do
120
120
 
121
- it "should allow to wrap around when #fire receive block" do
121
+ it "should allow to wrap around when #run receive block" do
122
122
  MyClass.after_load do
123
123
  value("first")
124
124
  let_content()
125
125
  value("second")
126
126
  end
127
127
 
128
- MyClass.fire(:after_load) do
128
+ MyClass.run(:after_load) do
129
129
  value().should=="first"
130
130
  end
131
131
  MyClass.value.should == "second"
@@ -159,7 +159,7 @@ describe Lolita::Hooks do
159
159
  Counter.set(Counter.get+1)
160
160
  end
161
161
 
162
- Lolita::Hooks.component(:"list").fire(:before)
162
+ Lolita::Hooks.component(:"list").run(:before)
163
163
  Counter.get.should == 1
164
164
  end
165
165
 
@@ -169,12 +169,13 @@ describe Lolita::Hooks do
169
169
  Lolita::Hooks.components.after do
170
170
  Counter.set(Counter.get+1)
171
171
  end
172
- Lolita::Hooks.component(:"list").fire(:after)
173
- Lolita::Hooks.component(:"tab").fire(:after)
172
+ Lolita::Hooks.component(:"list").run(:after)
173
+ Lolita::Hooks.component(:"tab").run(:after)
174
174
  Counter.get.should == 2
175
175
  end
176
176
 
177
- it "should run all named hook callbacks when fired on named collection" do
177
+ it "should run all named hook callbacks when runned on named collection" do
178
+ pending "Need to update functionality to work."
178
179
  Lolita::Hooks.components.add_hook(:after)
179
180
  Counter.set(0)
180
181
  Lolita::Hooks.component(:"list").after do
@@ -183,7 +184,7 @@ describe Lolita::Hooks do
183
184
  Lolita::Hooks.component(:"tab").after do
184
185
  Counter.set(Counter.get+1)
185
186
  end
186
- Lolita::Hooks.components.fire(:after)
187
+ Lolita::Hooks.components.run(:after)
187
188
  Counter.get.should == 2
188
189
  end
189
190