lanes 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.dir-locals.el +8 -0
  3. data/client/lanes/Config.coffee +1 -1
  4. data/client/lanes/access/Extension.coffee +1 -6
  5. data/client/lanes/access/screens/user-management/GridUserEditor.coffee +6 -5
  6. data/client/lanes/access/screens/user-management/grid-popover-editor.html +2 -2
  7. data/client/lanes/components/grid/vendor/jquery.dataTables.js +1 -1
  8. data/client/lanes/components/multi-select/MultiSelect.coffee +10 -5
  9. data/client/lanes/components/select-field/SelectField.coffee +2 -1
  10. data/client/lanes/models/Base.coffee +1 -1
  11. data/client/lanes/models/PubSub.coffee +4 -3
  12. data/client/lanes/models/Sync.coffee +3 -3
  13. data/client/lanes/screens/ChangeListener.coffee +0 -3
  14. data/client/lanes/testing/ModelSaver.coffee +12 -1
  15. data/client/lanes/views/Base.coffee +1 -1
  16. data/client/lanes/views/Helpers.coffee +2 -1
  17. data/client/lanes/views/SaveNotify.coffee +9 -7
  18. data/client/lanes/views/TimedMask.coffee +1 -1
  19. data/lanes.gemspec +1 -1
  20. data/lib/lanes/access/authentication_provider.rb +17 -11
  21. data/lib/lanes/access/config/routes.rb +1 -1
  22. data/lib/lanes/access/extension.rb +9 -2
  23. data/lib/lanes/access/role.rb +12 -0
  24. data/lib/lanes/access.rb +8 -8
  25. data/lib/lanes/api/null_authentication_provider.rb +2 -2
  26. data/lib/lanes/api/request_wrapper.rb +10 -10
  27. data/lib/lanes/concerns/association_extensions.rb +16 -7
  28. data/lib/lanes/concerns/pub_sub.rb +55 -30
  29. data/lib/lanes/guard_tasks.rb +7 -3
  30. data/lib/lanes/version.rb +1 -1
  31. data/{appy-app → spec/command-reference-files/initial}/.gitignore +0 -0
  32. data/{appy-app → spec/command-reference-files/initial}/Gemfile +1 -1
  33. data/{appy-app → spec/command-reference-files/initial}/Guardfile +0 -0
  34. data/{appy-app → spec/command-reference-files/initial}/Rakefile +0 -0
  35. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/Extension.coffee +0 -0
  36. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/Router.coffee +0 -0
  37. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/components/.gitkeep +0 -0
  38. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/controllers/.gitkeep +0 -0
  39. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/index.js +0 -0
  40. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/models/.gitkeep +0 -0
  41. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/models/Base.coffee +0 -0
  42. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/screens/.gitkeep +0 -0
  43. data/spec/{server/command-reference-files → command-reference-files}/initial/client/appy-app/screens/Base.coffee +0 -0
  44. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/styles.scss +0 -0
  45. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/views/.gitkeep +0 -0
  46. data/{appy-app → spec/command-reference-files/initial}/client/appy-app/views/Base.coffee +0 -0
  47. data/{appy-app → spec/command-reference-files/initial}/config/database.yml +0 -0
  48. data/{appy-app → spec/command-reference-files/initial}/config/lanes.rb +0 -0
  49. data/{appy-app → spec/command-reference-files/initial}/config/routes.rb +0 -0
  50. data/spec/{server/command-reference-files → command-reference-files}/initial/config/screens.rb +0 -0
  51. data/{appy-app → spec/command-reference-files/initial}/config.ru +0 -0
  52. data/{appy-app → spec/command-reference-files/initial}/db/.gitkeep +0 -0
  53. data/{appy-app → spec/command-reference-files/initial}/lib/appy-app/extension.rb +0 -0
  54. data/{appy-app → spec/command-reference-files/initial}/lib/appy-app/model.rb +0 -0
  55. data/{appy-app → spec/command-reference-files/initial}/lib/appy-app/models/empty.rb +0 -0
  56. data/{appy-app → spec/command-reference-files/initial}/lib/appy-app/version.rb +0 -0
  57. data/spec/{server/command-reference-files → command-reference-files}/initial/lib/appy-app.rb +0 -0
  58. data/{appy-app → spec/command-reference-files/initial}/spec/appy-app/helpers/AppyAppHelpers.coffee +0 -0
  59. data/{appy-app → spec/command-reference-files/initial}/spec/appy-app/screens/Base.coffee +0 -0
  60. data/{appy-app → spec/command-reference-files/initial}/spec/server/spec_helpers.rb +0 -0
  61. data/spec/{server/command-reference-files → command-reference-files}/model/client/appy-app/models/TestTest.coffee +0 -0
  62. data/spec/{server/command-reference-files → command-reference-files}/model/config/routes.rb +0 -0
  63. data/spec/{server/command-reference-files → command-reference-files}/model/db/migrate/20150218032025_create_test_tests.rb +0 -0
  64. data/spec/{server/command-reference-files → command-reference-files}/model/lib/appy-app/models/test_test.rb +0 -0
  65. data/spec/{server/command-reference-files → command-reference-files}/model/spec/appy-app/models/TestTestSpec.coffee +0 -0
  66. data/spec/{server/command-reference-files → command-reference-files}/model/spec/fixtures/appy-app/test_test.yml +0 -0
  67. data/spec/{server/command-reference-files → command-reference-files}/model/spec/server/test_test_spec.rb +0 -0
  68. data/spec/{server/command-reference-files → command-reference-files}/screen/client/appy-app/screens/ready-set-go/ReadySetGo.coffee +0 -0
  69. data/spec/{server/command-reference-files → command-reference-files}/screen/client/appy-app/screens/ready-set-go/index.js +0 -0
  70. data/spec/{server/command-reference-files → command-reference-files}/screen/client/appy-app/screens/ready-set-go/index.scss +0 -0
  71. data/spec/{server/command-reference-files → command-reference-files}/screen/client/appy-app/screens/ready-set-go/layout.html +0 -0
  72. data/spec/{server/command-reference-files → command-reference-files}/screen/config/screens.rb +0 -0
  73. data/spec/{server/command-reference-files → command-reference-files}/screen/spec/appy-app/screens/ready-set-go/ReadySetGoSpec.coffee +0 -0
  74. data/spec/{server/command-reference-files → command-reference-files}/view/client/appy-app/views/BigView.coffee +0 -0
  75. data/spec/{server/command-reference-files → command-reference-files}/view/spec/appy-app/views/BigViewSpec.coffee +0 -0
  76. data/spec/lanes/models/BaseSpec.coffee +4 -4
  77. data/spec/server/command_spec.rb +5 -1
  78. data/spec/server/concerns/association_extensions_spec.rb +0 -8
  79. data/spec/server/concerns/pub_sub_spec.rb +77 -31
  80. data/spec/server/spec_helper.rb +1 -0
  81. metadata +48 -91
  82. data/appy-app/client/appy-app/screens/Base.coffee +0 -10
  83. data/appy-app/config/screens.rb +0 -8
  84. data/appy-app/lib/appy-app.rb +0 -14
  85. data/spec/server/command-reference-files/initial/.gitignore +0 -3
  86. data/spec/server/command-reference-files/initial/Gemfile +0 -6
  87. data/spec/server/command-reference-files/initial/Guardfile +0 -13
  88. data/spec/server/command-reference-files/initial/Rakefile +0 -2
  89. data/spec/server/command-reference-files/initial/client/appy-app/Extension.coffee +0 -7
  90. data/spec/server/command-reference-files/initial/client/appy-app/Router.coffee +0 -4
  91. data/spec/server/command-reference-files/initial/client/appy-app/components/.gitkeep +0 -0
  92. data/spec/server/command-reference-files/initial/client/appy-app/controllers/.gitkeep +0 -0
  93. data/spec/server/command-reference-files/initial/client/appy-app/index.js +0 -21
  94. data/spec/server/command-reference-files/initial/client/appy-app/models/.gitkeep +0 -0
  95. data/spec/server/command-reference-files/initial/client/appy-app/models/Base.coffee +0 -5
  96. data/spec/server/command-reference-files/initial/client/appy-app/screens/.gitkeep +0 -0
  97. data/spec/server/command-reference-files/initial/client/appy-app/styles.scss +0 -1
  98. data/spec/server/command-reference-files/initial/client/appy-app/views/.gitkeep +0 -0
  99. data/spec/server/command-reference-files/initial/client/appy-app/views/Base.coffee +0 -5
  100. data/spec/server/command-reference-files/initial/config/database.yml +0 -9
  101. data/spec/server/command-reference-files/initial/config/lanes.rb +0 -7
  102. data/spec/server/command-reference-files/initial/config/routes.rb +0 -2
  103. data/spec/server/command-reference-files/initial/config.ru +0 -5
  104. data/spec/server/command-reference-files/initial/db/.gitkeep +0 -0
  105. data/spec/server/command-reference-files/initial/lib/appy-app/extension.rb +0 -13
  106. data/spec/server/command-reference-files/initial/lib/appy-app/model.rb +0 -11
  107. data/spec/server/command-reference-files/initial/lib/appy-app/models/empty.rb +0 -0
  108. data/spec/server/command-reference-files/initial/lib/appy-app/version.rb +0 -3
  109. data/spec/server/command-reference-files/initial/spec/appy-app/helpers/AppyAppHelpers.coffee +0 -5
  110. data/spec/server/command-reference-files/initial/spec/appy-app/screens/Base.coffee +0 -5
  111. data/spec/server/command-reference-files/initial/spec/server/spec_helpers.rb +0 -16
