nodevent 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.
data/.travis.yml CHANGED
@@ -3,7 +3,8 @@ rvm:
3
3
  - 1.9.3
4
4
  - jruby-18mode # JRuby in 1.8 mode
5
5
  - jruby-19mode # JRuby in 1.9 mode
6
+ - 1.8.7
6
7
  - rbx-18mode
7
8
  - rbx-19mode
8
- - 1.8.7
9
+
9
10
  script: rspec
@@ -1,3 +1,3 @@
1
1
  module Nodevent
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.1"
3
3
  end
data/lib/nodevent.rb CHANGED
@@ -66,8 +66,8 @@ module NoDevent
66
66
 
67
67
  def config
68
68
  @@config ||= Hash.new({
69
- :host => "http://localhost:8080",
70
- :namespace => "/nodevent"
69
+ "host" => "http://localhost:8080",
70
+ "namespace" => "/nodevent"
71
71
  })
72
72
  @@config
73
73
  end
@@ -75,7 +75,7 @@ module NoDevent
75
75
  def emit(room, name, message)
76
76
  room = NoDevent::Emitter.room(room)
77
77
 
78
- $redis.publish(@@config[:namespace],
78
+ $redis.publish(@@config["namespace"],
79
79
  { :room => room,
80
80
  :event => name,
81
81
  :message => message}.to_json)
@@ -92,7 +92,7 @@ module NoDevent
92
92
  r = room(obj)
93
93
  ts = (expires.to_f*1000).to_i
94
94
 
95
- (Digest::SHA2.new << obj.to_s << ts.to_s<< @@config[:secret]).to_s
95
+ (Digest::SHA2.new << obj.to_s << ts.to_s<< @@config["secret"]).to_s
96
96
  end
97
97
  end
98
98
  end
data/spec/base_spec.rb CHANGED
@@ -18,9 +18,9 @@ class ModelMock < ActiveRecord::Base
18
18
  end
19
19
 
20
20
  NoDevent::Emitter.config = {
21
- :host => "http://thehost",
22
- :namespace => "thenamespace",
23
- :secret => "asdf"
21
+ "host" => "http://thehost",
22
+ "namespace" => "/nodevent",
23
+ "secret" => "asdf"
24
24
  }
25
25
 
26
26
  describe NoDevent do
@@ -29,7 +29,7 @@ describe NoDevent do
29
29
  it { ModelMock.room.should == "ModelMock" }
30
30
 
31
31
  it "should emit to the right room" do
32
- $redis.should_receive(:publish).with("events",
32
+ $redis.should_receive(:publish).with("/nodevent",
33
33
  {
34
34
  :room => "ModelMock",
35
35
  :event => 'theevent',
@@ -42,7 +42,7 @@ describe NoDevent do
42
42
  t = Time.now
43
43
  ts = (t.to_f*1000).to_i
44
44
  ModelMock.room_key(t).should ==
45
- (Digest::SHA2.new << "ModelMock" << ts.to_s << NoDevent::Emitter.config[:secret]).to_s
45
+ (Digest::SHA2.new << "ModelMock" << ts.to_s << NoDevent::Emitter.config["secret"]).to_s
46
46
  end
47
47
 
48
48
  describe "with a custom room name" do
@@ -53,7 +53,7 @@ describe NoDevent do
53
53
  it { ModelMock.room.should == "otherRoom" }
54
54
 
55
55
  it "should emit to the right room" do
56
- $redis.should_receive(:publish).with("events",
56
+ $redis.should_receive(:publish).with("/nodevent",
57
57
  {
58
58
  :room => "otherRoom",
59
59
  :event => 'theevent',
@@ -66,7 +66,7 @@ describe NoDevent do
66
66
  t = Time.now
67
67
  ts = (t.to_f*1000).to_i
68
68
  ModelMock.room_key(t).should ==
69
- (Digest::SHA2.new << ModelMock.room << ts.to_s << NoDevent::Emitter.config[:secret]).to_s
69
+ (Digest::SHA2.new << ModelMock.room << ts.to_s << NoDevent::Emitter.config["secret"]).to_s
70
70
  end
71
71
  end
72
72
  end
@@ -76,7 +76,7 @@ describe NoDevent do
76
76
 
77
77
  it { instance.room.should == "ModelMock_theparam" }
78
78
  it "should emit to the right room" do
79
- $redis.should_receive(:publish).with("events",
79
+ $redis.should_receive(:publish).with("/nodevent",
80
80
  {
81
81
  :room => "ModelMock_theparam",
82
82
  :event => 'theevent',
@@ -87,7 +87,7 @@ describe NoDevent do
87
87
 
88
88
  describe "#nodevent_create" do
89
89
  it "should emit to the right room" do
90
- $redis.should_receive(:publish).with("events",
90
+ $redis.should_receive(:publish).with("/nodevent",
91
91
  {
92
92
  :room => "ModelMock",
93
93
  :event => 'create',
@@ -98,7 +98,7 @@ describe NoDevent do
98
98
  end
99
99
  describe "#nodevent_update" do
100
100
  it "should emit to the right room" do
101
- $redis.should_receive(:publish).with("events",
101
+ $redis.should_receive(:publish).with("/nodevent",
102
102
  {
103
103
  :room => "ModelMock_theparam",
104
104
  :event => 'update',
@@ -112,7 +112,7 @@ describe NoDevent do
112
112
  t = Time.now
113
113
  ts = (t.to_f*1000).to_i
114
114
  instance.room_key(t).should ==
115
- (Digest::SHA2.new << instance.room << ts.to_s << NoDevent::Emitter.config[:secret]).to_s
115
+ (Digest::SHA2.new << instance.room << ts.to_s << NoDevent::Emitter.config["secret"]).to_s
116
116
  end
117
117
 
118
118
  describe "with a custom room name" do
@@ -123,7 +123,7 @@ describe NoDevent do
123
123
  it { instance.room.should == "otherRoom" }
124
124
 
125
125
  it "should emit to the right room" do
126
- $redis.should_receive(:publish).with("events",
126
+ $redis.should_receive(:publish).with("/nodevent",
127
127
  {
128
128
  :room => "otherRoom",
129
129
  :event => 'theevent',
@@ -136,11 +136,11 @@ describe NoDevent do
136
136
  t = Time.now
137
137
  ts = (t.to_f*1000).to_i
138
138
  instance.room_key(t).should ==
139
- (Digest::SHA2.new << "otherRoom" << ts.to_s << NoDevent::Emitter.config[:secret]).to_s
139
+ (Digest::SHA2.new << "otherRoom" << ts.to_s << NoDevent::Emitter.config["secret"]).to_s
140
140
  end
141
141
  describe "#nodevent_create" do
142
142
  it "should emit to the right room" do
143
- $redis.should_receive(:publish).with("events",
143
+ $redis.should_receive(:publish).with("/nodevent",
144
144
  {
145
145
  :room => instance.class.room,
146
146
  :event => 'create',
@@ -151,7 +151,7 @@ describe NoDevent do
151
151
  end
152
152
  describe "#nodevent_update" do
153
153
  it "should emit to the right room" do
154
- $redis.should_receive(:publish).with("events",
154
+ $redis.should_receive(:publish).with("/nodevent",
155
155
  {
156
156
  :room => instance.room,
157
157
  :event => 'update',
data/spec/emitter_spec.rb CHANGED
@@ -14,12 +14,6 @@ describe NoDevent do
14
14
  NoDevent::Emitter.config[:namespace].should be_present
15
15
  end
16
16
 
17
- it "lets you override the config" do
18
- NoDevent::Emitter.config = {:host => "foo", :namespace => "other"}
19
-
20
- NoDevent::Emitter.config[:host].should == "foo"
21
- NoDevent::Emitter.config[:namespace].should == "other"
22
- end
23
17
  end
24
18
  describe "#room" do
25
19
  it "gives a room name" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nodevent
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: