chillout 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +22 -0
- data/Rakefile +11 -0
- data/chillout.gemspec +26 -0
- data/lib/chillout/client.rb +52 -0
- data/lib/chillout/config.rb +55 -0
- data/lib/chillout/creation_listener.rb +15 -0
- data/lib/chillout/creations_container.rb +21 -0
- data/lib/chillout/dispatcher.rb +25 -0
- data/lib/chillout/error.rb +60 -0
- data/lib/chillout/error_filter.rb +9 -0
- data/lib/chillout/event_data_builder.rb +67 -0
- data/lib/chillout/http_client.rb +36 -0
- data/lib/chillout/middleware/creations_monitor.rb +19 -0
- data/lib/chillout/middleware/exception_monitor.rb +25 -0
- data/lib/chillout/prefixed_logger.rb +16 -0
- data/lib/chillout/railtie.rb +21 -0
- data/lib/chillout/server_side.rb +35 -0
- data/lib/chillout/version.rb +3 -0
- data/lib/chillout.rb +16 -0
- data/test/client_test.rb +40 -0
- data/test/config_test.rb +26 -0
- data/test/creations_container_test.rb +12 -0
- data/test/dispatcher_test.rb +68 -0
- data/test/error_test.rb +115 -0
- data/test/event_data_builder_test.rb +190 -0
- data/test/http_client_test.rb +13 -0
- data/test/integration/creations_monitor_rack_test.rb +41 -0
- data/test/integration/exception_monitor_rack_test.rb +51 -0
- data/test/integration/standalone_client_test.rb +66 -0
- data/test/middleware/creations_monitor_test.rb +50 -0
- data/test/middleware/exception_monitor_test.rb +54 -0
- data/test/prefixed_logger_test.rb +13 -0
- data/test/server_side_test.rb +35 -0
- data/test/test_helper.rb +46 -0
- metadata +166 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'mocha'
|
3
|
+
require 'contest'
|
4
|
+
require 'webmock/minitest'
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
|
8
|
+
|
9
|
+
require 'chillout'
|
10
|
+
|
11
|
+
class ChilloutTestCase < Test::Unit::TestCase
|
12
|
+
|
13
|
+
def build_exception(klass = Exception, message = "Test Exception")
|
14
|
+
raise klass.new(message)
|
15
|
+
rescue Exception => exception
|
16
|
+
exception
|
17
|
+
end
|
18
|
+
|
19
|
+
def build_error(klass, message = "Test Error", environment = {})
|
20
|
+
exception = build_exception(klass, message)
|
21
|
+
Chillout::Error.new(exception, environment)
|
22
|
+
end
|
23
|
+
|
24
|
+
def stub_api_request(api_key, resource_name)
|
25
|
+
@_api_key = api_key
|
26
|
+
stub_request(:post, api_url(resource_name))
|
27
|
+
end
|
28
|
+
|
29
|
+
def assert_request_body(resource_name)
|
30
|
+
assert_requested(:post, api_url(resource_name)) do |request|
|
31
|
+
yield JSON.parse(request.body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def assert_request_headers(resource_name, headers = {})
|
36
|
+
assert_requested(:post, api_url(resource_name), headers: headers)
|
37
|
+
end
|
38
|
+
|
39
|
+
def api_url(resource_name)
|
40
|
+
raise "API KEY not set" unless @_api_key
|
41
|
+
"http://#{@_api_key}:#{@_api_key}@api.chillout.io/#{resource_name}"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class ChilloutTestException < Exception; end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chillout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michał Łomnicki
|
9
|
+
- Jan Filipowski
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: minitest
|
17
|
+
requirement: &12725680 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.2.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *12725680
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: &12725080 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *12725080
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: mocha
|
39
|
+
requirement: &12740800 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.12.7
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *12740800
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: contest
|
50
|
+
requirement: &12740100 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.3
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *12740100
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rack-test
|
61
|
+
requirement: &12739320 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.6.2
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *12739320
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: webmock
|
72
|
+
requirement: &12738260 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.11
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *12738260
|
81
|
+
description: Chillout.io Ruby client
|
82
|
+
email:
|
83
|
+
- michal.lomnicki@gmail.com
|
84
|
+
- jachuf@gmail.com
|
85
|
+
- dev@arkency.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- chillout.gemspec
|
96
|
+
- lib/chillout.rb
|
97
|
+
- lib/chillout/client.rb
|
98
|
+
- lib/chillout/config.rb
|
99
|
+
- lib/chillout/creation_listener.rb
|
100
|
+
- lib/chillout/creations_container.rb
|
101
|
+
- lib/chillout/dispatcher.rb
|
102
|
+
- lib/chillout/error.rb
|
103
|
+
- lib/chillout/error_filter.rb
|
104
|
+
- lib/chillout/event_data_builder.rb
|
105
|
+
- lib/chillout/http_client.rb
|
106
|
+
- lib/chillout/middleware/creations_monitor.rb
|
107
|
+
- lib/chillout/middleware/exception_monitor.rb
|
108
|
+
- lib/chillout/prefixed_logger.rb
|
109
|
+
- lib/chillout/railtie.rb
|
110
|
+
- lib/chillout/server_side.rb
|
111
|
+
- lib/chillout/version.rb
|
112
|
+
- test/client_test.rb
|
113
|
+
- test/config_test.rb
|
114
|
+
- test/creations_container_test.rb
|
115
|
+
- test/dispatcher_test.rb
|
116
|
+
- test/error_test.rb
|
117
|
+
- test/event_data_builder_test.rb
|
118
|
+
- test/http_client_test.rb
|
119
|
+
- test/integration/creations_monitor_rack_test.rb
|
120
|
+
- test/integration/exception_monitor_rack_test.rb
|
121
|
+
- test/integration/standalone_client_test.rb
|
122
|
+
- test/middleware/creations_monitor_test.rb
|
123
|
+
- test/middleware/exception_monitor_test.rb
|
124
|
+
- test/prefixed_logger_test.rb
|
125
|
+
- test/server_side_test.rb
|
126
|
+
- test/test_helper.rb
|
127
|
+
homepage: http://chillout.io/
|
128
|
+
licenses: []
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 1.8.11
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: Chillout.io Ruby client
|
151
|
+
test_files:
|
152
|
+
- test/client_test.rb
|
153
|
+
- test/config_test.rb
|
154
|
+
- test/creations_container_test.rb
|
155
|
+
- test/dispatcher_test.rb
|
156
|
+
- test/error_test.rb
|
157
|
+
- test/event_data_builder_test.rb
|
158
|
+
- test/http_client_test.rb
|
159
|
+
- test/integration/creations_monitor_rack_test.rb
|
160
|
+
- test/integration/exception_monitor_rack_test.rb
|
161
|
+
- test/integration/standalone_client_test.rb
|
162
|
+
- test/middleware/creations_monitor_test.rb
|
163
|
+
- test/middleware/exception_monitor_test.rb
|
164
|
+
- test/prefixed_logger_test.rb
|
165
|
+
- test/server_side_test.rb
|
166
|
+
- test/test_helper.rb
|