dashing-rails 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Dashing
2
2
 
3
3
  [![Code Climate](https://codeclimate.com/github/gottfrois/dashing-rails.png)](https://codeclimate.com/github/gottfrois/dashing-rails)
4
+ [![Coverage Status](https://coveralls.io/repos/gottfrois/dashing-rails/badge.png?branch=master)](https://coveralls.io/r/gottfrois/dashing-rails?branch=master)
5
+ [![Build Status](https://travis-ci.org/gottfrois/dashing-rails.png?branch=master)](https://travis-ci.org/gottfrois/dashing-rails)
4
6
 
5
7
  Dashing-rails is the Rails Engine version of [Dashing by Shopify](http://shopify.github.io/dashing/).
6
8
  A huge thanks to Shopify for their great work with the Sinatra version.
@@ -21,6 +23,7 @@ Key features:
21
23
 
22
24
  ## Requirements
23
25
 
26
+ * Ruby >=1.9.3
24
27
  * Rails 4
25
28
  * Redis
26
29
  * Multi Threaded server ([puma](https://github.com/puma/puma), [rainbows](http://rainbows.rubyforge.org/))
@@ -101,9 +104,11 @@ Dashing uses [Redis](http://redis.io/) to push and pull data and feed your widge
101
104
 
102
105
  This way you can have a seperate Rails 4 application (with puma) running your dashboards and push your data to redis from your main Rails 3 application for example.
103
106
 
104
- You can specify Dashing redis connection in `config/initializers/dashing.rb`:
107
+ You can specify Dashing redis credentials in `config/initializers/dashing.rb`:
105
108
 
106
- config.redis = your_redis_instance
109
+ config.redis_host = '127.0.0.1'
110
+ config.redis_port = '6379'
111
+ config.redis_password = '123456'
107
112
 
108
113
  By default Dashing subscribed to the following namespace in redis:
109
114
 
@@ -160,6 +165,12 @@ Does not work in Internet Explorer because it relies on [Server Sent Events](htt
160
165
 
161
166
  All contributions are more than welcome; especially new widgets!
162
167
 
168
+ Please add spec to your Pull Requests and run them using:
169
+
170
+ rake
171
+
172
+ You can use the following [demo application](https://github.com/gottfrois/dashing-rails-demo) to test dashing-rails in development.
173
+
163
174
  ## License
164
175
 
165
176
  Dashing is released under the [MIT license](https://github.com/Shopify/dashing/blob/master/MIT-LICENSE)
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
- RSpec::Core::RakeTask.new('default') do |t|
5
- t.pattern = FileList[File.expand_path('../spec/**/*_spec.rb', __FILE__)]
6
- end
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ task default: :spec
7
+ task test: :spec
@@ -1,8 +1,16 @@
1
1
  module Dashing
2
2
  class ApplicationController < ActionController::Base
3
3
 
4
+ before_filter :authentication_with_devise
5
+
4
6
  private
5
7
 
8
+ def authentication_with_devise
9
+ Dashing.config.devise_allowed_models.each do |model|
10
+ self.send("authenticate_#{model.to_s}!")
11
+ end
12
+ end
13
+
6
14
  def check_accessibility
7
15
  auth_token = params.delete(:auth_token)
8
16
  if !Dashing.config.auth_token || auth_token == Dashing.config.auth_token
@@ -8,8 +8,8 @@ module Dashing
8
8
  response.headers['Content-Type'] = 'text/event-stream'
9
9
  response.headers['X-Accel-Buffering'] = 'no'
10
10
 
11
- redis = Redis.new
12
- redis.psubscribe("#{Dashing.config.redis_namespace}.*") do |on|
11
+ @redis = Dashing.redis
12
+ @redis.psubscribe("#{Dashing.config.redis_namespace}.*") do |on|
13
13
  on.pmessage do |pattern, event, data|
14
14
  response.stream.write("data: #{data}\n\n")
15
15
  end
@@ -17,7 +17,7 @@ module Dashing
17
17
  rescue IOError
18
18
  logger.info "[Dashing][#{Time.now.utc.to_s}] Stream closed"
19
19
  ensure
20
- redis.quit
20
+ @redis.quit
21
21
  response.stream.close
22
22
  end
23
23
 
@@ -10,7 +10,7 @@ module Dashing
10
10
  end
11
11
 
12
12
  def configure
13
- yield config
13
+ yield config if block_given?
14
14
  end
15
15
 
16
16
  def first_dashboard
@@ -1,26 +1,45 @@
1
1
  require 'rufus-scheduler'
2
2
  require 'redis'
3
+ require 'connection_pool'
3
4
 
4
5
  module Dashing
5
6
  class Configuration
6
7
 
7
- attr_accessor :scheduler, :redis, :view_path, :jobs_path, :redis_namespace,
8
+ attr_reader :redis
9
+ attr_accessor :scheduler, :view_path, :jobs_path, :redis_namespace,
8
10
  :engine_path, :dashboards_path, :dashboard_layout,
9
- :widgets_path, :default_dashboard, :auth_token
11
+ :widgets_path, :default_dashboard, :auth_token, :devise_allowed_models,
12
+ :redis_host, :redis_port, :redis_password
10
13
 
11
14
  def initialize
12
- @scheduler = ::Rufus::Scheduler.new
13
- @redis = ::Redis.new
14
- @redis_namespace = 'dashing_events'
15
- @view_path = 'app/views/dashing/'
16
- @jobs_path = 'app/jobs/'
17
- @engine_path = '/dashing'
18
- @dashboards_path = 'app/views/dashing/dashboards/'
19
- @dashboard_layout = 'dashing/dashboard'
20
- @widgets_path = 'app/views/dashing/widgets/'
21
- @default_dashboard = nil
22
- @auth_token = nil
15
+ @scheduler = ::Rufus::Scheduler.new
16
+ @redis_host = '127.0.0.1'
17
+ @redis_port = '6379'
18
+ @redis_password = nil
19
+ @redis_namespace = 'dashing_events'
20
+ @view_path = 'app/views/dashing/'
21
+ @jobs_path = 'app/jobs/'
22
+ @engine_path = '/dashing'
23
+ @dashboards_path = 'app/views/dashing/dashboards/'
24
+ @dashboard_layout = 'dashing/dashboard'
25
+ @widgets_path = 'app/views/dashing/widgets/'
26
+ @default_dashboard = nil
27
+ @auth_token = nil
28
+ @devise_allowed_models = []
23
29
  end
24
30
 
31
+ def redis
32
+ @redis ||= ::ConnectionPool::Wrapper.new(size: request_thread_count, timeout: 3) { ::Redis.new(host: redis_host, port: redis_port, password: redis_password) }
33
+ end
34
+
35
+ private
36
+
37
+ def request_thread_count
38
+ if defined?(::Puma) && ::Puma.respond_to?(:cli_config)
39
+ ::Puma.cli_config.options.fetch(:max_threads, 5).to_i
40
+ else
41
+ 5
42
+ end
43
+ end
25
44
  end
26
45
  end
@@ -1,3 +1,3 @@
1
1
  module Dashing
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -3,8 +3,11 @@ Dashing.configure do |config|
3
3
  # Scheduler instance.
4
4
  # config.scheduler = ::Rufus::Scheduler.new
5
5
 
6
- # Redis instance.
7
- # config.redis = ::Redis.new
6
+ # Redis credentials.
7
+ # See https://devcenter.heroku.com/articles/redistogo to configure redis for heroku.
8
+ # config.redis_host = '127.0.0.1'
9
+ # config.redis_port = '6379'
10
+ # config.redis_password = nil
8
11
 
9
12
  # Redis namespace when pushing new data.
10
13
  # config.redis_namespace = 'dashing_events'
@@ -47,4 +50,8 @@ Dashing.configure do |config|
47
50
  # Put nil if you don't want to use authentication.
48
51
  # You can use SecureRandom.hex to generate a hex.
49
52
  # config.auth_token = nil
53
+
54
+ # List of Devise models that should access the whole dashboard.
55
+ # List the models. E.g: '[ :user, :admin ]'
56
+ # config.devise_allowed_models = []
50
57
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dashing::ApplicationController do
4
+
5
+ describe '#authentication_with_devise' do
6
+
7
+ let(:models) { [:user, :admin] }
8
+
9
+ before do
10
+ Dashing.stub_chain(:config, :devise_allowed_models).and_return(models)
11
+ end
12
+
13
+ it 'calls devise authenticate method' do
14
+ expect(controller).to receive("authenticate_#{models.first.to_s}!")
15
+ expect(controller).to receive("authenticate_#{models.last.to_s}!")
16
+ controller.send(:authentication_with_devise)
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -1,27 +1,395 @@
1
+ Processing by Dashing::WidgetsController#show as HTML
2
+ Parameters: {"name"=>"foo"}
3
+ Rendered dashing/widgets/foo/foo.html (0.2ms)
4
+ Completed 200 OK in 27ms (Views: 26.5ms | ActiveRecord: 0.0ms)
5
+ Processing by Dashing::WidgetsController#show as HTML
6
+ Parameters: {"name"=>"text"}
7
+ Completed 200 OK in 3ms (Views: 2.5ms | ActiveRecord: 0.0ms)
8
+ Processing by Dashing::WidgetsController#show as HTML
9
+ Completed 500 Internal Server Error in 0ms
10
+ Processing by Dashing::WidgetsController#show as HTML
11
+ Parameters: {"name"=>"bar"}
12
+ Completed 500 Internal Server Error in 2ms
13
+ Processing by Dashing::WidgetsController#update as HTML
14
+ Parameters: {"name"=>"foo"}
15
+ Completed 200 OK in 4ms (Views: 2.0ms | ActiveRecord: 0.0ms)
16
+ Processing by Dashing::WidgetsController#update as HTML
17
+ Completed 500 Internal Server Error in 0ms
18
+ Processing by Dashing::DashboardsController#index as HTML
19
+ Completed 200 OK in 5ms (Views: 4.1ms | ActiveRecord: 0.0ms)
20
+ Processing by Dashing::DashboardsController#show as HTML
21
+ Parameters: {"name"=>"foo"}
22
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
23
+ Processing by Dashing::DashboardsController#show as HTML
24
+ Completed 500 Internal Server Error in 0ms
25
+ Processing by Dashing::DashboardsController#show as HTML
26
+ Parameters: {"name"=>"bar"}
27
+ Completed 500 Internal Server Error in 2ms
28
+ Processing by Dashing::DashboardsController#show as HTML
29
+ Parameters: {"name"=>"bar"}
30
+ Completed 500 Internal Server Error in 11ms
31
+ Processing by Dashing::DashboardsController#show as HTML
32
+ Completed 500 Internal Server Error in 0ms
33
+ Processing by Dashing::DashboardsController#show as HTML
34
+ Parameters: {"name"=>"foo"}
35
+ Completed 200 OK in 24ms (Views: 23.2ms | ActiveRecord: 0.0ms)
36
+ Processing by Dashing::DashboardsController#index as HTML
37
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
38
+ Processing by Dashing::WidgetsController#update as HTML
39
+ Completed 500 Internal Server Error in 0ms
40
+ Processing by Dashing::WidgetsController#update as HTML
41
+ Parameters: {"name"=>"foo"}
42
+ Completed 500 Internal Server Error in 2ms
43
+ Processing by Dashing::WidgetsController#show as HTML
44
+ Parameters: {"name"=>"text"}
45
+ Completed 200 OK in 5ms (Views: 4.4ms | ActiveRecord: 0.0ms)
46
+ Processing by Dashing::WidgetsController#show as HTML
47
+ Parameters: {"name"=>"foo"}
48
+ Completed 200 OK in 3ms (Views: 2.1ms | ActiveRecord: 0.0ms)
49
+ Processing by Dashing::WidgetsController#show as HTML
50
+ Parameters: {"name"=>"bar"}
51
+ Completed 500 Internal Server Error in 2ms
52
+ Processing by Dashing::WidgetsController#show as HTML
53
+ Completed 500 Internal Server Error in 0ms
1
54
  Processing by Dashing::DashboardsController#index as HTML
2
55
  Rendered dashing/dashboards/foo.erb within layouts/dashing/dashboard (1.9ms)
3
- Completed 200 OK in 11ms (Views: 10.3ms | ActiveRecord: 0.0ms)
56
+ Completed 200 OK in 27ms (Views: 26.4ms | ActiveRecord: 0.0ms)
4
57
  Processing by Dashing::DashboardsController#show as HTML
5
58
  Parameters: {"name"=>"foo"}
6
- Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
59
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
7
60
  Processing by Dashing::DashboardsController#show as HTML
8
61
  Completed 500 Internal Server Error in 0ms
9
62
  Processing by Dashing::DashboardsController#show as HTML
10
63
  Parameters: {"name"=>"bar"}
11
64
  Completed 500 Internal Server Error in 2ms
65
+ Processing by Dashing::WidgetsController#show as HTML
66
+ Parameters: {"name"=>"text"}
67
+ Completed 500 Internal Server Error in 1ms
68
+ Processing by Dashing::WidgetsController#show as HTML
69
+ Completed 500 Internal Server Error in 1ms
70
+ Processing by Dashing::WidgetsController#show as HTML
71
+ Parameters: {"name"=>"bar"}
72
+ Completed 500 Internal Server Error in 1ms
12
73
  Processing by Dashing::WidgetsController#show as HTML
13
74
  Parameters: {"name"=>"foo"}
75
+ Completed 500 Internal Server Error in 1ms
76
+ Processing by Dashing::WidgetsController#update as HTML
77
+ Parameters: {"name"=>"foo"}
78
+ Completed 500 Internal Server Error in 1ms
79
+ Processing by Dashing::WidgetsController#update as HTML
80
+ Completed 500 Internal Server Error in 1ms
81
+ Processing by Dashing::DashboardsController#index as HTML
82
+ Completed 200 OK in 11ms (Views: 10.5ms | ActiveRecord: 0.0ms)
83
+ Processing by Dashing::DashboardsController#show as HTML
84
+ Parameters: {"name"=>"foo"}
85
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
86
+ Processing by Dashing::DashboardsController#show as HTML
87
+ Completed 500 Internal Server Error in 0ms
88
+ Processing by Dashing::DashboardsController#show as HTML
89
+ Parameters: {"name"=>"bar"}
90
+ Completed 500 Internal Server Error in 2ms
91
+ Processing by Dashing::WidgetsController#show as HTML
92
+ Parameters: {"name"=>"text"}
93
+ Completed 200 OK in 4ms (Views: 3.7ms | ActiveRecord: 0.0ms)
94
+ Processing by Dashing::WidgetsController#show as HTML
95
+ Completed 500 Internal Server Error in 0ms
96
+ Processing by Dashing::WidgetsController#show as HTML
97
+ Parameters: {"name"=>"bar"}
98
+ Completed 500 Internal Server Error in 2ms
99
+ Processing by Dashing::WidgetsController#show as HTML
100
+ Parameters: {"name"=>"foo"}
101
+ Completed 200 OK in 3ms (Views: 2.1ms | ActiveRecord: 0.0ms)
102
+ Processing by Dashing::WidgetsController#update as HTML
103
+ Parameters: {"name"=>"foo"}
104
+ Completed 200 OK in 5ms (Views: 3.4ms | ActiveRecord: 0.0ms)
105
+ Processing by Dashing::WidgetsController#update as HTML
106
+ Completed 500 Internal Server Error in 0ms
107
+ Processing by Dashing::DashboardsController#index as HTML
108
+ Completed 200 OK in 14ms (Views: 13.3ms | ActiveRecord: 0.0ms)
109
+ Processing by Dashing::DashboardsController#show as HTML
110
+ Parameters: {"name"=>"foo"}
111
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
112
+ Processing by Dashing::DashboardsController#show as HTML
113
+ Completed 500 Internal Server Error in 0ms
114
+ Processing by Dashing::DashboardsController#show as HTML
115
+ Parameters: {"name"=>"bar"}
116
+ Completed 500 Internal Server Error in 2ms
117
+ Processing by Dashing::WidgetsController#show as HTML
118
+ Completed 500 Internal Server Error in 0ms
119
+ Processing by Dashing::WidgetsController#show as HTML
120
+ Parameters: {"name"=>"bar"}
121
+ Completed 500 Internal Server Error in 2ms
122
+ Processing by Dashing::WidgetsController#show as HTML
123
+ Parameters: {"name"=>"foo"}
124
+ Completed 200 OK in 4ms (Views: 3.4ms | ActiveRecord: 0.0ms)
125
+ Processing by Dashing::WidgetsController#show as HTML
126
+ Parameters: {"name"=>"text"}
127
+ Completed 200 OK in 3ms (Views: 2.2ms | ActiveRecord: 0.0ms)
128
+ Processing by Dashing::WidgetsController#update as HTML
129
+ Parameters: {"name"=>"foo"}
130
+ Completed 500 Internal Server Error in 2ms
131
+ Processing by Dashing::WidgetsController#update as HTML
132
+ Completed 500 Internal Server Error in 0ms
133
+ Processing by Dashing::WidgetsController#show as HTML
134
+ Parameters: {"name"=>"text"}
135
+ Rendered /Users/pierrelouisgottfrois/Code/dashing-rails/app/views/dashing/default_widgets/text/text.html (0.2ms)
136
+ Completed 200 OK in 27ms (Views: 26.5ms | ActiveRecord: 0.0ms)
137
+ Processing by Dashing::WidgetsController#show as HTML
138
+ Parameters: {"name"=>"foo"}
139
+ Completed 200 OK in 3ms (Views: 2.2ms | ActiveRecord: 0.0ms)
140
+ Processing by Dashing::WidgetsController#show as HTML
141
+ Completed 500 Internal Server Error in 0ms
142
+ Processing by Dashing::WidgetsController#show as HTML
143
+ Parameters: {"name"=>"bar"}
144
+ Completed 500 Internal Server Error in 2ms
145
+ Processing by Dashing::WidgetsController#update as HTML
146
+ Parameters: {"name"=>"foo"}
147
+ Completed 200 OK in 6ms (Views: 4.7ms | ActiveRecord: 0.0ms)
148
+ Processing by Dashing::WidgetsController#update as HTML
149
+ Completed 500 Internal Server Error in 0ms
150
+ Processing by Dashing::DashboardsController#index as HTML
151
+ Completed 200 OK in 4ms (Views: 3.9ms | ActiveRecord: 0.0ms)
152
+ Processing by Dashing::DashboardsController#show as HTML
153
+ Parameters: {"name"=>"foo"}
154
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
155
+ Processing by Dashing::DashboardsController#show as HTML
156
+ Completed 500 Internal Server Error in 0ms
157
+ Processing by Dashing::DashboardsController#show as HTML
158
+ Parameters: {"name"=>"bar"}
159
+ Completed 500 Internal Server Error in 2ms
160
+ Processing by Dashing::WidgetsController#show as HTML
161
+ Completed 500 Internal Server Error in 0ms
162
+ Processing by Dashing::WidgetsController#show as HTML
163
+ Parameters: {"name"=>"bar"}
164
+ Completed 500 Internal Server Error in 8ms
165
+ Processing by Dashing::WidgetsController#show as HTML
166
+ Parameters: {"name"=>"foo"}
167
+ Completed 200 OK in 4ms (Views: 3.2ms | ActiveRecord: 0.0ms)
168
+ Processing by Dashing::WidgetsController#show as HTML
169
+ Parameters: {"name"=>"text"}
170
+ Completed 200 OK in 3ms (Views: 2.2ms | ActiveRecord: 0.0ms)
171
+ Processing by Dashing::WidgetsController#update as HTML
172
+ Parameters: {"name"=>"foo"}
173
+ Completed 200 OK in 3ms (Views: 1.5ms | ActiveRecord: 0.0ms)
174
+ Processing by Dashing::WidgetsController#update as HTML
175
+ Completed 500 Internal Server Error in 0ms
176
+ Processing by Dashing::DashboardsController#index as HTML
14
177
  Completed 200 OK in 5ms (Views: 4.1ms | ActiveRecord: 0.0ms)
178
+ Processing by Dashing::DashboardsController#show as HTML
179
+ Parameters: {"name"=>"foo"}
180
+ Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
181
+ Processing by Dashing::DashboardsController#show as HTML
182
+ Completed 500 Internal Server Error in 0ms
183
+ Processing by Dashing::DashboardsController#show as HTML
184
+ Parameters: {"name"=>"bar"}
185
+ Completed 500 Internal Server Error in 2ms
15
186
  Processing by Dashing::WidgetsController#show as HTML
16
187
  Completed 500 Internal Server Error in 0ms
17
188
  Processing by Dashing::WidgetsController#show as HTML
18
189
  Parameters: {"name"=>"bar"}
190
+ Completed 500 Internal Server Error in 8ms
191
+ Processing by Dashing::WidgetsController#show as HTML
192
+ Parameters: {"name"=>"foo"}
193
+ Completed 200 OK in 4ms (Views: 3.5ms | ActiveRecord: 0.0ms)
194
+ Processing by Dashing::WidgetsController#show as HTML
195
+ Parameters: {"name"=>"text"}
196
+ Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
197
+ Processing by Dashing::WidgetsController#update as HTML
198
+ Parameters: {"name"=>"foo"}
199
+ Completed 200 OK in 3ms (Views: 1.7ms | ActiveRecord: 0.0ms)
200
+ Processing by Dashing::WidgetsController#update as HTML
201
+ Completed 500 Internal Server Error in 0ms
202
+ Processing by Dashing::DashboardsController#index as HTML
203
+ Completed 200 OK in 5ms (Views: 4.6ms | ActiveRecord: 0.0ms)
204
+ Processing by Dashing::DashboardsController#show as HTML
205
+ Parameters: {"name"=>"foo"}
206
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
207
+ Processing by Dashing::DashboardsController#show as HTML
208
+ Completed 500 Internal Server Error in 0ms
209
+ Processing by Dashing::DashboardsController#show as HTML
210
+ Parameters: {"name"=>"bar"}
211
+ Completed 500 Internal Server Error in 2ms
212
+ Processing by Dashing::DashboardsController#index as HTML
213
+ Rendered dashing/dashboards/foo.erb within layouts/dashing/dashboard (2.0ms)
214
+ Completed 200 OK in 11ms (Views: 10.7ms | ActiveRecord: 0.0ms)
215
+ Processing by Dashing::DashboardsController#show as HTML
216
+ Parameters: {"name"=>"foo"}
217
+ Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
218
+ Processing by Dashing::DashboardsController#show as HTML
219
+ Completed 500 Internal Server Error in 0ms
220
+ Processing by Dashing::DashboardsController#show as HTML
221
+ Parameters: {"name"=>"bar"}
19
222
  Completed 500 Internal Server Error in 2ms
223
+ Processing by Dashing::WidgetsController#show as HTML
224
+ Parameters: {"name"=>"text"}
225
+ Completed 200 OK in 5ms (Views: 4.2ms | ActiveRecord: 0.0ms)
226
+ Processing by Dashing::WidgetsController#show as HTML
227
+ Completed 500 Internal Server Error in 0ms
228
+ Processing by Dashing::WidgetsController#show as HTML
229
+ Parameters: {"name"=>"bar"}
230
+ Completed 500 Internal Server Error in 2ms
231
+ Processing by Dashing::WidgetsController#show as HTML
232
+ Parameters: {"name"=>"foo"}
233
+ Completed 200 OK in 3ms (Views: 2.3ms | ActiveRecord: 0.0ms)
234
+ Processing by Dashing::WidgetsController#update as HTML
235
+ Parameters: {"name"=>"foo"}
236
+ Completed 200 OK in 3ms (Views: 1.8ms | ActiveRecord: 0.0ms)
237
+ Processing by Dashing::WidgetsController#update as HTML
238
+ Completed 500 Internal Server Error in 0ms
239
+ Processing by Dashing::WidgetsController#show as HTML
240
+ Completed 500 Internal Server Error in 0ms
241
+ Processing by Dashing::WidgetsController#show as HTML
242
+ Parameters: {"name"=>"bar"}
243
+ Completed 500 Internal Server Error in 8ms
244
+ Processing by Dashing::WidgetsController#show as HTML
245
+ Parameters: {"name"=>"foo"}
246
+ Completed 200 OK in 4ms (Views: 3.5ms | ActiveRecord: 0.0ms)
20
247
  Processing by Dashing::WidgetsController#show as HTML
21
248
  Parameters: {"name"=>"text"}
22
249
  Completed 200 OK in 3ms (Views: 2.6ms | ActiveRecord: 0.0ms)
23
250
  Processing by Dashing::WidgetsController#update as HTML
24
251
  Parameters: {"name"=>"foo"}
25
- Completed 200 OK in 3ms (Views: 1.7ms | ActiveRecord: 0.0ms)
252
+ Completed 200 OK in 4ms (Views: 1.7ms | ActiveRecord: 0.0ms)
253
+ Processing by Dashing::WidgetsController#update as HTML
254
+ Completed 500 Internal Server Error in 0ms
255
+ Processing by Dashing::DashboardsController#index as HTML
256
+ Completed 200 OK in 5ms (Views: 4.4ms | ActiveRecord: 0.0ms)
257
+ Processing by Dashing::DashboardsController#show as HTML
258
+ Parameters: {"name"=>"foo"}
259
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
260
+ Processing by Dashing::DashboardsController#show as HTML
261
+ Completed 500 Internal Server Error in 0ms
262
+ Processing by Dashing::DashboardsController#show as HTML
263
+ Parameters: {"name"=>"bar"}
264
+ Completed 500 Internal Server Error in 24ms
265
+ Processing by Dashing::WidgetsController#show as HTML
266
+ Parameters: {"name"=>"foo"}
267
+ Rendered dashing/widgets/foo/foo.html (0.3ms)
268
+ Completed 200 OK in 10ms (Views: 9.6ms | ActiveRecord: 0.0ms)
269
+ Processing by Dashing::WidgetsController#show as HTML
270
+ Parameters: {"name"=>"text"}
271
+ Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
272
+ Processing by Dashing::WidgetsController#show as HTML
273
+ Completed 500 Internal Server Error in 0ms
274
+ Processing by Dashing::WidgetsController#show as HTML
275
+ Parameters: {"name"=>"bar"}
276
+ Completed 500 Internal Server Error in 2ms
277
+ Processing by Dashing::WidgetsController#update as HTML
278
+ Parameters: {"name"=>"foo"}
279
+ Completed 200 OK in 3ms (Views: 1.6ms | ActiveRecord: 0.0ms)
280
+ Processing by Dashing::WidgetsController#update as HTML
281
+ Completed 500 Internal Server Error in 0ms
282
+ Processing by Dashing::DashboardsController#index as HTML
283
+ Completed 200 OK in 5ms (Views: 4.2ms | ActiveRecord: 0.0ms)
284
+ Processing by Dashing::DashboardsController#show as HTML
285
+ Parameters: {"name"=>"foo"}
286
+ Completed 200 OK in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
287
+ Processing by Dashing::DashboardsController#show as HTML
288
+ Completed 500 Internal Server Error in 0ms
289
+ Processing by Dashing::DashboardsController#show as HTML
290
+ Parameters: {"name"=>"bar"}
291
+ Completed 500 Internal Server Error in 2ms
292
+ Processing by Dashing::WidgetsController#show as HTML
293
+ Completed 500 Internal Server Error in 0ms
294
+ Processing by Dashing::WidgetsController#show as HTML
295
+ Parameters: {"name"=>"bar"}
296
+ Completed 500 Internal Server Error in 8ms
297
+ Processing by Dashing::WidgetsController#show as HTML
298
+ Parameters: {"name"=>"text"}
299
+ Completed 200 OK in 4ms (Views: 3.8ms | ActiveRecord: 0.0ms)
300
+ Processing by Dashing::WidgetsController#show as HTML
301
+ Parameters: {"name"=>"foo"}
302
+ Completed 200 OK in 3ms (Views: 2.3ms | ActiveRecord: 0.0ms)
303
+ Processing by Dashing::WidgetsController#update as HTML
304
+ Parameters: {"name"=>"foo"}
305
+ Completed 200 OK in 4ms (Views: 1.6ms | ActiveRecord: 0.0ms)
26
306
  Processing by Dashing::WidgetsController#update as HTML
27
307
  Completed 500 Internal Server Error in 0ms
308
+ Processing by Dashing::DashboardsController#index as HTML
309
+ Completed 200 OK in 5ms (Views: 4.5ms | ActiveRecord: 0.0ms)
310
+ Processing by Dashing::DashboardsController#show as HTML
311
+ Parameters: {"name"=>"foo"}
312
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
313
+ Processing by Dashing::DashboardsController#show as HTML
314
+ Completed 500 Internal Server Error in 0ms
315
+ Processing by Dashing::DashboardsController#show as HTML
316
+ Parameters: {"name"=>"bar"}
317
+ Completed 500 Internal Server Error in 2ms
318
+ Processing by Dashing::WidgetsController#update as HTML
319
+ Completed 500 Internal Server Error in 0ms
320
+ Processing by Dashing::WidgetsController#update as HTML
321
+ Parameters: {"name"=>"foo"}
322
+ Completed 200 OK in 10ms (Views: 8.6ms | ActiveRecord: 0.0ms)
323
+ Processing by Dashing::WidgetsController#show as HTML
324
+ Parameters: {"name"=>"text"}
325
+ Completed 200 OK in 4ms (Views: 3.8ms | ActiveRecord: 0.0ms)
326
+ Processing by Dashing::WidgetsController#show as HTML
327
+ Parameters: {"name"=>"bar"}
328
+ Completed 500 Internal Server Error in 2ms
329
+ Processing by Dashing::WidgetsController#show as HTML
330
+ Completed 500 Internal Server Error in 0ms
331
+ Processing by Dashing::WidgetsController#show as HTML
332
+ Parameters: {"name"=>"foo"}
333
+ Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
334
+ Processing by Dashing::DashboardsController#show as HTML
335
+ Parameters: {"name"=>"bar"}
336
+ Completed 500 Internal Server Error in 2ms
337
+ Processing by Dashing::DashboardsController#show as HTML
338
+ Completed 500 Internal Server Error in 0ms
339
+ Processing by Dashing::DashboardsController#show as HTML
340
+ Parameters: {"name"=>"foo"}
341
+ Completed 200 OK in 27ms (Views: 26.4ms | ActiveRecord: 0.0ms)
342
+ Processing by Dashing::DashboardsController#index as HTML
343
+ Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
344
+ Processing by Dashing::WidgetsController#show as HTML
345
+ Completed 500 Internal Server Error in 0ms
346
+ Processing by Dashing::WidgetsController#show as HTML
347
+ Parameters: {"name"=>"bar"}
348
+ Completed 500 Internal Server Error in 30ms
349
+ Processing by Dashing::WidgetsController#show as HTML
350
+ Parameters: {"name"=>"foo"}
351
+ Completed 200 OK in 4ms (Views: 3.8ms | ActiveRecord: 0.0ms)
352
+ Processing by Dashing::WidgetsController#show as HTML
353
+ Parameters: {"name"=>"text"}
354
+ Completed 200 OK in 3ms (Views: 2.6ms | ActiveRecord: 0.0ms)
355
+ Processing by Dashing::WidgetsController#update as HTML
356
+ Parameters: {"name"=>"foo"}
357
+ Completed 200 OK in 4ms (Views: 2.1ms | ActiveRecord: 0.0ms)
358
+ Processing by Dashing::WidgetsController#update as HTML
359
+ Completed 500 Internal Server Error in 0ms
360
+ Processing by Dashing::DashboardsController#index as HTML
361
+ Completed 200 OK in 6ms (Views: 4.9ms | ActiveRecord: 0.0ms)
362
+ Processing by Dashing::DashboardsController#show as HTML
363
+ Parameters: {"name"=>"foo"}
364
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
365
+ Processing by Dashing::DashboardsController#show as HTML
366
+ Completed 500 Internal Server Error in 0ms
367
+ Processing by Dashing::DashboardsController#show as HTML
368
+ Parameters: {"name"=>"bar"}
369
+ Completed 500 Internal Server Error in 2ms
370
+ Processing by Dashing::WidgetsController#show as HTML
371
+ Parameters: {"name"=>"text"}
372
+ Completed 200 OK in 12ms (Views: 11.1ms | ActiveRecord: 0.0ms)
373
+ Processing by Dashing::WidgetsController#show as HTML
374
+ Parameters: {"name"=>"foo"}
375
+ Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
376
+ Processing by Dashing::WidgetsController#show as HTML
377
+ Completed 500 Internal Server Error in 0ms
378
+ Processing by Dashing::WidgetsController#show as HTML
379
+ Parameters: {"name"=>"bar"}
380
+ Completed 500 Internal Server Error in 2ms
381
+ Processing by Dashing::WidgetsController#update as HTML
382
+ Parameters: {"name"=>"foo"}
383
+ Completed 200 OK in 4ms (Views: 1.7ms | ActiveRecord: 0.0ms)
384
+ Processing by Dashing::WidgetsController#update as HTML
385
+ Completed 500 Internal Server Error in 0ms
386
+ Processing by Dashing::DashboardsController#index as HTML
387
+ Completed 200 OK in 28ms (Views: 27.7ms | ActiveRecord: 0.0ms)
388
+ Processing by Dashing::DashboardsController#show as HTML
389
+ Parameters: {"name"=>"foo"}
390
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
391
+ Processing by Dashing::DashboardsController#show as HTML
392
+ Completed 500 Internal Server Error in 0ms
393
+ Processing by Dashing::DashboardsController#show as HTML
394
+ Parameters: {"name"=>"bar"}
395
+ Completed 500 Internal Server Error in 2ms
@@ -4,40 +4,48 @@ describe Dashing::Configuration do
4
4
 
5
5
  let(:instance) { Dashing::Configuration.new }
6
6
 
7
- it { expect(instance).to respond_to(:scheduler) }
8
- it { expect(instance).to respond_to(:redis) }
9
- it { expect(instance).to respond_to(:redis_namespace) }
10
- it { expect(instance).to respond_to(:view_path) }
11
- it { expect(instance).to respond_to(:jobs_path) }
12
- it { expect(instance).to respond_to(:engine_path) }
13
- it { expect(instance).to respond_to(:dashboards_path) }
14
- it { expect(instance).to respond_to(:dashboard_layout) }
15
- it { expect(instance).to respond_to(:widgets_path) }
16
- it { expect(instance).to respond_to(:default_dashboard) }
17
- it { expect(instance).to respond_to(:auth_token) }
18
-
19
- it { expect(instance).to respond_to(:scheduler=) }
20
- it { expect(instance).to respond_to(:redis=) }
21
- it { expect(instance).to respond_to(:redis_namespace=) }
22
- it { expect(instance).to respond_to(:view_path=) }
23
- it { expect(instance).to respond_to(:jobs_path=) }
24
- it { expect(instance).to respond_to(:engine_path=) }
25
- it { expect(instance).to respond_to(:dashboards_path=) }
26
- it { expect(instance).to respond_to(:dashboard_layout=) }
27
- it { expect(instance).to respond_to(:widgets_path=) }
28
- it { expect(instance).to respond_to(:default_dashboard=) }
29
- it { expect(instance).to respond_to(:auth_token=) }
30
-
31
- it { expect(instance.scheduler).to be_a(::Rufus::Scheduler::PlainScheduler) }
32
- it { expect(instance.redis).to be_a(::Redis) }
33
- it { expect(instance.redis_namespace).to eq('dashing_events') }
34
- it { expect(instance.view_path).to eq('app/views/dashing/') }
35
- it { expect(instance.jobs_path).to eq('app/jobs/') }
36
- it { expect(instance.engine_path).to eq('/dashing') }
37
- it { expect(instance.dashboards_path).to eq('app/views/dashing/dashboards/') }
38
- it { expect(instance.dashboard_layout).to eq('dashing/dashboard') }
39
- it { expect(instance.widgets_path).to eq('app/views/dashing/widgets/') }
40
- it { expect(instance.default_dashboard).to be_nil }
41
- it { expect(instance.auth_token).to be_nil }
7
+ it { expect(instance.scheduler).to be_a(::Rufus::Scheduler) }
8
+ it { expect(instance.redis_host).to eq('127.0.0.1') }
9
+ it { expect(instance.redis_port).to eq('6379') }
10
+ it { expect(instance.redis_password).to be_nil }
11
+ it { expect(instance.redis_namespace).to eq('dashing_events') }
12
+ it { expect(instance.view_path).to eq('app/views/dashing/') }
13
+ it { expect(instance.jobs_path).to eq('app/jobs/') }
14
+ it { expect(instance.engine_path).to eq('/dashing') }
15
+ it { expect(instance.dashboards_path).to eq('app/views/dashing/dashboards/') }
16
+ it { expect(instance.dashboard_layout).to eq('dashing/dashboard') }
17
+ it { expect(instance.widgets_path).to eq('app/views/dashing/widgets/') }
18
+ it { expect(instance.default_dashboard).to be_nil }
19
+ it { expect(instance.auth_token).to be_nil }
20
+ it { expect(instance.devise_allowed_models).to be_empty }
21
+
22
+ it { expect(instance.redis).to be_a(::Redis) }
23
+
24
+ describe '#request_thread_count' do
25
+
26
+ context 'when puma respond to cli_config' do
27
+
28
+ let(:value) { 2 }
29
+
30
+ before do
31
+ Object.const_set('Puma', Class.new)
32
+ ::Puma.stub_chain(:cli_config, :options).and_return(max_threads: value)
33
+ end
34
+
35
+ after do
36
+ Object.send(:remove_const, 'Puma') if defined?(Puma)
37
+ end
38
+
39
+ it { expect(instance.send(:request_thread_count)).to eq(value) }
40
+
41
+ end
42
+
43
+ context 'by default' do
44
+
45
+ it { expect(instance.send(:request_thread_count)).to eq(5) }
46
+
47
+ end
48
+
49
+ end
42
50
 
43
51
  end
@@ -18,9 +18,21 @@ describe Dashing do
18
18
  Dashing.stub(:config).and_return(:configuration)
19
19
  end
20
20
 
21
- it 'yields configuration' do
22
- Dashing.should_receive(:configure).and_yield(configuration)
23
- Dashing.configure {|config|}
21
+ context 'when block given' do
22
+
23
+ it 'yields configuration' do
24
+ Dashing.should_receive(:configure).and_yield(configuration)
25
+ Dashing.configure {|config|}
26
+ end
27
+
28
+ end
29
+
30
+ context 'when no block given' do
31
+
32
+ it 'does nothing' do
33
+ Dashing.configure.should be_nil
34
+ end
35
+
24
36
  end
25
37
 
26
38
  end
@@ -1,3 +1,7 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+
1
5
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
6
  ENV['RAILS_ENV'] ||= 'test'
3
7
  ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
@@ -34,7 +38,7 @@ RSpec.configure do |config|
34
38
  # If true, the base class of anonymous controllers will be inferred
35
39
  # automatically. This will be the default behavior in future versions of
36
40
  # rspec-rails.
37
- config.infer_base_class_for_anonymous_controllers = false
41
+ config.infer_base_class_for_anonymous_controllers = true
38
42
 
39
43
  # Run specs in random order to surface order dependencies. If you find an
40
44
  # order dependency and want to debug it, you can fix the order by providing
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dashing-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-11 00:00:00.000000000 Z
12
+ date: 2013-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 3.0.4
37
+ version: '3.0'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 3.0.4
45
+ version: '3.0'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: coffee-script
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 2.2.0
53
+ version: '2.2'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.0
61
+ version: '2.2'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rufus-scheduler
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 2.0.23
69
+ version: '3.0'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 2.0.23
77
+ version: '3.0'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: redis
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 3.0.4
85
+ version: '3.0'
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,23 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 3.0.4
93
+ version: '3.0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: connection_pool
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '1.1'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.1'
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: rspec-rails
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +114,7 @@ dependencies:
98
114
  requirements:
99
115
  - - ~>
100
116
  - !ruby/object:Gem::Version
101
- version: '2.0'
117
+ version: '2.14'
102
118
  type: :development
103
119
  prerelease: false
104
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +122,7 @@ dependencies:
106
122
  requirements:
107
123
  - - ~>
108
124
  - !ruby/object:Gem::Version
109
- version: '2.0'
125
+ version: '2.14'
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: pry-rails
112
128
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +130,7 @@ dependencies:
114
130
  requirements:
115
131
  - - ~>
116
132
  - !ruby/object:Gem::Version
117
- version: 0.2.2
133
+ version: '0.3'
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +138,7 @@ dependencies:
122
138
  requirements:
123
139
  - - ~>
124
140
  - !ruby/object:Gem::Version
125
- version: 0.2.2
141
+ version: '0.3'
126
142
  - !ruby/object:Gem::Dependency
127
143
  name: better_errors
128
144
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +146,7 @@ dependencies:
130
146
  requirements:
131
147
  - - ~>
132
148
  - !ruby/object:Gem::Version
133
- version: 0.8.0
149
+ version: '1.0'
134
150
  type: :development
135
151
  prerelease: false
136
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +154,7 @@ dependencies:
138
154
  requirements:
139
155
  - - ~>
140
156
  - !ruby/object:Gem::Version
141
- version: 0.8.0
157
+ version: '1.0'
142
158
  description: The exceptionally handsome dashboard framework for Rails.
143
159
  email:
144
160
  - pierrelouis.gottfrois@gmail.com
@@ -222,6 +238,7 @@ files:
222
238
  - MIT-LICENSE
223
239
  - Rakefile
224
240
  - README.md
241
+ - spec/controllers/dashing/application_controller_spec.rb
225
242
  - spec/controllers/dashing/dashboards_controller_spec.rb
226
243
  - spec/controllers/dashing/events_controller_spec.rb
227
244
  - spec/controllers/dashing/widgets_controller_spec.rb
@@ -280,7 +297,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
280
297
  version: '0'
281
298
  segments:
282
299
  - 0
283
- hash: 4342345080438804158
300
+ hash: -294757915514747581
284
301
  required_rubygems_version: !ruby/object:Gem::Requirement
285
302
  none: false
286
303
  requirements:
@@ -289,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
306
  version: '0'
290
307
  segments:
291
308
  - 0
292
- hash: 4342345080438804158
309
+ hash: -294757915514747581
293
310
  requirements: []
294
311
  rubyforge_project:
295
312
  rubygems_version: 1.8.25
@@ -297,6 +314,7 @@ signing_key:
297
314
  specification_version: 3
298
315
  summary: The exceptionally handsome dashboard framework for Rails.
299
316
  test_files:
317
+ - spec/controllers/dashing/application_controller_spec.rb
300
318
  - spec/controllers/dashing/dashboards_controller_spec.rb
301
319
  - spec/controllers/dashing/events_controller_spec.rb
302
320
  - spec/controllers/dashing/widgets_controller_spec.rb