@@ -1,15 +1,5 @@
1
1
  module Lanes::Concerns
2
2
 
3
- module PendingEventListeners
4
- # @private
5
- @@listeners = Hash.new{ |hash, klass| hash[klass] = Hash.new{ |kh, event| kh[event]=Array.new } }
6
- # @api private
7
- def self.all
8
- @@listeners
9
- end
10
- end
11
-
12
-
13
3
  # Event subscription and publishing for Stockor Models
14
4
  # Every model has certain built-in events (:save, :create, :update, :destroy)
15
5
  # And may also implement custom events that reflect the models domain
@@ -24,6 +14,33 @@ module Lanes::Concerns
24
14
  module PubSub
25
15
  extend ActiveSupport::Concern
26
16
 
17
+
18
+ module PendingListeners
19
+ # @private
20
+ @@listeners = Hash.new{ |hash, klass|
21
+ hash[klass] = Hash.new{ |kh, event|
22
+ kh[event]=Array.new
23
+ }
24
+ }
25
+ class << self
26
+
27
+ # @api private
28
+ def claim(class_name)
29
+ if @@listeners.has_key?(class_name)
30
+ return @@listeners.delete(class_name)
31
+ else
32
+ return {}
33
+ end
34
+ end
35
+
36
+ # @api private
37
+ def add(class_name)
38
+ @@listeners[class_name]
39
+ end
40
+ end
41
+ end
42
+
43
+
27
44
  class InvalidEvent < RuntimeError
