omniauth-identity 3.0.3 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +69 -0
- data/README.md +94 -12
- data/lib/omniauth-identity/version.rb +1 -1
- data/lib/omniauth/identity.rb +2 -1
- data/lib/omniauth/identity/model.rb +92 -29
- data/lib/omniauth/identity/models/active_record.rb +2 -2
- data/lib/omniauth/identity/models/couch_potato.rb +6 -0
- data/lib/omniauth/identity/models/mongoid.rb +1 -0
- data/lib/omniauth/identity/models/{no_brainer.rb → nobrainer.rb} +1 -0
- data/lib/omniauth/identity/models/sequel.rb +48 -0
- data/lib/omniauth/identity/secure_password.rb +98 -37
- data/lib/omniauth/strategies/identity.rb +47 -23
- data/spec/omniauth/identity/model_spec.rb +19 -99
- data/spec/omniauth/identity/models/active_record_spec.rb +19 -10
- data/spec/omniauth/identity/models/sequel_spec.rb +38 -0
- data/spec/omniauth/strategies/identity_spec.rb +123 -5
- data/spec/spec_helper.rb +16 -4
- data/spec/support/shared_contexts/instance_with_instance_methods.rb +89 -0
- data/spec/support/shared_contexts/model_with_class_methods.rb +29 -0
- data/spec/support/shared_contexts/persistable_model.rb +24 -0
- metadata +29 -54
- data/spec/omniauth/identity/models/couch_potato_spec.rb +0 -21
- data/spec/omniauth/identity/models/mongoid_spec.rb +0 -28
- data/spec/omniauth/identity/models/no_brainer_spec.rb +0 -17
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'couch_potato'
|
4
|
-
|
5
|
-
class CouchPotatoTestIdentity
|
6
|
-
include CouchPotato::Persistence
|
7
|
-
include OmniAuth::Identity::Models::CouchPotatoModule
|
8
|
-
auth_key :ham_sandwich
|
9
|
-
end
|
10
|
-
|
11
|
-
RSpec.describe(OmniAuth::Identity::Models::CouchPotatoModule, db: true) do
|
12
|
-
describe 'model', type: :model do
|
13
|
-
subject { CouchPotatoTestIdentity }
|
14
|
-
|
15
|
-
it 'delegates locate to the where query method' do
|
16
|
-
allow(subject).to receive(:where).with('ham_sandwich' => 'open faced',
|
17
|
-
'category' => 'sandwiches').and_return(['wakka'])
|
18
|
-
expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'mongoid'
|
4
|
-
|
5
|
-
class MongoidTestIdentity
|
6
|
-
include Mongoid::Document
|
7
|
-
include OmniAuth::Identity::Models::Mongoid
|
8
|
-
auth_key :ham_sandwich
|
9
|
-
store_in database: 'db1', collection: 'mongoid_test_identities', client: 'secondary'
|
10
|
-
end
|
11
|
-
|
12
|
-
RSpec.describe(OmniAuth::Identity::Models::Mongoid, db: true) do
|
13
|
-
describe 'model', type: :model do
|
14
|
-
subject { MongoidTestIdentity }
|
15
|
-
|
16
|
-
it { is_expected.to be_mongoid_document }
|
17
|
-
|
18
|
-
it 'does not munge collection name' do
|
19
|
-
expect(subject).to be_stored_in(database: 'db1', collection: 'mongoid_test_identities', client: 'secondary')
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'delegates locate to the where query method' do
|
23
|
-
allow(subject).to receive(:where).with('ham_sandwich' => 'open faced',
|
24
|
-
'category' => 'sandwiches').and_return(['wakka'])
|
25
|
-
expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'nobrainer'
|
4
|
-
|
5
|
-
class NobrainerTestIdentity
|
6
|
-
include NoBrainer::Document
|
7
|
-
include OmniAuth::Identity::Models::NoBrainer
|
8
|
-
auth_key :ham_sandwich
|
9
|
-
end
|
10
|
-
|
11
|
-
RSpec.describe(OmniAuth::Identity::Models::NoBrainer, db: true) do
|
12
|
-
it 'delegates locate to the where query method' do
|
13
|
-
allow(NobrainerTestIdentity).to receive(:where).with('ham_sandwich' => 'open faced',
|
14
|
-
'category' => 'sandwiches').and_return(['wakka'])
|
15
|
-
expect(NobrainerTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
16
|
-
end
|
17
|
-
end
|