casino-activerecord_authenticator 4.0.0.pre.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ class CASino::ActiveRecordAuthenticator
|
|
20
20
|
model_name = @options[:model_name]
|
21
21
|
else
|
22
22
|
model_name = @options[:table]
|
23
|
-
if @options[:connection][:database]
|
23
|
+
if @options[:connection].kind_of?(Hash) && @options[:connection][:database]
|
24
24
|
model_name = "#{@options[:connection][:database].gsub(/[^a-zA-Z]+/, '')}_#{model_name}"
|
25
25
|
end
|
26
26
|
model_name = model_name.classify
|
@@ -19,6 +19,7 @@ describe CASino::ActiveRecordAuthenticator do
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
let(:faulty_options){ options.merge(table: nil) }
|
22
|
+
let(:connection_as_string) { options.merge(connection: 'sqlite3:/tmp/casino-test-auth.sqlite') }
|
22
23
|
let(:user_class) { described_class::TmpcasinotestauthsqliteUser }
|
23
24
|
|
24
25
|
subject { described_class.new(options) }
|
@@ -83,7 +84,7 @@ describe CASino::ActiveRecordAuthenticator do
|
|
83
84
|
describe '#load_user_data' do
|
84
85
|
context 'valid username' do
|
85
86
|
it 'returns the username' do
|
86
|
-
subject.
|
87
|
+
subject.load_user_data('test')[:username].should eq('test')
|
87
88
|
end
|
88
89
|
|
89
90
|
it 'returns the extra attributes' do
|
@@ -193,6 +194,17 @@ describe CASino::ActiveRecordAuthenticator do
|
|
193
194
|
end
|
194
195
|
end
|
195
196
|
|
197
|
+
context 'support for connection string' do
|
198
|
+
|
199
|
+
it 'should not raise an error' do
|
200
|
+
expect{described_class.new(connection_as_string)}.to_not raise_error
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'returns the username' do
|
204
|
+
described_class.new(connection_as_string).load_user_data('test')[:username].should eq('test')
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
196
208
|
end
|
197
209
|
|
198
210
|
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casino-activerecord_authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nils Caspar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -219,9 +219,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
219
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
220
|
none: false
|
221
221
|
requirements:
|
222
|
-
- - ! '
|
222
|
+
- - ! '>='
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version:
|
224
|
+
version: '0'
|
225
225
|
requirements: []
|
226
226
|
rubyforge_project:
|
227
227
|
rubygems_version: 1.8.23
|