28
45
  end
29
46
 
@@ -31,35 +48,41 @@ module Lanes::Concerns
31
48
 
32
49
  class_attribute :valid_event_names
33
50
  class_attribute :_event_listeners
34
- self.valid_event_names = [ :save, :create, :update, :destroy ]
51
+ base.valid_event_names = [ :save, :create, :update, :destroy ]
35
52
 
36
- after_save :fire_after_save_events
37
- after_create :fire_after_create_events
38
- after_update :fire_after_update_events
39
- after_destroy :fire_after_destroy_events
53
+ base.after_save :fire_after_save_events
54
+ base.after_create :fire_after_create_events
55
+ base.after_update :fire_after_update_events
56
+ base.after_destroy :fire_after_destroy_events
40
57
  end
41
58
 
42
59
  module ClassMethods
43
60
  def inherited(base)
44
61
  super
45
62
  klass = base.to_s.demodulize
46
- if PendingEventListeners.all.has_key?( klass )
47
- events = PendingEventListeners.all.delete(klass)
48
- events.each{ | name, procs | base.event_listeners[name] += procs }
49
- end
50
- end
51
63
 
52
- def event_listeners
53
- self._event_listeners ||= Hash.new{ |hash, key| hash[key]=Array.new }
54
- end
64
+ #p klass
65
+ # if klass=="Tester"
66
+ # binding.pry
67
+ # end
68
+ events = PubSub::PendingListeners.claim( klass )
69
+ events.each{ | name, procs | base.event_listeners[name] += procs }
55
70
 
56
- def _add_event_listener( name, proc )
57
- self.event_listeners[name].push( proc ) unless self.event_listeners[name].include?(proc)
58
71
  end
59
72
 
60
73
  def observe( event, &block )
61
74
  _ensure_validate_event( event )
