acts_as_user 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_user/is_user.rb +4 -3
- data/lib/acts_as_user/version.rb +1 -1
- data/spec/models/active_record/user_spec.rb +4 -3
- metadata +31 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9395de4eb67758b1ddda0c67a10d431c441efa7a
|
4
|
+
data.tar.gz: 153d2483895ff9ca926af025a0c05ad2e49238fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 075447c5eb1468406e6aaf9d4567e9d693641c1ea2eed34e9401879ce49e5eae9a8d5d11db68ebee333a0c3685a153ee111a0b235861bc65bde58f804d0b38fd
|
7
|
+
data.tar.gz: 1c41be2173ca78c6e1215932aca5a8a76374d865d903600d69c3ed903880a2feb218f67b603cc1270eb28e98254d61d028e5a51b213a917a319d78c2e1640c9f
|
data/lib/acts_as_user/is_user.rb
CHANGED
@@ -10,9 +10,10 @@ module ActsAsUser
|
|
10
10
|
|
11
11
|
module ClassMethods
|
12
12
|
def define_models_acting_as_users
|
13
|
-
ActsAsUser.models_acting_as_users.
|
14
|
-
|
15
|
-
|
13
|
+
models_acting_as_users = ActsAsUser.models_acting_as_users.map(&:to_s).map(&:downcase)
|
14
|
+
models_acting_as_users.each do |model_class_name|
|
15
|
+
define_method("#{model_class_name}?") do
|
16
|
+
self.userable_type.to_s.downcase == model_class_name
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
data/lib/acts_as_user/version.rb
CHANGED
@@ -7,6 +7,7 @@ describe User do
|
|
7
7
|
it { should respond_to :customer? }
|
8
8
|
it { should respond_to :admin? }
|
9
9
|
|
10
|
+
|
10
11
|
describe '#customer?' do
|
11
12
|
context 'when is a customer' do
|
12
13
|
before do
|
@@ -14,7 +15,7 @@ describe User do
|
|
14
15
|
@current_user = @customer_user.user
|
15
16
|
end
|
16
17
|
it 'returns true' do
|
17
|
-
@current_user.
|
18
|
+
expect(@current_user).to be_customer
|
18
19
|
end
|
19
20
|
end
|
20
21
|
context 'when is not customer' do
|
@@ -23,7 +24,7 @@ describe User do
|
|
23
24
|
@current_user = @fake_customer_user.user
|
24
25
|
end
|
25
26
|
it 'returns false' do
|
26
|
-
@current_user.
|
27
|
+
expect(@current_user).not_to be_customer
|
27
28
|
end
|
28
29
|
end
|
29
30
|
context 'when is an admin' do
|
@@ -32,7 +33,7 @@ describe User do
|
|
32
33
|
@current_user = @admin_user.user
|
33
34
|
end
|
34
35
|
it 'returns true' do
|
35
|
-
@current_user.
|
36
|
+
expect(@current_user).to be_admin
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abraham Kuri
|
@@ -15,168 +15,168 @@ dependencies:
|
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.3'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.3'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: sqlite3
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: activerecord
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rails
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: shoulda-matchers
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: activesupport
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: database_cleaner
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - ~>
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 1.2.0
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - ~>
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: 1.2.0
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: debugger
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- -
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: orm_adapter
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - ~>
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0.1'
|
161
161
|
type: :runtime
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- - ~>
|
165
|
+
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0.1'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: activerecord
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- -
|
172
|
+
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '3.0'
|
175
175
|
type: :runtime
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '3.0'
|
182
182
|
description: A ruby gem to handle multiple user roles on a Rails app, it also has
|
@@ -188,9 +188,9 @@ executables: []
|
|
188
188
|
extensions: []
|
189
189
|
extra_rdoc_files: []
|
190
190
|
files:
|
191
|
-
- .gitignore
|
192
|
-
- .rspec
|
193
|
-
- .travis.yml
|
191
|
+
- ".gitignore"
|
192
|
+
- ".rspec"
|
193
|
+
- ".travis.yml"
|
194
194
|
- Gemfile
|
195
195
|
- LICENSE.txt
|
196
196
|
- README.md
|
@@ -230,17 +230,17 @@ require_paths:
|
|
230
230
|
- lib
|
231
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
232
232
|
requirements:
|
233
|
-
- -
|
233
|
+
- - ">="
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
237
|
requirements:
|
238
|
-
- -
|
238
|
+
- - ">="
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: '0'
|
241
241
|
requirements: []
|
242
242
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.1.11
|
244
244
|
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: Handles multiple user roles on a rails app
|
@@ -255,4 +255,3 @@ test_files:
|
|
255
255
|
- spec/support/database_cleaner.rb
|
256
256
|
- spec/support/models.rb
|
257
257
|
- spec/support/schema.rb
|
258
|
-
has_rdoc:
|