openstax_accounts 7.9.0 → 7.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/handlers/openstax/accounts/sessions_callback.rb +1 -0
  3. data/app/models/openstax/accounts/account.rb +3 -3
  4. data/app/representers/openstax/accounts/api/v1/account_representer.rb +6 -0
  5. data/app/representers/openstax/accounts/api/v1/unclaimed_account_representer.rb +6 -0
  6. data/app/routines/openstax/accounts/dev/create_account.rb +2 -1
  7. data/app/routines/openstax/accounts/find_or_create_account.rb +3 -0
  8. data/app/routines/openstax/accounts/sync_accounts.rb +9 -6
  9. data/db/migrate/11_add_support_identifier_to_accounts_accounts.rb +8 -0
  10. data/lib/openstax/accounts/version.rb +1 -1
  11. data/spec/cassettes/OpenStax_Accounts_FindOrCreateAccount/can_create_users.yml +9 -9
  12. data/spec/controllers/openstax/accounts/dev/accounts_controller_spec.rb +1 -1
  13. data/spec/controllers/openstax/accounts/forwards_params_spec.rb +1 -1
  14. data/spec/controllers/openstax/accounts/sessions_controller_spec.rb +1 -1
  15. data/spec/controllers/openstax/accounts/uses_this_engine_controller_spec.rb +1 -1
  16. data/spec/dummy/db/schema.rb +3 -0
  17. data/spec/dummy/log/development.log +560 -0
  18. data/spec/dummy/log/test.log +27696 -0
  19. data/spec/factories/openstax_accounts_account.rb +7 -6
  20. data/spec/handlers/openstax/accounts/accounts_search_spec.rb +1 -1
  21. data/spec/handlers/openstax/accounts/dev/accounts_search_spec.rb +1 -1
  22. data/spec/handlers/openstax/accounts/sessions_callback_spec.rb +27 -7
  23. data/spec/lib/openstax/accounts/api_spec.rb +1 -1
  24. data/spec/lib/openstax/accounts/configuration_spec.rb +1 -1
  25. data/spec/lib/openstax/accounts/current_user_manager_spec.rb +1 -1
  26. data/spec/lib/openstax/accounts/has_many_through_groups/active_record/base_spec.rb +1 -1
  27. data/spec/models/openstax/accounts/account_spec.rb +5 -1
  28. data/spec/models/openstax/accounts/anonymous_account_spec.rb +1 -1
  29. data/spec/models/openstax/accounts/group_spec.rb +1 -1
  30. data/spec/routines/openstax/accounts/create_group_spec.rb +1 -1
  31. data/spec/routines/openstax/accounts/find_or_create_account_spec.rb +18 -8
  32. data/spec/routines/openstax/accounts/search_accounts_spec.rb +1 -1
  33. data/spec/routines/openstax/accounts/sync_accounts_spec.rb +39 -29
  34. data/spec/routines/openstax/accounts/sync_groups_spec.rb +47 -65
  35. data/spec/spec_helper.rb +17 -9
  36. metadata +17 -2
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,7 @@ require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
4
 
5
5
  require 'rspec/rails'
6
6
  require 'factory_bot_rails'
7
+ require 'shoulda-matchers'
7
8
 
8
9
  Rails.backtrace_cleaner.remove_silencers!
9
10
 
@@ -42,33 +43,40 @@ RSpec.configure do |config|
42
43
  config.order = :random
43
44
  end
44
45
 
46
+ Shoulda::Matchers.configure do |config|
47
+ config.integrate do |with|
48
+ with.test_framework :rspec
49
+ with.library :rails
50
+ end
51
+ end
45
52
 
46
- def mock_omniauth_request(uid: nil, first_name: nil, last_name: nil, title: nil,
47
- nickname: nil, faculty_status: nil, uuid: nil, self_reported_role: nil)
53
+ def mock_omniauth_request(
54
+ uid: nil, first_name: nil, last_name: nil, title: nil, nickname: nil, faculty_status: nil,
55
+ uuid: nil, support_identifier: nil, self_reported_role: nil
56
+ )
48
57
  extra_hash = {
49
58
  'raw_info' => {
50
59
  'faculty_status' => faculty_status,
51
60
  'uuid' => uuid || SecureRandom.uuid,
61
+ 'support_identifier' => support_identifier || "cs_#{SecureRandom.hex(4)}",
52
62
  'self_reported_role' => self_reported_role
53
63
  }
54
64
  }
55
65
 
56
66
  OpenStruct.new(
57
67
  env: {
58
- 'omniauth.auth' => OpenStruct.new({
68
+ 'omniauth.auth' => OpenStruct.new(
59
69
  uid: uid || SecureRandom.random_number(10000000),
60
70
  provider: "openstax",
61
- info: OpenStruct.new({
71
+ info: OpenStruct.new(
62
72
  nickname: nickname || "",
63
73
  first_name: first_name || "",
64
74
  last_name: last_name || "",
65
75
  title: title || ""
66
- }),
67
- credentials: OpenStruct.new({
68
- access_token: "foo"
69
- }),
76
+ ),
77
+ credentials: OpenStruct.new(access_token: "foo"),
70
78
  extra: OpenStruct.new(extra_hash)
71
- })
79
+ )
72
80
  }
73
81
  )
74
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_accounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.9.0
4
+ version: 7.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-09 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -220,6 +220,20 @@ dependencies:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: shoulda-matchers
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: quiet_assets
225
239
  requirement: !ruby/object:Gem::Requirement
@@ -349,6 +363,7 @@ files:
349
363
  - config/routes.rb
350
364
  - db/migrate/0_create_openstax_accounts_accounts.rb
351
365
  - db/migrate/10_assign_missing_uuids_for_local_accounts.rb
366
+ - db/migrate/11_add_support_identifier_to_accounts_accounts.rb
352
367
  - db/migrate/1_create_openstax_accounts_groups.rb
353
368
  - db/migrate/2_create_openstax_accounts_group_members.rb
354
369
  - db/migrate/3_create_openstax_accounts_group_owners.rb