62
- _add_event_listener( event.to_sym, block )
75
+ _add_event_listener( event.to_sym, &block )
76
+ end
77
+
78
+ private
79
+
80
+ def _add_event_listener(name, &block)
81
+ self._event_listeners ||= Hash.new{ |hash, key| hash[key]=Array.new }
82
+ listeners = self._event_listeners[name].dup
83
+ listeners << block
84
+ self._event_listeners = self._event_listeners.dup
85
+ self._event_listeners[name] = listeners
63
86
  end
64
87
 
65
88
  def _ensure_validate_event(event)
@@ -68,14 +91,13 @@ module Lanes::Concerns
68
91
  end
69
92
  end
70
93
 
71
- protected
72
-
73
94
  def has_additional_events( *names )
74
95
  self.valid_event_names += names.map{ |name| name.to_sym }
75
96
  end
76
97
  end
77
98
 
78
99
  protected
100
+
79
101
  def fire_after_destroy_events
80
102
  _fire_event(:update, self )
81
103
  end
@@ -96,9 +118,12 @@ module Lanes::Concerns
96
118
  end
97
119
 
98
120
  private
121
+
99
122
  def _fire_event( name, *arguments )
100
- self.class.event_listeners[ name.to_sym ].each{ | block | block.call(*arguments) }
101
- return true
123
+ return if self.class._event_listeners.nil? ||
124
+ !self.class._event_listeners.has_key?(name.to_sym)
125
+
126
+ self.class._event_listeners[ name.to_sym ].each{ | block | block.call(*arguments) }
102
127
  end
103
128
  end
104
129
 
@@ -26,15 +26,19 @@ module Lanes
26
26
  spec_dir: "spec/#{app_name}", console: :always, debug: false
27
27
  })
28
28
 
29
+ minitest_options = {
30
+ all_on_start: true, test_folders: 'spec/server'
31
+ }
32
+
29
33
  dsl.guard :jasmine, jasmine_options do
30
34
  dsl.watch(%r{^client/(.+?)\.(js|coffee)$}){ |m| "spec/#{m[1]}Spec.#{m[2]}" }
31
35
  dsl.watch(%r{^spec/.*(?:_s|S)pec\.coffee$})
32
36
  matchers.client_matches.call if matchers.client_matches
33
37
  end
34
38
 
35
- dsl.guard :minitest, :all_on_start => true do
36
- dsl.watch(%r{^spec/spec_helper\.rb}) { 'test' }
37
- dsl.watch(%r{^spec/.+_spec\.rb})
39
+ dsl.guard :minitest, minitest_options do
40
+ dsl.watch(%r{^spec/server/spec_helper\.rb}) { 'test' }
41
+ dsl.watch(%r{^spec/server/.+_spec\.rb})
38
42
  dsl.watch(%r{^spec/fixtures/#{app_name}/(.+)s\.yml}) { |m| "spec/server/#{m[1]}_spec.rb" }
39
43
  dsl.watch(%r{^lib/#{app_name}/(.+)\.rb}) { |m| "spec/server/#{m[1]}_spec.rb" }
40
44
  matchers.server_matches.call if matchers.server_matches
data/lib/lanes/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Lanes
2
2
 
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
 
5
5
  end
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "lanes", '0.1.5'
3
+ gem "lanes", '0.1.6'
4
4
 
5
5
  gem "rake"
6
6
  gem 'puma'
@@ -12,12 +12,12 @@ describe "Lanes.Models.Base", ->
12
12
  props:
13
13
  saved: 'string'
14
14
  }, {bar: 'baz'})
15
- expect(model.isDirty()).toBe(false)
15
+ expect(model.isDirty).toBe(false)
16
16
  model.foo = 'baz' # session prop
17
- expect(model.isDirty()).toBe(false)
17
+ expect(model.isDirty).toBe(false)
18
18
  expect(model.unsavedAttributes()).toBeEmptyObject()
19
19
  model.set( saved: 'true' )
20
- expect(model.isDirty()).toBe(true)
20
+ expect(model.isDirty).toBe(true)
21
21
 
22
22
 
23
23
  it "can tell if it has attributes", ->
@@ -62,7 +62,7 @@ describe "Lanes.Models.Base", ->
62
62
  bar: 'string'
63
63
 
64
64
  }, { foo: 'one, two, three'} )
