consul 0.12.2 → 0.12.3
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/consul.gemspec +1 -1
- data/lib/consul/version.rb +1 -1
- metadata +2 -126
- data/spec/rails-2.3/Gemfile +0 -13
- data/spec/rails-2.3/Gemfile.lock +0 -65
- data/spec/rails-2.3/Rakefile +0 -11
- data/spec/rails-2.3/app_root/app +0 -1
- data/spec/rails-2.3/app_root/config/boot.rb +0 -128
- data/spec/rails-2.3/app_root/config/database.yml +0 -21
- data/spec/rails-2.3/app_root/config/environment.rb +0 -14
- data/spec/rails-2.3/app_root/config/environments/in_memory.rb +0 -0
- data/spec/rails-2.3/app_root/config/environments/mysql.rb +0 -0
- data/spec/rails-2.3/app_root/config/environments/postgresql.rb +0 -0
- data/spec/rails-2.3/app_root/config/environments/sqlite.rb +0 -0
- data/spec/rails-2.3/app_root/config/environments/sqlite3.rb +0 -0
- data/spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb +0 -1
- data/spec/rails-2.3/app_root/config/preinitializer.rb +0 -20
- data/spec/rails-2.3/app_root/config/routes.rb +0 -21
- data/spec/rails-2.3/app_root/db +0 -1
- data/spec/rails-2.3/app_root/log/.gitignore +0 -1
- data/spec/rails-2.3/rcov.opts +0 -2
- data/spec/rails-2.3/spec.opts +0 -4
- data/spec/rails-2.3/spec/spec_helper.rb +0 -36
- data/spec/rails-3.0/.rspec +0 -2
- data/spec/rails-3.0/Gemfile +0 -11
- data/spec/rails-3.0/Gemfile.lock +0 -126
- data/spec/rails-3.0/Rakefile +0 -11
- data/spec/rails-3.0/app_root/.gitignore +0 -4
- data/spec/rails-3.0/app_root/app +0 -1
- data/spec/rails-3.0/app_root/config/application.rb +0 -31
- data/spec/rails-3.0/app_root/config/boot.rb +0 -13
- data/spec/rails-3.0/app_root/config/database.yml +0 -4
- data/spec/rails-3.0/app_root/config/environment.rb +0 -5
- data/spec/rails-3.0/app_root/config/environments/test.rb +0 -35
- data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails-3.0/app_root/config/initializers/inflections.rb +0 -10
- data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +0 -5
- data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +0 -7
- data/spec/rails-3.0/app_root/config/initializers/session_store.rb +0 -8
- data/spec/rails-3.0/app_root/config/routes.rb +0 -3
- data/spec/rails-3.0/app_root/db +0 -1
- data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
- data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
- data/spec/rails-3.0/app_root/script/rails +0 -6
- data/spec/rails-3.0/rcov.opts +0 -2
- data/spec/rails-3.0/spec/spec_helper.rb +0 -23
- data/spec/rails-3.2/.rspec +0 -2
- data/spec/rails-3.2/Gemfile +0 -11
- data/spec/rails-3.2/Gemfile.lock +0 -135
- data/spec/rails-3.2/Rakefile +0 -11
- data/spec/rails-3.2/app_root/.gitignore +0 -4
- data/spec/rails-3.2/app_root/app +0 -1
- data/spec/rails-3.2/app_root/config/application.rb +0 -31
- data/spec/rails-3.2/app_root/config/boot.rb +0 -13
- data/spec/rails-3.2/app_root/config/database.yml +0 -4
- data/spec/rails-3.2/app_root/config/environment.rb +0 -5
- data/spec/rails-3.2/app_root/config/environments/test.rb +0 -35
- data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails-3.2/app_root/config/initializers/inflections.rb +0 -10
- data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +0 -5
- data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +0 -7
- data/spec/rails-3.2/app_root/config/initializers/session_store.rb +0 -8
- data/spec/rails-3.2/app_root/config/routes.rb +0 -3
- data/spec/rails-3.2/app_root/db +0 -1
- data/spec/rails-3.2/app_root/log/.gitignore +0 -1
- data/spec/rails-3.2/rcov.opts +0 -2
- data/spec/rails-3.2/spec/spec_helper.rb +0 -27
- data/spec/rails-4.1/.rspec +0 -2
- data/spec/rails-4.1/Gemfile +0 -12
- data/spec/rails-4.1/Gemfile.lock +0 -134
- data/spec/rails-4.1/Rakefile +0 -12
- data/spec/rails-4.1/app_root/.gitignore +0 -16
- data/spec/rails-4.1/app_root/app +0 -1
- data/spec/rails-4.1/app_root/bin/bundle +0 -3
- data/spec/rails-4.1/app_root/bin/rails +0 -8
- data/spec/rails-4.1/app_root/bin/rake +0 -8
- data/spec/rails-4.1/app_root/bin/spring +0 -18
- data/spec/rails-4.1/app_root/config/application.rb +0 -28
- data/spec/rails-4.1/app_root/config/boot.rb +0 -4
- data/spec/rails-4.1/app_root/config/database.yml +0 -4
- data/spec/rails-4.1/app_root/config/environment.rb +0 -5
- data/spec/rails-4.1/app_root/config/environments/development.rb +0 -37
- data/spec/rails-4.1/app_root/config/environments/production.rb +0 -83
- data/spec/rails-4.1/app_root/config/environments/test.rb +0 -39
- data/spec/rails-4.1/app_root/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails-4.1/app_root/config/initializers/cookies_serializer.rb +0 -3
- data/spec/rails-4.1/app_root/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/rails-4.1/app_root/config/initializers/inflections.rb +0 -16
- data/spec/rails-4.1/app_root/config/initializers/mime_types.rb +0 -4
- data/spec/rails-4.1/app_root/config/initializers/session_store.rb +0 -3
- data/spec/rails-4.1/app_root/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails-4.1/app_root/config/locales/en.yml +0 -23
- data/spec/rails-4.1/app_root/config/routes.rb +0 -3
- data/spec/rails-4.1/app_root/config/secrets.yml +0 -22
- data/spec/rails-4.1/app_root/db +0 -1
- data/spec/rails-4.1/log/test.log +0 -0
- data/spec/rails-4.1/rcov.opts +0 -2
- data/spec/rails-4.1/spec/spec_helper.rb +0 -30
- data/spec/shared/app_root/app/controllers/application_controller.rb +0 -16
- data/spec/shared/app_root/app/controllers/cakes_controller.rb +0 -55
- data/spec/shared/app_root/app/controllers/client_notes_controller.rb +0 -13
- data/spec/shared/app_root/app/controllers/colors_controller.rb +0 -10
- data/spec/shared/app_root/app/controllers/dashboards_controller.rb +0 -20
- data/spec/shared/app_root/app/controllers/risks_controller.rb +0 -7
- data/spec/shared/app_root/app/controllers/songs_controller.rb +0 -14
- data/spec/shared/app_root/app/controllers/users_controller.rb +0 -13
- data/spec/shared/app_root/app/models/client.rb +0 -9
- data/spec/shared/app_root/app/models/deal.rb +0 -3
- data/spec/shared/app_root/app/models/deal/item.rb +0 -3
- data/spec/shared/app_root/app/models/note.rb +0 -7
- data/spec/shared/app_root/app/models/power.rb +0 -133
- data/spec/shared/app_root/app/models/song.rb +0 -6
- data/spec/shared/app_root/app/models/user.rb +0 -8
- data/spec/shared/app_root/db/migrate/001_create_users.rb +0 -13
- data/spec/shared/app_root/db/migrate/002_create_clients.rb +0 -13
- data/spec/shared/app_root/db/migrate/003_create_notes.rb +0 -13
- data/spec/shared/app_root/db/migrate/004_create_songs.rb +0 -14
- data/spec/shared/consul/active_record_spec.rb +0 -37
- data/spec/shared/consul/controllers/cakes_controller_spec.rb +0 -61
- data/spec/shared/consul/controllers/client_notes_controller_spec.rb +0 -25
- data/spec/shared/consul/controllers/colors_controller_spec.rb +0 -29
- data/spec/shared/consul/controllers/dashboards_controller_spec.rb +0 -26
- data/spec/shared/consul/controllers/risks_controller_spec.rb +0 -9
- data/spec/shared/consul/controllers/songs_controller_spec.rb +0 -13
- data/spec/shared/consul/controllers/users_controller_spec.rb +0 -25
- data/spec/shared/consul/power_spec.rb +0 -688
- data/spec/shared/consul/util_spec.rb +0 -17
@@ -1,55 +0,0 @@
|
|
1
|
-
class CakesController < ApplicationController
|
2
|
-
|
3
|
-
power :crud => :cakes, :as => :end_of_association_chain
|
4
|
-
|
5
|
-
def show
|
6
|
-
notify_spy
|
7
|
-
render_nothing
|
8
|
-
end
|
9
|
-
|
10
|
-
def index
|
11
|
-
notify_spy
|
12
|
-
render_nothing
|
13
|
-
end
|
14
|
-
|
15
|
-
def new
|
16
|
-
notify_spy
|
17
|
-
render_nothing
|
18
|
-
end
|
19
|
-
|
20
|
-
def create
|
21
|
-
notify_spy
|
22
|
-
render_nothing
|
23
|
-
end
|
24
|
-
|
25
|
-
def edit
|
26
|
-
notify_spy
|
27
|
-
render_nothing
|
28
|
-
end
|
29
|
-
|
30
|
-
def update
|
31
|
-
notify_spy
|
32
|
-
render_nothing
|
33
|
-
end
|
34
|
-
|
35
|
-
def destroy
|
36
|
-
notify_spy
|
37
|
-
render_nothing
|
38
|
-
end
|
39
|
-
|
40
|
-
def custom_action
|
41
|
-
notify_spy
|
42
|
-
render_nothing
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def notify_spy
|
48
|
-
observe_end_of_association_chain(end_of_association_chain)
|
49
|
-
end
|
50
|
-
|
51
|
-
def observe_end_of_association_chain(scope)
|
52
|
-
# spy for spec
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class DashboardsController < ApplicationController
|
2
|
-
|
3
|
-
power :always_true
|
4
|
-
|
5
|
-
def show
|
6
|
-
observe(current_power)
|
7
|
-
render_nothing
|
8
|
-
end
|
9
|
-
|
10
|
-
def error
|
11
|
-
raise 'error during action'
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def observe(object)
|
17
|
-
# test spy
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
class Power
|
2
|
-
include Consul::Power
|
3
|
-
|
4
|
-
def initialize(*args)
|
5
|
-
@options = args.extract_options!
|
6
|
-
@user = args.first
|
7
|
-
end
|
8
|
-
|
9
|
-
power :clients do
|
10
|
-
Client.active unless guest?
|
11
|
-
end
|
12
|
-
|
13
|
-
power :all_clients do
|
14
|
-
Client
|
15
|
-
end
|
16
|
-
|
17
|
-
power :fast_clients do
|
18
|
-
Client.active
|
19
|
-
end
|
20
|
-
|
21
|
-
power :fast_client? do |client|
|
22
|
-
!client.deleted?
|
23
|
-
end
|
24
|
-
|
25
|
-
power :client_notes do |client|
|
26
|
-
client.notes
|
27
|
-
end
|
28
|
-
|
29
|
-
power :fast_client_notes do |client|
|
30
|
-
client.notes
|
31
|
-
end
|
32
|
-
|
33
|
-
power :fast_client_note? do |client, note|
|
34
|
-
note.client_id == client.id
|
35
|
-
end
|
36
|
-
|
37
|
-
power :fast_client_note_without_collection? do |client, note|
|
38
|
-
note.client_id == client.id
|
39
|
-
end
|
40
|
-
|
41
|
-
power :notes do
|
42
|
-
Note.scoped(:joins => :client)
|
43
|
-
end
|
44
|
-
|
45
|
-
power :always_true do
|
46
|
-
true
|
47
|
-
end
|
48
|
-
|
49
|
-
power :always_false do
|
50
|
-
false
|
51
|
-
end
|
52
|
-
|
53
|
-
power :always_nil do
|
54
|
-
nil
|
55
|
-
end
|
56
|
-
|
57
|
-
power :cakes do
|
58
|
-
:cakes
|
59
|
-
end
|
60
|
-
|
61
|
-
power :updatable_cakes do
|
62
|
-
:updatable_cakes
|
63
|
-
end
|
64
|
-
|
65
|
-
power :creatable_cakes do
|
66
|
-
:creatable_cakes
|
67
|
-
end
|
68
|
-
|
69
|
-
power :destroyable_cakes do
|
70
|
-
:destroyable_cakes
|
71
|
-
end
|
72
|
-
|
73
|
-
def assignable_user_roles
|
74
|
-
%w[guest admin]
|
75
|
-
end
|
76
|
-
|
77
|
-
power :key_figures do
|
78
|
-
%w[amount working_costs] unless guest?
|
79
|
-
end
|
80
|
-
|
81
|
-
power :api_key do
|
82
|
-
'secret-api-key' unless guest?
|
83
|
-
end
|
84
|
-
|
85
|
-
power :shorthand1, :shorthand2, :shorthand3 do
|
86
|
-
'shorthand'
|
87
|
-
end
|
88
|
-
|
89
|
-
power :songs do
|
90
|
-
Song
|
91
|
-
end
|
92
|
-
|
93
|
-
power :recent_songs do
|
94
|
-
Song.recent
|
95
|
-
end
|
96
|
-
|
97
|
-
power :deals do
|
98
|
-
'deals power' unless guest?
|
99
|
-
end
|
100
|
-
|
101
|
-
power :updatable_deals do
|
102
|
-
'updatable_deals power' unless guest?
|
103
|
-
end
|
104
|
-
|
105
|
-
power :deal_items do
|
106
|
-
'deal_items power'
|
107
|
-
end
|
108
|
-
|
109
|
-
power :red do
|
110
|
-
'red' if @options[:red]
|
111
|
-
end
|
112
|
-
|
113
|
-
power :blue do
|
114
|
-
'blue' if @options[:blue]
|
115
|
-
end
|
116
|
-
|
117
|
-
private
|
118
|
-
|
119
|
-
attr_accessor :user
|
120
|
-
|
121
|
-
def role
|
122
|
-
user.role
|
123
|
-
end
|
124
|
-
|
125
|
-
def admin?
|
126
|
-
user.role == 'admin'
|
127
|
-
end
|
128
|
-
|
129
|
-
def guest?
|
130
|
-
user.role == 'guest'
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Consul::ActiveRecord do
|
4
|
-
|
5
|
-
describe '.authorize_values_for' do
|
6
|
-
|
7
|
-
it 'should be a shortcut for .assignable_values_for :attribute, :through => lambda { ::Power.current }' do
|
8
|
-
klass = Note.disposable_copy
|
9
|
-
klass.should_receive(:assignable_values_for).with(:attribute, :option => 'option', :through => kind_of(Proc))
|
10
|
-
klass.class_eval do
|
11
|
-
authorize_values_for :attribute, :option => 'option'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should not generate a getter and setter for a @power field (change from previous versions)' do
|
16
|
-
klass = Note.disposable_copy do
|
17
|
-
authorize_values_for :attribute
|
18
|
-
end
|
19
|
-
note = klass.new
|
20
|
-
note.should_not respond_to(:power)
|
21
|
-
note.should_not respond_to(:power=)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should obtain assignable values from Power.current' do
|
25
|
-
Power.current = Power.new
|
26
|
-
klass = User.disposable_copy do
|
27
|
-
authorize_values_for :role
|
28
|
-
end
|
29
|
-
user = klass.new
|
30
|
-
user.assignable_roles.should =~ %w[guest admin]
|
31
|
-
user.should allow_value('guest').for(:role)
|
32
|
-
user.should_not allow_value('invalid-value').for(:role)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CakesController, :type => :controller do
|
4
|
-
|
5
|
-
describe '#show' do
|
6
|
-
it 'should get the power :cakes' do
|
7
|
-
controller.should_receive(:observe_end_of_association_chain).with(:cakes)
|
8
|
-
get :show, :id => 'id'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#index' do
|
13
|
-
it 'should get the power :cakes' do
|
14
|
-
controller.should_receive(:observe_end_of_association_chain).with(:cakes)
|
15
|
-
get :index
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#new' do
|
20
|
-
it 'should get the power :creatable_cakes' do
|
21
|
-
controller.should_receive(:observe_end_of_association_chain).with(:creatable_cakes)
|
22
|
-
get :new
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#creatable' do
|
27
|
-
it 'should get the power :creatable_cakes' do
|
28
|
-
controller.should_receive(:observe_end_of_association_chain).with(:creatable_cakes)
|
29
|
-
post :create
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#edit' do
|
34
|
-
it 'should get the power :updatable_cakes' do
|
35
|
-
controller.should_receive(:observe_end_of_association_chain).with(:updatable_cakes)
|
36
|
-
get :edit, :id => 'id'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#update' do
|
41
|
-
it 'should get the power :updatable_cakes' do
|
42
|
-
controller.should_receive(:observe_end_of_association_chain).with(:updatable_cakes)
|
43
|
-
put :update, :id => 'id'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#destroy' do
|
48
|
-
it 'should get the power :destroyable_cakes' do
|
49
|
-
controller.should_receive(:observe_end_of_association_chain).with(:destroyable_cakes)
|
50
|
-
delete :destroy, :id => '1'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '#custom_action' do
|
55
|
-
it 'should get the power :cakes' do
|
56
|
-
controller.should_receive(:observe_end_of_association_chain).with(:cakes)
|
57
|
-
get :custom_action, :id => '1'
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|