solidus_stock_supplier 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +235 -0
  5. data/.rvmrc +1 -0
  6. data/.travis.yml +30 -0
  7. data/Gemfile +8 -0
  8. data/LICENSE +26 -0
  9. data/README.md +36 -0
  10. data/Rakefile +30 -0
  11. data/app/assets/javascripts/spree/backend/solidus_stock_supplier.js +47 -0
  12. data/app/assets/javascripts/spree/backend/templates/stock_transfers/supplier_checkbox.hbs +4 -0
  13. data/app/assets/javascripts/spree/frontend/solidus_stock_supplier.js +2 -0
  14. data/app/assets/stylesheets/spree/backend/solidus_stock_supplier.css +4 -0
  15. data/app/assets/stylesheets/spree/frontend/solidus_stock_supplier.css +4 -0
  16. data/app/controllers/spree/admin/stock_items_controller_decorator.rb +1 -0
  17. data/app/controllers/spree/admin/stock_locations_controller_decorator.rb +6 -0
  18. data/app/controllers/spree/admin/stock_transfers_controller_decorator.rb +13 -0
  19. data/app/controllers/spree/admin/suppliers_controller.rb +12 -0
  20. data/app/models/concerns/solidus_stock_supplier/location_scopes_concern.rb +10 -0
  21. data/app/models/concerns/solidus_stock_supplier/stock_items_controller_extension.rb +7 -0
  22. data/app/models/spree/supplier.rb +17 -0
  23. data/app/models/spree/supplier_stock_location.rb +5 -0
  24. data/app/models/stock_location_decorator.rb +1 -0
  25. data/app/views/spree/admin/stock_locations/index.json.jbuilder +11 -0
  26. data/app/views/spree/admin/suppliers/_form.html.erb +20 -0
  27. data/app/views/spree/admin/suppliers/edit.html.erb +13 -0
  28. data/app/views/spree/admin/suppliers/index.html.erb +43 -0
  29. data/app/views/spree/admin/suppliers/new.html.erb +15 -0
  30. data/bin/rails +7 -0
  31. data/config/locales/en.yml +13 -0
  32. data/config/routes.rb +5 -0
  33. data/db/migrate/20171028052439_create_suppliers.rb +11 -0
  34. data/db/migrate/20171029052411_add_type_to_stock_locations.rb +6 -0
  35. data/lib/generators/solidus_stock_supplier/install/install_generator.rb +30 -0
  36. data/lib/solidus_stock_supplier.rb +3 -0
  37. data/lib/solidus_stock_supplier/engine.rb +30 -0
  38. data/lib/solidus_stock_supplier/version.rb +3 -0
  39. data/solidus_stock_supplier.gemspec +36 -0
  40. data/spec/controllers/spree/admin/suppliers_controller_spec.rb +100 -0
  41. data/spec/factories.rb +6 -0
  42. data/spec/models/spree/supplier_spec.rb +8 -0
  43. data/spec/spec_helper.rb +96 -0
  44. metadata +295 -0
data/spec/factories.rb ADDED
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :supplier, class: 'Spree::Supplier' do
3
+ name FFaker::Company.name
4
+ uid FFaker::CompanyIT.partita_iva
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Spree::Supplier, type: :model do
4
+ it { should validate_presence_of(:name) }
5
+ it { should validate_uniqueness_of(:name) }
6
+ it { should validate_presence_of(:uid) }
7
+ it { should validate_uniqueness_of(:uid) }
8
+ end
@@ -0,0 +1,96 @@
1
+ # Run Coverage report
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter 'spec/dummy'
5
+ add_group 'Controllers', 'app/controllers'
6
+ add_group 'Helpers', 'app/helpers'
7
+ add_group 'Mailers', 'app/mailers'
8
+ add_group 'Models', 'app/models'
9
+ add_group 'Views', 'app/views'
10
+ add_group 'Libraries', 'lib'
11
+ end
12
+
13
+ # Configure Rails Environment
14
+ ENV['RAILS_ENV'] = 'test'
15
+
16
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
17
+
18
+ require 'rspec/rails'
19
+ require 'database_cleaner'
20
+ require 'ffaker'
21
+ require 'shoulda/matchers'
22
+
23
+ # Requires supporting ruby files with custom matchers and macros, etc,
24
+ # in spec/support/ and its subdirectories.
25
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
26
+
27
+ # Requires factories and other useful helpers defined in spree_core.
28
+ require 'spree/testing_support/authorization_helpers'
29
+ require 'spree/testing_support/capybara_ext'
30
+ require 'spree/testing_support/controller_requests'
31
+ require 'spree/testing_support/factories'
32
+ require 'spree/testing_support/url_helpers'
33
+
34
+ # Requires factories
35
+ require 'factories'
36
+
37
+ RSpec.configure do |config|
38
+ config.include FactoryBot::Syntax::Methods
39
+
40
+ # Infer an example group's spec type from the file location.
41
+ config.infer_spec_type_from_file_location!
42
+
43
+ # == URL Helpers
44
+ #
45
+ # Allows access to Spree's routes in specs:
46
+ #
47
+ # visit spree.admin_path
48
+ # current_path.should eql(spree.products_path)
49
+ config.include Spree::TestingSupport::UrlHelpers
50
+ config.include Spree::TestingSupport::ControllerRequests, type: :controller
51
+
52
+ # == Mock Framework
53
+ #
54
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
55
+ #
56
+ # config.mock_with :mocha
57
+ # config.mock_with :flexmock
58
+ # config.mock_with :rr
59
+ config.mock_with :rspec
60
+ config.color = true
61
+
62
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
63
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
64
+
65
+ # Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
66
+ # to cleanup after each test instead. Without transactional fixtures set to false the records created
67
+ # to setup a test will be unavailable to the browser, which runs under a separate server instance.
68
+ config.use_transactional_fixtures = false
69
+
70
+ # Ensure Suite is set to use transactions for speed.
71
+ config.before :suite do
72
+ DatabaseCleaner.strategy = :transaction
73
+ DatabaseCleaner.clean_with :truncation
74
+ end
75
+
76
+ # Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
77
+ config.before :each do
78
+ DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
79
+ DatabaseCleaner.start
80
+ end
81
+
82
+ # After each spec clean the database.
83
+ config.after :each do
84
+ DatabaseCleaner.clean
85
+ end
86
+
87
+ config.fail_fast = ENV['FAIL_FAST'] || false
88
+ config.order = 'random'
89
+ end
90
+
91
+ Shoulda::Matchers.configure do |config|
92
+ config.integrate do |with|
93
+ with.test_framework :rspec
94
+ with.library :rails
95
+ end
96
+ end
metadata ADDED
@@ -0,0 +1,295 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: solidus_stock_supplier
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - César Carruitero
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-06 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: solidus_support
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capybara
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: database_cleaner
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_bot
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ffaker
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mysql2
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pg
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: poltergeist
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec-rails
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: sass-rails
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: shoulda-matchers
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: simplecov
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: sqlite3
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ description: Adds support to receive stock from supplier in Solidus
224
+ email: ccarruitero@protonmail.com
225
+ executables: []
226
+ extensions: []
227
+ extra_rdoc_files: []
228
+ files:
229
+ - ".gitignore"
230
+ - ".rspec"
231
+ - ".rubocop.yml"
232
+ - ".rvmrc"
233
+ - ".travis.yml"
234
+ - Gemfile
235
+ - LICENSE
236
+ - README.md
237
+ - Rakefile
238
+ - app/assets/javascripts/spree/backend/solidus_stock_supplier.js
239
+ - app/assets/javascripts/spree/backend/templates/stock_transfers/supplier_checkbox.hbs
240
+ - app/assets/javascripts/spree/frontend/solidus_stock_supplier.js
241
+ - app/assets/stylesheets/spree/backend/solidus_stock_supplier.css
242
+ - app/assets/stylesheets/spree/frontend/solidus_stock_supplier.css
243
+ - app/controllers/spree/admin/stock_items_controller_decorator.rb
244
+ - app/controllers/spree/admin/stock_locations_controller_decorator.rb
245
+ - app/controllers/spree/admin/stock_transfers_controller_decorator.rb
246
+ - app/controllers/spree/admin/suppliers_controller.rb
247
+ - app/models/concerns/solidus_stock_supplier/location_scopes_concern.rb
248
+ - app/models/concerns/solidus_stock_supplier/stock_items_controller_extension.rb
249
+ - app/models/spree/supplier.rb
250
+ - app/models/spree/supplier_stock_location.rb
251
+ - app/models/stock_location_decorator.rb
252
+ - app/views/spree/admin/stock_locations/index.json.jbuilder
253
+ - app/views/spree/admin/suppliers/_form.html.erb
254
+ - app/views/spree/admin/suppliers/edit.html.erb
255
+ - app/views/spree/admin/suppliers/index.html.erb
256
+ - app/views/spree/admin/suppliers/new.html.erb
257
+ - bin/rails
258
+ - config/locales/en.yml
259
+ - config/routes.rb
260
+ - db/migrate/20171028052439_create_suppliers.rb
261
+ - db/migrate/20171029052411_add_type_to_stock_locations.rb
262
+ - lib/generators/solidus_stock_supplier/install/install_generator.rb
263
+ - lib/solidus_stock_supplier.rb
264
+ - lib/solidus_stock_supplier/engine.rb
265
+ - lib/solidus_stock_supplier/version.rb
266
+ - solidus_stock_supplier.gemspec
267
+ - spec/controllers/spree/admin/suppliers_controller_spec.rb
268
+ - spec/factories.rb
269
+ - spec/models/spree/supplier_spec.rb
270
+ - spec/spec_helper.rb
271
+ homepage: https://github.com/ccarruitero/solidus_stock_supplier
272
+ licenses:
273
+ - BSD-3-Clause
274
+ metadata: {}
275
+ post_install_message:
276
+ rdoc_options: []
277
+ require_paths:
278
+ - lib
279
+ required_ruby_version: !ruby/object:Gem::Requirement
280
+ requirements:
281
+ - - ">="
282
+ - !ruby/object:Gem::Version
283
+ version: '0'
284
+ required_rubygems_version: !ruby/object:Gem::Requirement
285
+ requirements:
286
+ - - ">="
287
+ - !ruby/object:Gem::Version
288
+ version: '0'
289
+ requirements: []
290
+ rubyforge_project:
291
+ rubygems_version: 2.6.13
292
+ signing_key:
293
+ specification_version: 4
294
+ summary: Adds support to receive stock from supplier in Solidus
295
+ test_files: []