65
- expect(model.isDirty()).toBe(true)
65
+ expect(model.isDirty).toBe(true)
66
66
  expect(model.unsavedAttributes()).toEqual( foo: 'one, two, three' )
67
67
  model.save()
68
68
  expect(model.sync).toHaveBeenCalledWith('create', model, jasmine.any(Object))
@@ -7,7 +7,7 @@ describe Lanes::Command do
7
7
  let(:app_name) { "appy-app" }
8
8
  let(:lanes) { Pathname.new(__FILE__).dirname.join('..','..','bin','lanes') }
9
9
  let(:generated_path) { Pathname.pwd }
10
- let(:reference_path) { Pathname(__FILE__).dirname.join("command-reference-files") }
10
+ let(:reference_path) { Pathname(__FILE__).dirname.join("..","command-reference-files") }
11
11
 
12
12
  around do |test|
13
13
  Dir.mktmpdir do |dir|
@@ -34,6 +34,10 @@ describe Lanes::Command do
34
34
 
35
35
  it "generates an application" do
36
36
  reference = reference_path.join('initial')
37
+ gemfile = reference.join("Gemfile")
38
+ gemfile.write gemfile.read.gsub(/gem \"lanes\", \'\d+\.\d+\.\d+\'/, "gem \"lanes\", '#{Lanes::VERSION}'")
39
+
40
+
37
41
  compare_generated(reference)
38
42
  generated_path.find.each do | path |
39
43
  relative = path.relative_path_from(generated_path)
@@ -11,14 +11,6 @@ class AssociationExtensionsTest < Lanes::TestCase
11
11
  assert_match( /does not have an inverse_of specified./, err.message )
12
12
  end
13
13
 
14
- def test_adds_listener
15
- Tmhm.belongs_to(:tm)
16
- TestModel.has_one(:tmhm,:listen=>{:save=>:on_tmhm_save}, :inverse_of=>:tm)
17
- tm = TestModel.new
18
- tm.expects(:on_tmhm_save)
19
- tm.build_tmhm
20
- assert tm.save
21
- end
22
14
 
23
15
  def test_exports_associations
24
16
  TestModel.expects(:export_associations).with(:tmhm,{})
@@ -1,35 +1,79 @@
1
1
  require_relative "../spec_helper"
2
2
 
3
- class PubSubTest < Lanes::TestCase
3
+ describe "PubSub" do
4
4
 
5
- class EventTester
6
- def self.after_save(*args); end
7
- def self.after_create(*args); end
8
- def self.after_update(*args); end
9
- def self.after_destroy(*args); end
5
+ include ActiveRecordMocks::IncludeMe
6
+ around do | test |
7
+ with_mocked_tables do |m|
8
+ m.create_table do |t|
9
+ t.model_name :Evbt
10
+ t.belongs_to :evhm, class_name: "Evhm", listen: { create: 'on_create_hm' },
11
+ inverse_of: :evbt
12
+ t.layout do |l|
13
+ l.integer :evhm_id
14
+ end
15
+ t.parent_class "Lanes::Model"
16
+ end
17
+ class Evbt
18
+ has_additional_events :test_one
19
+ def on_create_hm(*args)
20
+ 32
21
+ end
22
+ end
23
+
24
+ m.create_table do |t|
25
+ t.model_name :EventTester
26
+ t.parent_class "Lanes::Model"
27
+ t.belongs_to :evbt, class_name: 'Evhm'
28
+
29
+ t.has_many :evhm, class_name: 'Evhm', inverse_of: :event_tester
30
+
31
+ t.layout do |l|
32
+ l.integer :bt_id
33
+ l.string :name, :number
34
+ end
35
+ end
36
+
37
+ table = m.create_table do |t|
38
+ t.model_name :Evhm
39
+ t.belongs_to :evbt, class_name: "Evbt", listen: { save: 'on_create_bt' },
40
+ inverse_of: :evhm
41
+ t.belongs_to :event_tester, class_name: "EventTester", inverse_of: :evhm,
42
+ listen: { save: 'on_save_event_tester' }
43
+ t.parent_class "Lanes::Model"
44
+ t.layout do | l |
45
+ l.string :mumble
46
+ l.integer :evbt_id, :event_tester_id
47
+ end
48
+ end
49
+ def table.on_save_event_tester(*args)
50
+ end
10
51
 
11
- include Lanes::Concerns::PubSub
12
52
 
