ventable 0.0.6 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 081c78cd805ad7b5dce14dbe88ad7177240152c6
4
- data.tar.gz: 2a1a56d21086cdf8ce6dab880b2911af9bd8eb20
3
+ metadata.gz: d49bbdbaf27b03c942ba8887eb4eca4c89f63cbc
4
+ data.tar.gz: c75ae281c96bfa5998c6f338ba5fd6d5bb164ace
5
5
  SHA512:
6
- metadata.gz: 81de27f259688d1132d67a6f0d47500c47ad10f1d5a9624c8f0890f49376cdc738ea9abc16cf958034579b50ce7614b7341d0112df4c2df2ef14fb377a5fab0e
7
- data.tar.gz: 4e418cbc41c2c154b22be27f2cffaec76952da3e2dc49391b64c56ba18d862ef0859ccad5f74ed5c55349d9bf6f1697a823f862527188054cdf9ef3870163219
6
+ metadata.gz: 7d130ab305df24c7f31e1fc11dcf7cc64c560edd2311ff6330ebeb33394ed819e444795b8f6c5fb3aff8ba9371c96c746dbec17db3ac3b368a149891bde5fc0c
7
+ data.tar.gz: 2f12228bb3d42a58d7534f077844b26c5f1212c104b5da2bbf8aa4facb2f1783f86cfa1abc10e8b08982cbcfd6a07efbd6dd8f8afb9e76e42ecd271e06f07887
@@ -0,0 +1,10 @@
1
+ {
2
+ "cmd": "eval \"$(rbenv init -)\"; bundle exec rspec",
3
+ "name": "Run All Specs",
4
+ "args": [ "-c", "-b", "-p 1", "--format progress"],
5
+ "sh": true,
6
+ "errorMatch": [
7
+ "rspec (?<file>[\\/0-9a-zA-Z\\._]+):(?<line>\\d+) #"
8
+ ],
9
+ "keymap": "cmd-2"
10
+ }
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
1
  --color
2
2
  --format progress
3
+ --backtrace
4
+ -p 1
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ventable (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.0)
10
+ diff-lcs (1.2.5)
11
+ ffi (1.9.10)
12
+ formatador (0.2.5)
13
+ guard (2.13.0)
14
+ formatador (>= 0.2.4)
15
+ listen (>= 2.7, <= 4.0)
16
+ lumberjack (~> 1.0)
17
+ nenv (~> 0.1)
18
+ notiffany (~> 0.0)
19
+ pry (>= 0.9.12)
20
+ shellany (~> 0.0)
21
+ thor (>= 0.18.1)
22
+ guard-compat (1.2.1)
23
+ guard-rspec (4.6.4)
24
+ guard (~> 2.1)
25
+ guard-compat (~> 1.1)
26
+ rspec (>= 2.99.0, < 4.0)
27
+ listen (3.0.5)
28
+ rb-fsevent (>= 0.9.3)
29
+ rb-inotify (>= 0.9)
30
+ lumberjack (1.0.10)
31
+ method_source (0.8.2)
32
+ nenv (0.2.0)
33
+ notiffany (0.0.8)
34
+ nenv (~> 0.1)
35
+ shellany (~> 0.0)
36
+ pry (0.10.3)
37
+ coderay (~> 1.1.0)
38
+ method_source (~> 0.8.1)
39
+ slop (~> 3.4)
40
+ rake (10.5.0)
41
+ rb-fsevent (0.9.7)
42
+ rb-inotify (0.9.5)
43
+ ffi (>= 0.5.0)
44
+ rspec (3.4.0)
45
+ rspec-core (~> 3.4.0)
46
+ rspec-expectations (~> 3.4.0)
47
+ rspec-mocks (~> 3.4.0)
48
+ rspec-core (3.4.1)
49
+ rspec-support (~> 3.4.0)
50
+ rspec-expectations (3.4.0)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.4.0)
53
+ rspec-mocks (3.4.1)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.4.0)
56
+ rspec-support (3.4.1)
57
+ shellany (0.0.1)
58
+ slop (3.6.0)
59
+ thor (0.19.1)
60
+
61
+ PLATFORMS
62
+ ruby
63
+
64
+ DEPENDENCIES
65
+ guard-rspec
66
+ rake
67
+ rspec
68
+ rspec-mocks
69
+ ventable!
70
+
71
+ BUNDLED WITH
72
+ 1.11.2
data/README.md CHANGED
@@ -184,7 +184,7 @@ via a background queue, such as Sidekiq or Resque. If you are interested in help
184
184
 
185
185
  For more information, check out the following blog post:
