pusher 0.4.0.beta.2 → 0.4.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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/pusher.gemspec +3 -3
  3. data/spec/pusher_spec.rb +25 -11
  4. metadata +6 -10
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0.beta.2
1
+ 0.4.0
data/pusher.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pusher}
8
- s.version = "0.4.0.beta.2"
8
+ s.version = "0.4.0"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["New Bamboo"]
12
- s.date = %q{2010-04-23}
12
+ s.date = %q{2010-04-27}
13
13
  s.description = %q{Wrapper for pusherapp.com REST api}
14
14
  s.email = %q{support@pusherapp.com}
15
15
  s.extra_rdoc_files = [
data/spec/pusher_spec.rb CHANGED
@@ -60,7 +60,9 @@ describe Pusher do
60
60
 
61
61
  describe 'Channel#trigger!' do
62
62
  before :each do
63
- WebMock.stub_request(:post, %r{/app/20/channel/test_channel/event})
63
+ WebMock.stub_request(
64
+ :post, %r{/apps/20/channels/test_channel/events}
65
+ ).to_return(:status => 202)
64
66
  @channel = Pusher['test_channel']
65
67
  end
66
68
 
@@ -74,7 +76,7 @@ describe Pusher do
74
76
  :name => 'Pusher',
75
77
  :last_name => 'App'
76
78
  })
77
- WebMock.request(:post, %r{/app/20/channel/test_channel/event}).
79
+ WebMock.request(:post, %r{/apps/20/channels/test_channel/events}).
78
80
  with do |req|
79
81
 
80
82
  query_hash = req.uri.query_values
@@ -95,7 +97,7 @@ describe Pusher do
95
97
  it "should handle string data by sending unmodified in body" do
96
98
  string = "foo\nbar\""
97
99
  @channel.trigger!('new_event', string)
98
- WebMock.request(:post, %r{/app/20/channel/test_channel/event}).with do |req|
100
+ WebMock.request(:post, %r{/apps/20/channels/test_channel/events}).with do |req|
99
101
  req.body.should == "foo\nbar\""
100
102
  end.should have_been_made
101
103
  end
@@ -107,32 +109,37 @@ describe Pusher do
107
109
  end
108
110
 
109
111
  it "should propagate exception if exception raised" do
110
- WebMock.stub_request(:post, %r{/app/20/channel/test_channel/event}).
111
- to_raise(RuntimeError)
112
+ WebMock.stub_request(
113
+ :post, %r{/apps/20/channels/test_channel/events}
114
+ ).to_raise(RuntimeError)
112
115
  lambda {
113
116
  Pusher['test_channel'].trigger!('new_event', 'Some data')
114
117
  }.should raise_error(RuntimeError)
115
118
  end
116
119
 
117
120
  it "should raise AuthenticationError if pusher returns 401" do
118
- WebMock.stub_request(:post, %r{/app/20/channel/test_channel/event}).
119
- to_return(:status => 401)
121
+ WebMock.stub_request(
122
+ :post,
123
+ %r{/apps/20/channels/test_channel/events}
124
+ ).to_return(:status => 401)
120
125
  lambda {
121
126
  Pusher['test_channel'].trigger!('new_event', 'Some data')
122
127
  }.should raise_error(Pusher::AuthenticationError)
123
128
  end
124
129
 
125
130
  it "should raise Pusher::Error if pusher returns 404" do
126
- WebMock.stub_request(:post, %r{/app/20/channel/test_channel/event}).
127
- to_return(:status => 404)
131
+ WebMock.stub_request(
132
+ :post, %r{/apps/20/channels/test_channel/events}
133
+ ).to_return(:status => 404)
128
134
  lambda {
129
135
  Pusher['test_channel'].trigger!('new_event', 'Some data')
130
136
  }.should raise_error(Pusher::Error, 'Resource not found: app_id is probably invalid')
131
137
  end
132
138
 
133
139
  it "should raise Pusher::Error if pusher returns 500" do
134
- WebMock.stub_request(:post, %r{/app/20/channel/test_channel/event}).
135
- to_return(:status => 500, :body => "some error")
140
+ WebMock.stub_request(
141
+ :post, %r{/apps/20/channels/test_channel/events}
142
+ ).to_return(:status => 500, :body => "some error")
136
143
  lambda {
137
144
  Pusher['test_channel'].trigger!('new_event', 'Some data')
138
145
  }.should raise_error(Pusher::Error, 'Unknown error in Pusher: some error')
@@ -151,6 +158,13 @@ describe Pusher do
151
158
  Pusher.logger.should_receive(:debug) #backtrace
152
159
  Pusher['test_channel'].trigger('new_event', 'Some data')
153
160
  end
161
+
162
+ it "should log failure if exception raised" do
163
+ @http.should_receive(:post).and_raise("Fail")
164
+ Pusher.logger.should_receive(:error).with("Fail (RuntimeError)")
165
+ Pusher.logger.should_receive(:debug) #backtrace
166
+ Pusher['test_channel'].trigger('new_event', 'Some data')
167
+ end
154
168
  end
155
169
  end
156
170
  end
metadata CHANGED
@@ -1,14 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pusher
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
8
  - 0
9
- - beta
10
- - 2
11
- version: 0.4.0.beta.2
9
+ version: 0.4.0
12
10
  platform: ruby
13
11
  authors:
14
12
  - New Bamboo
@@ -16,7 +14,7 @@ autorequire:
16
14
  bindir: bin
17
15
  cert_chain: []
18
16
 
19
- date: 2010-04-23 00:00:00 +01:00
17
+ date: 2010-04-27 00:00:00 +02:00
20
18
  default_executable:
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
@@ -123,13 +121,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
121
  version: "0"
124
122
  required_rubygems_version: !ruby/object:Gem::Requirement
125
123
  requirements:
126
- - - ">"
124
+ - - ">="
127
125
  - !ruby/object:Gem::Version
128
126
  segments:
129
- - 1
130
- - 3
131
- - 1
132
- version: 1.3.1
127
+ - 0
128
+ version: "0"
133
129
  requirements: []
134
130
 
135
131
  rubyforge_project: