solidus_identifiers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +35 -0
  3. data/.gem_release.yml +5 -0
  4. data/.github/stale.yml +17 -0
  5. data/.gitignore +21 -0
  6. data/.gitlab/ci.yml +63 -0
  7. data/.rspec +2 -0
  8. data/.rubocop.yml +17 -0
  9. data/Gemfile +33 -0
  10. data/LICENSE +26 -0
  11. data/README.md +396 -0
  12. data/Rakefile +6 -0
  13. data/app/decorators/solidus_identifiers/spree/api/api_helpers_decorator.rb +20 -0
  14. data/app/decorators/solidus_identifiers/spree/permission_sets/user_management_decorator.rb +15 -0
  15. data/app/decorators/solidus_identifiers/spree/permitted_attributes_decorator.rb +16 -0
  16. data/app/decorators/solidus_identifiers/spree/user_decorator.rb +11 -0
  17. data/app/models/spree/identifier.rb +19 -0
  18. data/app/models/spree/identifier_key.rb +17 -0
  19. data/app/views/spree/api/identifier_keys/_identifier_key.json.jbuilder +5 -0
  20. data/app/views/spree/api/identifier_keys/index.json.jbuilder +6 -0
  21. data/app/views/spree/api/identifier_keys/show.json.jbuilder +3 -0
  22. data/app/views/spree/api/identifiers/_identifier.json.jbuilder +14 -0
  23. data/app/views/spree/api/identifiers/index.json.jbuilder +6 -0
  24. data/app/views/spree/api/identifiers/show.json.jbuilder +3 -0
  25. data/app/views/spree/api/users/_user.json.jbuilder +31 -0
  26. data/bin/console +17 -0
  27. data/bin/r +15 -0
  28. data/bin/rake +7 -0
  29. data/bin/sandbox +84 -0
  30. data/bin/sandbox_rails +18 -0
  31. data/bin/setup +8 -0
  32. data/config/locales/en.yml +5 -0
  33. data/config/routes.rb +9 -0
  34. data/db/migrate/20200603191551_create_spree_identifier_keys.rb +10 -0
  35. data/db/migrate/20200603191555_create_spree_identifiers.rb +18 -0
  36. data/db/migrate/20200603203105_add_unique_index_to_spree_identifier_keys.rb +7 -0
  37. data/lib/controllers/api/spree/api/identifier_keys_controller.rb +15 -0
  38. data/lib/controllers/api/spree/api/identifiers_controller.rb +15 -0
  39. data/lib/generators/solidus_identifiers/install/install_generator.rb +26 -0
  40. data/lib/solidus_identifiers.rb +7 -0
  41. data/lib/solidus_identifiers/engine.rb +19 -0
  42. data/lib/solidus_identifiers/factories.rb +14 -0
  43. data/lib/solidus_identifiers/version.rb +5 -0
  44. data/solidus_identifiers.gemspec +38 -0
  45. data/spec/controllers/spree/api/identifier_keys_controller_spec.rb +151 -0
  46. data/spec/controllers/spree/api/identifiers_controller_spec.rb +161 -0
  47. data/spec/models/spree/identifier_key_spec.rb +21 -0
  48. data/spec/models/spree/identifier_spec.rb +33 -0
  49. data/spec/spec_helper.rb +32 -0
  50. metadata +174 -0
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Spree::Identifier, type: :model do
6
+ subject(:identifier) { instance }
7
+
8
+ let(:instance) { FactoryBot.build(:identifier, key: key, attachable: user) }
9
+ let(:user) { FactoryBot.create(:user) }
10
+ let(:key) { FactoryBot.create(:identifier_key) }
11
+
12
+ describe 'validations' do
13
+ let(:missing_attr) { nil }
14
+
15
+ before do
16
+ instance.send("#{missing_attr}=", nil) if missing_attr
17
+ end
18
+
19
+ it { is_expected.to be_valid }
20
+
21
+ context 'when value is blank' do
22
+ let(:missing_attr) { :value }
23
+
24
+ it { is_expected.not_to be_valid }
25
+ end
26
+
27
+ context 'when key_id is blank' do
28
+ let(:missing_attr) { :key_id }
29
+
30
+ it { is_expected.not_to be_valid }
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Configure Rails Environment
4
+ ENV['RAILS_ENV'] = 'test'
5
+
6
+ require 'byebug'
7
+ require 'rails-controller-testing'
8
+
9
+ # Run Coverage report
10
+ require 'solidus_dev_support/rspec/coverage'
11
+
12
+ # rubocop:disable Lint/AmbiguousBlockAssociation
13
+ require File.expand_path('dummy/config/environment.rb', __dir__).tap { |file|
14
+ # Create the dummy app if it's still missing.
15
+ system 'bin/rake extension:test_app' unless File.exist? file
16
+ }
17
+ # rubocop:enable Lint/AmbiguousBlockAssociation
18
+
19
+ # Requires factories and other useful helpers defined in spree_core.
20
+ require 'solidus_dev_support/rspec/feature_helper'
21
+
22
+ # Requires supporting ruby files with custom matchers and macros, etc,
23
+ # in spec/support/ and its subdirectories.
24
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
25
+
26
+ # Requires factories defined in lib/solidus_identifiers/factories.rb
27
+ require 'solidus_identifiers/factories'
28
+
29
+ RSpec.configure do |config|
30
+ config.infer_spec_type_from_file_location!
31
+ config.use_transactional_fixtures = false
32
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: solidus_identifiers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Taylor Scott
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: solidus_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
33
+ - !ruby/object:Gem::Dependency
34
+ name: solidus_support
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.4'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.4'
47
+ - !ruby/object:Gem::Dependency
48
+ name: byebug
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rails-controller-testing
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: solidus_dev_support
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ description: Map 3rd party services to a spree user.These can include facebook, twitch,
90
+ google, etc;
91
+ email: t.skukx@gmail.com
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files: []
95
+ files:
96
+ - ".circleci/config.yml"
97
+ - ".gem_release.yml"
98
+ - ".github/stale.yml"
99
+ - ".gitignore"
100
+ - ".gitlab/ci.yml"
101
+ - ".rspec"
102
+ - ".rubocop.yml"
103
+ - Gemfile
104
+ - LICENSE
105
+ - README.md
106
+ - Rakefile
107
+ - app/decorators/solidus_identifiers/spree/api/api_helpers_decorator.rb
108
+ - app/decorators/solidus_identifiers/spree/permission_sets/user_management_decorator.rb
109
+ - app/decorators/solidus_identifiers/spree/permitted_attributes_decorator.rb
110
+ - app/decorators/solidus_identifiers/spree/user_decorator.rb
111
+ - app/models/spree/identifier.rb
112
+ - app/models/spree/identifier_key.rb
113
+ - app/views/spree/api/identifier_keys/_identifier_key.json.jbuilder
114
+ - app/views/spree/api/identifier_keys/index.json.jbuilder
115
+ - app/views/spree/api/identifier_keys/show.json.jbuilder
116
+ - app/views/spree/api/identifiers/_identifier.json.jbuilder
117
+ - app/views/spree/api/identifiers/index.json.jbuilder
118
+ - app/views/spree/api/identifiers/show.json.jbuilder
119
+ - app/views/spree/api/users/_user.json.jbuilder
120
+ - bin/console
121
+ - bin/r
122
+ - bin/rake
123
+ - bin/sandbox
124
+ - bin/sandbox_rails
125
+ - bin/setup
126
+ - config/locales/en.yml
127
+ - config/routes.rb
128
+ - db/migrate/20200603191551_create_spree_identifier_keys.rb
129
+ - db/migrate/20200603191555_create_spree_identifiers.rb
130
+ - db/migrate/20200603203105_add_unique_index_to_spree_identifier_keys.rb
131
+ - lib/controllers/api/spree/api/identifier_keys_controller.rb
132
+ - lib/controllers/api/spree/api/identifiers_controller.rb
133
+ - lib/generators/solidus_identifiers/install/install_generator.rb
134
+ - lib/solidus_identifiers.rb
135
+ - lib/solidus_identifiers/engine.rb
136
+ - lib/solidus_identifiers/factories.rb
137
+ - lib/solidus_identifiers/version.rb
138
+ - solidus_identifiers.gemspec
139
+ - spec/controllers/spree/api/identifier_keys_controller_spec.rb
140
+ - spec/controllers/spree/api/identifiers_controller_spec.rb
141
+ - spec/models/spree/identifier_key_spec.rb
142
+ - spec/models/spree/identifier_spec.rb
143
+ - spec/spec_helper.rb
144
+ homepage: https://gitlab.com/deseretbook/packages/solidus_identifiers
145
+ licenses:
146
+ - BSD-3-Clause
147
+ metadata:
148
+ homepage_uri: https://gitlab.com/deseretbook/packages/solidus_identifiers
149
+ source_code_uri: https://gitlab.com/deseretbook/packages/solidus_identifiers
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '2.5'
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubygems_version: 3.0.8
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: Map 3rd party services to a spree user
169
+ test_files:
170
+ - spec/controllers/spree/api/identifier_keys_controller_spec.rb
171
+ - spec/controllers/spree/api/identifiers_controller_spec.rb
172
+ - spec/models/spree/identifier_key_spec.rb
173
+ - spec/models/spree/identifier_spec.rb
174
+ - spec/spec_helper.rb