13
- def trigger( event, *args )
14
- fire_event(event, *args )
53
+
54
+ test.call
15
55
  end
16
56
  end
17
57
 
18
- class Ev1 < EventTester
19
- has_additional_events :test_one
20
- end
58
+ it "listens to other associations" do
59
+ e=Evbt.new
60
+ assert_equal 32, e.on_create_hm
61
+ b=e.build_evhm
62
+ b.expects(:on_create_bt)
63
+ assert e.save
21
64
 
22
- class Ev2 < EventTester
23
- has_additional_events :test_two
65
+ et = EventTester.new
66
+ evh = et.evhm.build
67
+ evh.expects(:on_save_event_tester)
68
+ assert et.save
24
69
  end
25
70
 
26
-
27
- def test_event_name_registration
71
+ it "registers" do
28
72
  assert_equal [ :save, :create, :update, :destroy ],EventTester.valid_event_names
29
- assert_equal [ :save, :create, :update, :destroy, :test_one ],Ev1.valid_event_names
73
+ assert_equal [ :save, :create, :update, :destroy, :test_one ],Evbt.valid_event_names
30
74
  end
31
75
 
32
- def test_only_valid
76
+ it "can only observe valid events" do
33
77
  assert_raises( EventTester::InvalidEvent) do
34
78
  EventTester.observe(:invalid_event) do | ev |
35
79
  end
@@ -37,45 +81,47 @@ class PubSubTest < Lanes::TestCase
37
81
  assert_raises( EventTester::InvalidEvent) do
38
82
  EventTester.observe(:save) do | ev |
39
83
  end
40
- EventTester.new.trigger(:invalid_event)
84
+ EventTester.new.send(:fire_event,:invalid_event)
41
85
  end
42
86
  assert_raises( EventTester::InvalidEvent) do
43
- Ev1.observe(:test_two) do | ev |
87
+ Evbt.observe(:test_two) do | ev |
44
88
  end
45
89
  end
46
90
  assert_raises( EventTester::InvalidEvent) do
47
- Ev2.observe(:test_one) do | ev |
91
+ Evhm.observe(:test_one) do | ev |
48
92
  end
49
93
  end
50
94
  begin
51
- Ev2.observe(:test_one) do | ev |
95
+ Evbt.observe(:test_one) do | ev |
52
96
  end
53
97
  rescue EventTester::InvalidEvent=>e
54
98
  assert_equal 'test_one is not a valid event for PubSubTest::Ev2', e.to_s
55
99
  end
56
100
  end
57
101
 
58
- def test_subscription
102
+ it "events can be subscribed to" do
59
103
  EventTester.observe(:save) do | ev |
104
+
60
105
  end
61
106
  end
62
- def test_firing
107
+
108
+ it "can be fired and observed" do
63
109
  results=[]
64
- Ev1.observe(:test_one) do | ev, one, two |
110
+ Evbt.observe(:test_one) do | ev, one, two |
65
111
  results = [ ev, one, two ]
66
112
  end
67
- evt=Ev1.new
68
- evt.trigger( :test_one, 3, 5 )
113
+ evt=Evbt.new
114
+ evt.send(:fire_event, :test_one, 3, 5 )
69
115
  assert_equal [ evt, 3, 5 ], results
70
116
 
71
- evt.trigger( :test_one, 'foo' )
117
+ evt.send(:fire_event, :test_one, 'foo' )
72
118
  assert_equal [ evt, 'foo', nil ], results
73
119
  end
74
120
 
75
121
 
76
- def test_firing_with_assertsions
77
- assert_event_fires( Ev1, :test_one ) do
78
- Ev1.new.trigger( :test_one, 3, 5 )
122
+ it "can use custom event assertions" do
123
+ assert_event_fires( Evbt, :test_one ) do
124
+ Evbt.new.send(:fire_event, :test_one, 3, 5 )
79
125
  end
80
126
  assert_equal [ 3, 5 ], last_event_results[1..-1]
81
127
  end
@@ -4,6 +4,7 @@ require "active_record_mocks"
4
4
 
5
5
  require 'lanes/command'
6
6
  require 'lanes/workspace/extension'
7
+ require 'mocha/mini_test'
7
8
 
8
9
  # ext = Extensions.controlling
9
10
  # if ext.is_a?(::Lanes::Extensions::Base)