consul 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of consul might be problematic. Click here for more details.
data/lib/consul/controller.rb
CHANGED
@@ -4,6 +4,15 @@ module Consul
|
|
4
4
|
def self.included(base)
|
5
5
|
base.send :include, InstanceMethods
|
6
6
|
base.send :extend, ClassMethods
|
7
|
+
if ensure_power_initializer_present?
|
8
|
+
base.before_filter :ensure_power_initializer_present
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def self.ensure_power_initializer_present?
|
15
|
+
['development', 'test', 'cucumber', 'in_memory'].include?(Rails.env)
|
7
16
|
end
|
8
17
|
|
9
18
|
module ClassMethods
|
@@ -101,6 +110,12 @@ module Consul
|
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
113
|
+
def ensure_power_initializer_present
|
114
|
+
unless self.class.current_power_initializer.present?
|
115
|
+
raise Consul::UnreachablePower, 'You included Consul::Controller but forgot to define a power using current_power do ... end'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
104
119
|
end
|
105
120
|
|
106
121
|
end
|
data/lib/consul/errors.rb
CHANGED
data/lib/consul/version.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe RisksController do
|
4
|
+
|
5
|
+
it "should raise an error it includes Consul::Controller but forgets to define current_power do ... end" do
|
6
|
+
expect { put :show, :id => '1' }.to raise_error(Consul::UnreachablePower)
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Henning Koch
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-29 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/consul/version.rb
|
143
143
|
- spec/app_root/app/controllers/application_controller.rb
|
144
144
|
- spec/app_root/app/controllers/dashboards_controller.rb
|
145
|
+
- spec/app_root/app/controllers/risks_controller.rb
|
145
146
|
- spec/app_root/app/controllers/songs_controller.rb
|
146
147
|
- spec/app_root/app/controllers/users_controller.rb
|
147
148
|
- spec/app_root/app/models/client.rb
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- spec/consul/active_record_spec.rb
|
167
168
|
- spec/consul/power_spec.rb
|
168
169
|
- spec/controllers/dashboards_controller_spec.rb
|
170
|
+
- spec/controllers/risks_controller_spec.rb
|
169
171
|
- spec/controllers/songs_controller_spec.rb
|
170
172
|
- spec/controllers/users_controller_spec.rb
|
171
173
|
- spec/rcov.opts
|
@@ -203,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
205
|
requirements: []
|
204
206
|
|
205
207
|
rubyforge_project:
|
206
|
-
rubygems_version: 1.3.9.
|
208
|
+
rubygems_version: 1.3.9.3
|
207
209
|
signing_key:
|
208
210
|
specification_version: 3
|
209
211
|
summary: A scope-based authorization solution for Ruby on Rails.
|