186
186
 
187
- [Detangling Business Logic in Rails Apps with Pure Ruby Observers](http://building.wanelo.com/post/57442907639/detangling-business-logic-in-rails-apps-with-poro).
187
+ [Detangling Business Logic in Rails Apps with Pure Ruby Observers](http://building.wanelo.com/2013/08/05/detangling-business-logic-in-rails-apps-with-poro-events-and-observers.html).
188
188
 
189
189
  ## Contributing
190
190
 
@@ -1,3 +1,3 @@
1
1
  module Ventable
2
- VERSION = "0.0.6"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -11,25 +11,25 @@ describe Ventable do
11
11
  after { Ventable.enable }
12
12
 
13
13
  it 'is true by default' do
14
- expect(Ventable.enabled?).to be_true
14
+ expect(Ventable.enabled?).to be true
15
15
  end
16
16
 
17
17
  it 'is false after Ventable is disabled' do
18
18
  Ventable.disable
19
- expect(Ventable.enabled?).to be_false
19
+ expect(Ventable.enabled?).to be false
20
20
  end
21
21
 
22
22
  it 'is true after Ventable is re-enabled' do
23
23
  Ventable.disable
24
24
  Ventable.enable
25
- expect(Ventable.enabled?).to be_true
25
+ expect(Ventable.enabled?).to be true
26
26
  end
27
27
  end
28
28
 
29
29
  describe "including Ventable::Event" do
30
30
  it "should create a class instance variable to keep observers" do
31
- TestEvent.observers.should_not be_nil
32
- TestEvent.observers.should be_a(Set)
31
+ expect(TestEvent.observers).not_to be_nil
32
+ expect(TestEvent.observers.class.name).to eq("Set")
33
33
  end
34
34
 
35
35
  it "should see observers variable from instance methods" do
@@ -37,14 +37,14 @@ describe Ventable do
37
37
  TestEvent.new.instance_eval do
38
38
  observers = self.class.observers
39
39
  end
40
- observers.should_not be_nil
40
+ expect(observers).to_not be_nil
41
41
  end
42
42
 
43
43
  it "should maintain separate sets of observers for each event" do
44
44
  class AnotherEvent
45
45
  include Ventable::Event
46
46
  end
47
- AnotherEvent.observers.object_id.should_not == TestEvent.observers.object_id
47
+ expect(AnotherEvent.observers.object_id).to_not eq(TestEvent.observers.object_id)
48
48
  end
49
49
  end
50
50
 
@@ -62,38 +62,37 @@ describe Ventable do
62
62
  run_block = true
63
63
  event = e
64
64
  end
65
- run_block.should_not be_true
66
- event.should be_nil
65
+ expect(run_block).to eq(false)
66
+ expect(event).to be_nil
67
67
 
68
68
  # fire the event
69
69
  TestEvent.new.fire!
70
70
 
71
- run_block.should be_true
72
- event.should_not be_nil
71
+ expect(run_block).to be true
72
+ expect(event).not_to be_nil
73
73
  end
74
74
 
75
75
  it "should properly call a class observer" do
76
- TestEvent.instance_eval do
76
+ class TestEvent
77
77
  class << self
78
78
  attr_accessor :flag
79
79
  end
80
- end
81
-
82
- TestEvent.class_eval do
83
- def set_flag!
84
- self.class.flag = true
80
+ self.flag = "unset"
81
+ def flag= value
82
+ self.class.flag = value
85
83
  end
86
84
  end
85
+
87
86
  class TestEventObserver
88
87
  def self.handle_test event
89
- event.set_flag!
88
+ event.flag = "boo"
90
89
  end
91
90
  end
92
91
  TestEvent.notifies TestEventObserver
93
- TestEvent.flag.should be_false
92
+ expect(TestEvent.flag).to eq("unset")
94
93
 
95
94
  TestEvent.new.fire!
96
- TestEvent.flag.should be_true
95
+ expect(TestEvent.flag).to eq("boo")
97
96
  end
98
97
 
99
98
  it "should properly call a group of observers" do
@@ -118,19 +117,18 @@ describe Ventable do
118
117
  event_inside = event
119
118
  end
120
119
 
121
- transaction_called.should be_false
122
- transaction_already_completed.should be_false
123
- observer_block_called.should be_false
120
+ expect(transaction_called).to be false
121
+ expect(transaction_already_completed).to be false
122
+ expect(observer_block_called).to be false
124
123
 
125
124
  TestEvent.new.fire!
126
125
 
127
- transaction_called.should be_true
128
- observer_block_called.should be_true
129
- transaction_called.should be_true
130
- transaction_already_completed.should be_false
131
-
132
- event_inside.should_not be_nil
133
- event_inside.should be_a(TestEvent)
126
+ expect(transaction_called).to be true
127
+ expect(observer_block_called).to be true
128
+ expect(transaction_called).to be true
129
+ expect(transaction_already_completed).to be false
130
+ expect(event_inside).to_not be_nil
131
+ expect(event_inside).to be_a(TestEvent)
134
132
  end
135
133
 
136
134
  context 'when globally disabled' do
@@ -145,7 +143,7 @@ describe Ventable do
145
143
  end
146
144
 
147
145
  TestEvent.new.fire!
148
- expect(observers_notified).to be_false
146
+ expect(observers_notified).to be false
149
147
  end
150
148
  end
151
149
  end
@@ -175,15 +173,15 @@ describe Ventable do
175
173
  end
176
174
 
177
175
  it "should properly set the callback method name" do
178
- SomeAwesomeEvent.default_callback_method.should == :handle_some_awesome
179
- Blah::AnotherSweetEvent.default_callback_method.should == :handle_blah__another_sweet
180
- SomeOtherStuffHappened.default_callback_method.should == :handle_some_other_stuff_happened
181
- ClassWithCustomCallbackMethodEvent.default_callback_method.should == :handle_my_special_event
176
+ expect(SomeAwesomeEvent.default_callback_method).to eq(:handle_some_awesome)
177
+ expect(Blah::AnotherSweetEvent.default_callback_method).to eq(:handle_blah__another_sweet)
178
+ expect(SomeOtherStuffHappened.default_callback_method).to eq(:handle_some_other_stuff_happened)
179
+ expect(ClassWithCustomCallbackMethodEvent.default_callback_method).to eq(:handle_my_special_event)
182
180
  end
183
181
  end
184
182
 
185
183
  describe "#configure" do
186
- it "properly configures the event with observesrs" do
184
+ it "properly configures the event with observers" do
187
185
  notified_observer = false
188
186
  TestEvent.configure do
189
187
  notifies do
@@ -191,7 +189,7 @@ describe Ventable do
191
189
  end
192
190
  end
193
191
  TestEvent.new.fire!
194
- notified_observer.should be_true
192
+ expect(notified_observer).to be true
195
193
  end
196
194
 
197
195
  it "configures observers with groups" do
@@ -207,8 +205,8 @@ describe Ventable do
207
205
  end
208
206
  end
209
207
  TestEvent.new.fire!
210
- notified_observer.should be_true
211
- called_transaction.should be_true
208
+ expect(notified_observer).to be true
209
+ expect(called_transaction).to be true
212
210
  end
213
211
 
214
212
  it "throws exception if :inside references unknown group" do
@@ -220,7 +218,7 @@ describe Ventable do
220
218
  end
221
219
  fail "Shouldn't reach here, must throw a valid exception"
222
220
  rescue Exception => e
223
- e.class.should == Ventable::Error
221
+ expect(e.class).to eq(Ventable::Error)
224
222
  end
225
223
  end
226
224
  it "throws exception if nil observer added to the list" do
@@ -230,7 +228,7 @@ describe Ventable do
230
228
  end
231
229
  fail "Shouldn't reach here, must throw a valid exception"
232
230
  rescue Exception => e
233
- e.class.should == Ventable::Error
231
+ expect(e.class).to eq(Ventable::Error)
234
232
  end
235
233
  end
236
234
  end
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = Ventable::VERSION
18
18
 
19
+ gem.add_development_dependency "rake"
19
20
  gem.add_development_dependency "rspec"
20
21
  gem.add_development_dependency "rspec-mocks"
21
22
  gem.add_development_dependency 'guard-rspec'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ventable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,10 +73,12 @@ executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
76
+ - ".atom-build.json"
62
77
  - ".gitignore"
63
78
  - ".rspec"
64
79
  - ".travis.yml"
65
80
  - Gemfile
81
+ - Gemfile.lock
66
82
  - Guardfile
67
83
  - LICENSE
68
84
  - README.md
@@ -92,11 +108,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
108
  version: '0'
93
109
  requirements: []
94
110
  rubyforge_project:
95
- rubygems_version: 2.2.0
111
+ rubygems_version: 2.5.1
96
112
  signing_key:
97
113
  specification_version: 4
98
114
  summary: Event/Observable design pattern in ruby
99
115
  test_files:
100
116
  - spec/spec_helper.rb
101
117
  - spec/ventable/ventable_spec.rb
102
- has_rdoc: